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

Unified Diff: Source/core/rendering/svg/SVGRenderSupport.cpp

Issue 630903003: Move common GC state update code out of paint-server application (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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/rendering/svg/SVGRenderSupport.cpp
diff --git a/Source/core/rendering/svg/SVGRenderSupport.cpp b/Source/core/rendering/svg/SVGRenderSupport.cpp
index 2a51b9ce6fd21cf817a9d8b5c0014625ef3dd8c1..7df56c24038d565c16f87864997b3d559116d6c9 100644
--- a/Source/core/rendering/svg/SVGRenderSupport.cpp
+++ b/Source/core/rendering/svg/SVGRenderSupport.cpp
@@ -402,6 +402,37 @@ void SVGRenderSupport::fillOrStrokePath(GraphicsContext* context, unsigned short
context->strokePath(path);
}
+void SVGRenderSupport::updateGraphicsContext(GraphicsContext* context, const RenderStyle* style, const RenderObject& renderer, unsigned resourceModeFlags)
+{
+ ASSERT(context);
+ ASSERT(style);
+
+ RenderSVGResourceMode resourceMode = static_cast<RenderSVGResourceMode>(resourceModeFlags & (ApplyToFillMode | ApplyToStrokeMode));
+ ASSERT(resourceMode == ApplyToFillMode || resourceMode == ApplyToStrokeMode);
+
+ if (isRenderingClipPathAsMaskImage(renderer)) {
+ // When rendering the mask for a RenderSVGResourceClipper, the stroke code path is never hit.
+ ASSERT(resourceMode == ApplyToFillMode);
+ context->setAlphaAsFloat(1);
+ if (resourceModeFlags & ApplyToTextMode)
+ context->setTextDrawingMode(TextModeFill);
+ return;
+ }
+
+ const SVGRenderStyle& svgStyle = style->svgStyle();
+
+ if (resourceMode == ApplyToFillMode) {
+ context->setAlphaAsFloat(svgStyle.fillOpacity());
+ context->setFillRule(svgStyle.fillRule());
+ } else {
+ context->setAlphaAsFloat(svgStyle.strokeOpacity());
+ applyStrokeStyleToContext(context, style, &renderer);
+ }
+
+ if (resourceModeFlags & ApplyToTextMode)
+ context->setTextDrawingMode(resourceMode == ApplyToFillMode ? TextModeFill : TextModeStroke);
+}
+
bool SVGRenderSupport::isRenderableTextNode(const RenderObject* object)
{
ASSERT(object->isText());
« Source/core/rendering/svg/SVGRenderSupport.h ('K') | « Source/core/rendering/svg/SVGRenderSupport.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698