Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1055)

Unified Diff: Source/core/html/canvas/CanvasRenderingContext2D.h

Issue 14298018: This CL implements the first draft of Canvas 2D Context Attributes, aka getContext('2d', { alpha: f… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased to ToT; test cleanup Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/html/canvas/CanvasRenderingContext2D.h
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.h b/Source/core/html/canvas/CanvasRenderingContext2D.h
index b494457384d3a05c4d7d69d9da458962da0a19b4..cafba659c272018e7af7873a1a7ee46a1094bab0 100644
--- a/Source/core/html/canvas/CanvasRenderingContext2D.h
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.h
@@ -26,6 +26,7 @@
#ifndef CanvasRenderingContext2D_h
#define CanvasRenderingContext2D_h
+#include "core/html/canvas/Canvas2DContextAttributes.h"
#include "core/html/canvas/CanvasPathMethods.h"
#include "core/html/canvas/CanvasRenderingContext.h"
#include "core/platform/graphics/Color.h"
@@ -60,9 +61,9 @@ typedef int ExceptionCode;
class CanvasRenderingContext2D : public CanvasRenderingContext, public CanvasPathMethods {
public:
- static PassOwnPtr<CanvasRenderingContext2D> create(HTMLCanvasElement* canvas, bool usesCSSCompatibilityParseMode)
+ static PassOwnPtr<CanvasRenderingContext2D> create(HTMLCanvasElement* canvas, const Canvas2DContextAttributes* attrs, bool usesCSSCompatibilityParseMode)
{
- return adoptPtr(new CanvasRenderingContext2D(canvas, usesCSSCompatibilityParseMode));
+ return adoptPtr(new CanvasRenderingContext2D(canvas, attrs, usesCSSCompatibilityParseMode));
}
virtual ~CanvasRenderingContext2D();
@@ -220,6 +221,8 @@ public:
bool webkitImageSmoothingEnabled() const;
void setWebkitImageSmoothingEnabled(bool);
+ PassRefPtr<Canvas2DContextAttributes> getContextAttributes() const;
+
private:
struct State : FontSelectorClient {
State();
@@ -267,7 +270,7 @@ private:
CanvasDidDrawApplyAll = 0xffffffff
};
- CanvasRenderingContext2D(HTMLCanvasElement*, bool usesCSSCompatibilityParseMode);
+ CanvasRenderingContext2D(HTMLCanvasElement*, const Canvas2DContextAttributes* attrs, bool usesCSSCompatibilityParseMode);
State& modifiableState() { ASSERT(!m_unrealizedSaveCount); return m_stateStack.last(); }
const State& state() const { return m_stateStack.last(); }
@@ -316,6 +319,7 @@ private:
virtual bool is2d() const OVERRIDE { return true; }
virtual bool isAccelerated() const OVERRIDE;
+ virtual bool hasAlpha() const OVERRIDE { return m_hasAlpha; }
virtual bool isTransformInvertible() const { return state().m_invertibleCTM; }
@@ -324,6 +328,7 @@ private:
Vector<State, 1> m_stateStack;
unsigned m_unrealizedSaveCount;
bool m_usesCSSCompatibilityParseMode;
+ bool m_hasAlpha;
};
} // namespace WebCore
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext.h ('k') | Source/core/html/canvas/CanvasRenderingContext2D.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698