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

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

Issue 211503006: Implementation of 2D canvas context lost/restored events (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: adding missing file Created 6 years, 9 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 0428bdcac6fef5dd5ab1fca4e329b158c4a5ffc5..8e5b8834469f930ea11514b82726b6141d4a2834 100644
--- a/Source/core/html/canvas/CanvasRenderingContext2D.h
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.h
@@ -112,6 +112,8 @@ public:
float globalAlpha() const;
void setGlobalAlpha(float);
+ bool isContextLost() const;
+
String globalCompositeOperation() const;
void setGlobalCompositeOperation(const String&);
@@ -233,6 +235,9 @@ public:
void drawFocusIfNeeded(Element*);
bool drawCustomFocusRing(Element*);
+ void loseContext();
+ void restoreContext();
+
private:
struct State FINAL : CSSFontSelectorClient {
State();
@@ -285,6 +290,10 @@ private:
void applyShadow();
bool shouldDrawShadows() const;
+ void dispatchContextLostEvent(Timer<CanvasRenderingContext2D>*);
+ void dispatchContextRestoredEvent(Timer<CanvasRenderingContext2D>*);
+ void tryRestoreSurfaceEvent(Timer<CanvasRenderingContext2D>*);
Stephen White 2014/03/25 23:25:04 Naming nit: does "surface" really have a meaning a
+
bool computeDirtyRect(const FloatRect& localBounds, FloatRect*);
bool computeDirtyRect(const FloatRect& localBounds, const FloatRect& transformedClipBounds, FloatRect*);
void didDraw(const FloatRect&);
@@ -335,7 +344,14 @@ private:
Vector<State, 1> m_stateStack;
bool m_usesCSSCompatibilityParseMode;
bool m_hasAlpha;
+ bool m_isContextLost;
+ bool m_contextRestorable;
+ Canvas2DContextStorage m_storageMode;
MutableStylePropertyMap m_fetchedFonts;
+ unsigned m_tryRestoreSurfaceAttemptCount;
+ Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer;
+ Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer;
+ Timer<CanvasRenderingContext2D> m_tryRestoreSurfaceEventTimer;
};
DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, context->is2d(), context.is2d());

Powered by Google App Engine
This is Rietveld 408576698