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

Side by Side Diff: Source/core/rendering/svg/RenderSVGResourceContainer.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 ASSERT((*it)->hasPendingResources()); 225 ASSERT((*it)->hasPendingResources());
226 extensions.clearHasPendingResourcesIfPossible(*it); 226 extensions.clearHasPendingResourcesIfPossible(*it);
227 RenderObject* renderer = (*it)->renderer(); 227 RenderObject* renderer = (*it)->renderer();
228 if (!renderer) 228 if (!renderer)
229 continue; 229 continue;
230 SVGResourcesCache::clientStyleChanged(renderer, StyleDifferenceLayout, r enderer->style()); 230 SVGResourcesCache::clientStyleChanged(renderer, StyleDifferenceLayout, r enderer->style());
231 renderer->setNeedsLayout(); 231 renderer->setNeedsLayout();
232 } 232 }
233 } 233 }
234 234
235 AffineTransform RenderSVGResourceContainer::computeResourceSpaceTransform(Render Object* object, const AffineTransform& baseTransform, const SVGRenderStyle* svgS tyle, unsigned short resourceMode)
236 {
237 AffineTransform computedSpaceTransform = baseTransform;
238 if (resourceMode & ApplyToTextMode) {
239 // Depending on the font scaling factor, we may need to apply an
240 // additional transform (scale-factor) the paintserver, since text
241 // painting removes the scale factor from the context. (See
242 // SVGInlineTextBox::paintTextWithShadows.)
243 AffineTransform additionalTextTransformation;
244 if (shouldTransformOnTextPainting(object, additionalTextTransformation))
245 computedSpaceTransform = additionalTextTransformation * computedSpac eTransform;
246 }
247 if (resourceMode & ApplyToStrokeMode) {
248 // Non-scaling stroke needs to reset the transform back to the host tran sform.
249 if (svgStyle->vectorEffect() == VE_NON_SCALING_STROKE)
250 computedSpaceTransform = transformOnNonScalingStroke(object, compute dSpaceTransform);
251 }
252 return computedSpaceTransform;
253 }
254
235 bool RenderSVGResourceContainer::shouldTransformOnTextPainting(RenderObject* obj ect, AffineTransform& resourceTransform) 255 bool RenderSVGResourceContainer::shouldTransformOnTextPainting(RenderObject* obj ect, AffineTransform& resourceTransform)
236 { 256 {
237 ASSERT_UNUSED(object, object); 257 ASSERT_UNUSED(object, object);
238 258
239 // This method should only be called for RenderObjects that deal with text r endering. Cmp. RenderObject.h's is*() methods. 259 // This method should only be called for RenderObjects that deal with text r endering. Cmp. RenderObject.h's is*() methods.
240 ASSERT(object->isSVGText() || object->isSVGTextPath() || object->isSVGInline ()); 260 ASSERT(object->isSVGText() || object->isSVGTextPath() || object->isSVGInline ());
241 261
242 // In text drawing, the scaling part of the graphics context CTM is removed, compare SVGInlineTextBox::paintTextWithShadows. 262 // In text drawing, the scaling part of the graphics context CTM is removed, compare SVGInlineTextBox::paintTextWithShadows.
243 // So, we use that scaling factor here, too, and then push it down to patter n or gradient space 263 // So, we use that scaling factor here, too, and then push it down to patter n or gradient space
244 // in order to keep the pattern or gradient correctly scaled. 264 // in order to keep the pattern or gradient correctly scaled.
(...skipping 10 matching lines...) Expand all
255 if (!object->isSVGShape()) 275 if (!object->isSVGShape())
256 return resourceTransform; 276 return resourceTransform;
257 277
258 SVGGraphicsElement* element = toSVGGraphicsElement(object->node()); 278 SVGGraphicsElement* element = toSVGGraphicsElement(object->node());
259 AffineTransform transform = element->getScreenCTM(SVGGraphicsElement::Disall owStyleUpdate); 279 AffineTransform transform = element->getScreenCTM(SVGGraphicsElement::Disall owStyleUpdate);
260 transform *= resourceTransform; 280 transform *= resourceTransform;
261 return transform; 281 return transform;
262 } 282 }
263 283
264 } 284 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGResourceContainer.h ('k') | Source/core/rendering/svg/RenderSVGResourceGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698