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

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

Issue 651243002: Clarify GraphicsContext::beginLayer()/endLayer() have unexpected behaviors. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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.cpp
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
index a1911e5990147f992e81a3511e0192d35fa2bb4a..4f8f1691ce6c16f473347fbe96058292454d7c84 100644
--- a/Source/core/html/canvas/CanvasRenderingContext2D.cpp
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
@@ -1564,6 +1564,7 @@ void CanvasRenderingContext2D::drawImageInternal(CanvasImageSource* imageSource,
didDraw(dirtyRect);
}
}
+ validateStateStack();
dshwang 2014/10/14 19:00:28 I move it to here, because drawVideo is used as fo
if (sourceImageStatus == ExternalSourceImageStatus && isAccelerated() && canvas()->buffer())
canvas()->buffer()->flush();
@@ -1582,7 +1583,6 @@ void CanvasRenderingContext2D::drawVideo(HTMLVideoElement* video, FloatRect srcR
c->translate(-srcRect.x(), -srcRect.y());
video->paintCurrentFrameInContext(c, IntRect(IntPoint(), IntSize(video->videoWidth(), video->videoHeight())));
stateSaver.restore();
- validateStateStack();
Justin Novosad 2014/10/14 17:50:25 why are you removing this?
}
void CanvasRenderingContext2D::drawImageFromRect(HTMLImageElement* image,
@@ -1647,10 +1647,8 @@ template<class T> void CanvasRenderingContext2D::fullCanvasCompositedFill(const
GraphicsContext* c = drawingContext();
ASSERT(c);
c->beginLayer(1, state().m_globalComposite);
- CompositeOperator previousOperator = c->compositeOperation();
c->setCompositeOperation(CompositeSourceOver);
fillPrimitive(area, c);
- c->setCompositeOperation(previousOperator);
c->endLayer();
}
@@ -1671,10 +1669,8 @@ template<class T> void CanvasRenderingContext2D::fullCanvasCompositedStroke(cons
GraphicsContext* c = drawingContext();
ASSERT(c);
c->beginLayer(1, state().m_globalComposite);
- CompositeOperator previousOperator = c->compositeOperation();
c->setCompositeOperation(CompositeSourceOver);
strokePrimitive(area, c);
- c->setCompositeOperation(previousOperator);
c->endLayer();
}
@@ -2236,10 +2232,8 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo
if (isFullCanvasCompositeMode(state().m_globalComposite)) {
c->beginLayer(1, state().m_globalComposite);
- CompositeOperator previousOperator = c->compositeOperation();
c->setCompositeOperation(CompositeSourceOver);
c->drawBidiText(font, textRunPaintInfo, location, Font::UseFallbackIfFontNotReady);
- c->setCompositeOperation(previousOperator);
c->endLayer();
didDraw(clipBounds);
} else if (state().m_globalComposite == CompositeCopy) {

Powered by Google App Engine
This is Rietveld 408576698