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

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: rebase 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 c5b9efadd002a6999f58f16aa4f27baf7a0b752a..4bddf938b2f17b4cf6e6c2f4843cb2ec0f8db593 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&);
@@ -227,6 +229,9 @@ public:
void drawFocusIfNeeded(Element*);
bool drawCustomFocusRing(Element*);
+ void loseContext();
+ void restoreContext();
+
private:
class State FINAL : public CSSFontSelectorClient {
public:
@@ -282,6 +287,10 @@ private:
void applyShadow();
bool shouldDrawShadows() const;
+ void dispatchContextLostEvent(Timer<CanvasRenderingContext2D>*);
+ void dispatchContextRestoredEvent(Timer<CanvasRenderingContext2D>*);
+ void tryRestoreContextEvent(Timer<CanvasRenderingContext2D>*);
+
bool computeDirtyRect(const FloatRect& localBounds, FloatRect*);
bool computeDirtyRect(const FloatRect& localBounds, const FloatRect& transformedClipBounds, FloatRect*);
void didDraw(const FloatRect&);
@@ -334,7 +343,14 @@ private:
WillBePersistentHeapVector<OwnPtrWillBeMember<State> > m_stateStack;
bool m_usesCSSCompatibilityParseMode;
bool m_hasAlpha;
+ bool m_isContextLost;
+ bool m_contextRestorable;
+ Canvas2DContextStorage m_storageMode;
MutableStylePropertyMap m_fetchedFonts;
+ unsigned m_tryRestoreContextAttemptCount;
+ Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer;
+ Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer;
+ Timer<CanvasRenderingContext2D> m_tryRestoreContextEventTimer;
};
DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, context->is2d(), context.is2d());
« no previous file with comments | « Source/core/html/canvas/Canvas2DContextAttributes.idl ('k') | Source/core/html/canvas/CanvasRenderingContext2D.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698