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

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

Issue 230443003: Fix application of OBB paint-servers when device scale != 1 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase. Created 6 years, 8 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/RenderSVGResourceGradient.cpp
diff --git a/Source/core/rendering/svg/RenderSVGResourceGradient.cpp b/Source/core/rendering/svg/RenderSVGResourceGradient.cpp
index 1c026e5201a7768c6c29b0651366f010ec73cc61..6f44a65b116012aa881e069ad581c6b6c7ebcfcf 100644
--- a/Source/core/rendering/svg/RenderSVGResourceGradient.cpp
+++ b/Source/core/rendering/svg/RenderSVGResourceGradient.cpp
@@ -85,8 +85,6 @@ bool RenderSVGResourceGradient::applyResource(RenderObject* object, RenderStyle*
if (!gradientData)
gradientData = adoptPtr(new GradientData);
- bool isPaintingText = resourceMode & ApplyToTextMode;
-
// Create gradient object
if (!gradientData->gradient) {
buildGradient(gradientData.get());
@@ -101,35 +99,28 @@ bool RenderSVGResourceGradient::applyResource(RenderObject* object, RenderStyle*
calculateGradientTransform(gradientTransform);
gradientData->userspaceTransform *= gradientTransform;
- if (isPaintingText) {
- // Depending on font scaling factor, we may need to rescale the gradient here since
- // text painting removes the scale factor from the context.
- AffineTransform additionalTextTransform;
- if (shouldTransformOnTextPainting(object, additionalTextTransform))
- gradientData->userspaceTransform *= additionalTextTransform;
- }
- gradientData->gradient->setGradientSpaceTransform(gradientData->userspaceTransform);
}
if (!gradientData->gradient)
return false;
+ const SVGRenderStyle* svgStyle = style->svgStyle();
+ ASSERT(svgStyle);
+
+ AffineTransform computedGradientSpaceTransform = computeResourceSpaceTransform(object, gradientData->userspaceTransform, svgStyle, resourceMode);
+ gradientData->gradient->setGradientSpaceTransform(computedGradientSpaceTransform);
+
// Draw gradient
context->save();
- if (isPaintingText)
+ if (resourceMode & ApplyToTextMode)
context->setTextDrawingMode(resourceMode & ApplyToFillMode ? TextModeFill : TextModeStroke);
- const SVGRenderStyle* svgStyle = style->svgStyle();
- ASSERT(svgStyle);
-
if (resourceMode & ApplyToFillMode) {
context->setAlphaAsFloat(svgStyle->fillOpacity());
context->setFillGradient(gradientData->gradient);
context->setFillRule(svgStyle->fillRule());
} else if (resourceMode & ApplyToStrokeMode) {
- if (svgStyle->vectorEffect() == VE_NON_SCALING_STROKE)
- gradientData->gradient->setGradientSpaceTransform(transformOnNonScalingStroke(object, gradientData->userspaceTransform));
context->setAlphaAsFloat(svgStyle->strokeOpacity());
context->setStrokeGradient(gradientData->gradient);
SVGRenderSupport::applyStrokeStyleToContext(context, style, object);
« no previous file with comments | « Source/core/rendering/svg/RenderSVGResourceContainer.cpp ('k') | Source/core/rendering/svg/RenderSVGResourcePattern.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698