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

Side by Side Diff: Source/core/rendering/svg/SVGRenderingContext.cpp

Issue 196413023: [SVG] Poor filter resolution when using CSS 3D transforms. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Moar comments. Created 6 years, 9 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
« no previous file with comments | « Source/core/rendering/svg/SVGRenderingContext.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org> 2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org>
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Google, Inc. All rights reserved. 5 * Copyright (C) 2009 Google, Inc. All rights reserved.
6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 { 196 {
197 DEFINE_STATIC_LOCAL(AffineTransform, s_currentContentTransformation, ()); 197 DEFINE_STATIC_LOCAL(AffineTransform, s_currentContentTransformation, ());
198 return s_currentContentTransformation; 198 return s_currentContentTransformation;
199 } 199 }
200 200
201 float SVGRenderingContext::calculateScreenFontSizeScalingFactor(const RenderObje ct* renderer) 201 float SVGRenderingContext::calculateScreenFontSizeScalingFactor(const RenderObje ct* renderer)
202 { 202 {
203 ASSERT(renderer); 203 ASSERT(renderer);
204 204
205 AffineTransform ctm; 205 AffineTransform ctm;
206 calculateTransformationToOutermostCoordinateSystem(renderer, ctm); 206 // FIXME: calculateDeviceSpaceTransformation() queries layer compositing sta te - which is not
207 // supported during layout. Hence, the result may not include all CSS transf orms.
208 calculateDeviceSpaceTransformation(renderer, ctm);
207 return narrowPrecisionToFloat(sqrt((pow(ctm.xScale(), 2) + pow(ctm.yScale(), 2)) / 2)); 209 return narrowPrecisionToFloat(sqrt((pow(ctm.xScale(), 2) + pow(ctm.yScale(), 2)) / 2));
208 } 210 }
209 211
210 void SVGRenderingContext::calculateTransformationToOutermostCoordinateSystem(con st RenderObject* renderer, AffineTransform& absoluteTransform) 212 void SVGRenderingContext::calculateDeviceSpaceTransformation(const RenderObject* renderer, AffineTransform& absoluteTransform)
211 { 213 {
214 // FIXME: trying to compute a device space transform at record time is wrong . All clients
215 // should be updated to avoid relying on this information, and the method sh ould be removed.
216
212 ASSERT(renderer); 217 ASSERT(renderer);
213 // We're about to possibly clear renderer, so save the deviceScaleFactor now . 218 // We're about to possibly clear renderer, so save the deviceScaleFactor now .
214 float deviceScaleFactor = renderer->document().frameHost()->deviceScaleFacto r(); 219 float deviceScaleFactor = renderer->document().frameHost()->deviceScaleFacto r();
215 220
216 // Walk up the render tree, accumulating SVG transforms. 221 // Walk up the render tree, accumulating SVG transforms.
217 absoluteTransform = currentContentTransformation(); 222 absoluteTransform = currentContentTransformation();
218 while (renderer) { 223 while (renderer) {
219 absoluteTransform = renderer->localToParentTransform() * absoluteTransfo rm; 224 absoluteTransform = renderer->localToParentTransform() * absoluteTransfo rm;
220 if (renderer->isSVGRoot()) 225 if (renderer->isSVGRoot())
221 break; 226 break;
222 renderer = renderer->parent(); 227 renderer = renderer->parent();
223 } 228 }
224 229
225 // Continue walking up the layer tree, accumulating CSS transforms. 230 // Continue walking up the layer tree, accumulating CSS transforms.
226 RenderLayer* layer = renderer ? renderer->enclosingLayer() : 0; 231 RenderLayer* layer = renderer ? renderer->enclosingLayer() : 0;
227 while (layer) { 232 while (layer && layer->isAllowedToQueryCompositingState()) {
228 if (TransformationMatrix* layerTransform = layer->transform())
229 absoluteTransform = layerTransform->toAffineTransform() * absoluteTr ansform;
230
231 // We can stop at compositing layers, to match the backing resolution. 233 // We can stop at compositing layers, to match the backing resolution.
232 // FIXME: should we be computing the transform to the nearest composited layer, 234 // FIXME: should we be computing the transform to the nearest composited layer,
233 // or the nearest composited layer that does not paint into its ancestor ? 235 // or the nearest composited layer that does not paint into its ancestor ?
234 // I think this is the nearest composited ancestor since we will inherit its 236 // I think this is the nearest composited ancestor since we will inherit its
235 // transforms in the composited layer tree. 237 // transforms in the composited layer tree.
236 if (layer->hasCompositedLayerMapping()) 238 if (layer->compositingState() != NotComposited)
237 break; 239 break;
238 240
241 if (TransformationMatrix* layerTransform = layer->transform())
242 absoluteTransform = layerTransform->toAffineTransform() * absoluteTr ansform;
243
239 layer = layer->parent(); 244 layer = layer->parent();
240 } 245 }
241 246
242 absoluteTransform.scale(deviceScaleFactor); 247 absoluteTransform.scale(deviceScaleFactor);
243 } 248 }
244 249
245 void SVGRenderingContext::renderSubtree(GraphicsContext* context, RenderObject* item, const AffineTransform& subtreeContentTransformation) 250 void SVGRenderingContext::renderSubtree(GraphicsContext* context, RenderObject* item, const AffineTransform& subtreeContentTransformation)
246 { 251 {
247 ASSERT(item); 252 ASSERT(item);
248 ASSERT(context); 253 ASSERT(context);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 toRenderSVGImage(m_object)->paintForeground(bufferedInfo); 303 toRenderSVGImage(m_object)->paintForeground(bufferedInfo);
299 } else 304 } else
300 return false; 305 return false;
301 } 306 }
302 307
303 m_paintInfo->context->drawImageBuffer(imageBuffer.get(), boundingBox); 308 m_paintInfo->context->drawImageBuffer(imageBuffer.get(), boundingBox);
304 return true; 309 return true;
305 } 310 }
306 311
307 } 312 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/SVGRenderingContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698