Index: Source/core/rendering/svg/RenderSVGResource.cpp |
diff --git a/Source/core/rendering/svg/RenderSVGResource.cpp b/Source/core/rendering/svg/RenderSVGResource.cpp |
index 2f0541c52138d5fecf133c82733d49bd2402edc7..e8f99f76cec0ef303158711be9958f36bbf51d7d 100644 |
--- a/Source/core/rendering/svg/RenderSVGResource.cpp |
+++ b/Source/core/rendering/svg/RenderSVGResource.cpp |
@@ -31,6 +31,7 @@ |
#include "core/rendering/svg/SVGRenderSupport.h" |
#include "core/rendering/svg/SVGResources.h" |
#include "core/rendering/svg/SVGResourcesCache.h" |
+#include "platform/graphics/GraphicsContext.h" |
namespace blink { |
@@ -129,6 +130,37 @@ RenderSVGResource* RenderSVGResource::requestPaintingResource(RenderSVGResourceM |
return uriResource; |
} |
+void RenderSVGResource::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 (SVGRenderSupport::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()); |
+ SVGRenderSupport::applyStrokeStyleToContext(context, style, &renderer); |
+ } |
+ |
+ if (resourceModeFlags & ApplyToTextMode) |
+ context->setTextDrawingMode(resourceMode == ApplyToFillMode ? TextModeFill : TextModeStroke); |
+} |
+ |
RenderSVGResourceSolidColor* RenderSVGResource::sharedSolidPaintingResource() |
{ |
static RenderSVGResourceSolidColor* s_sharedSolidPaintingResource = 0; |