OLD | NEW |
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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 176 |
177 m_renderingFlags |= RenderingPrepared; | 177 m_renderingFlags |= RenderingPrepared; |
178 } | 178 } |
179 | 179 |
180 static AffineTransform& currentContentTransformation() | 180 static AffineTransform& currentContentTransformation() |
181 { | 181 { |
182 DEFINE_STATIC_LOCAL(AffineTransform, s_currentContentTransformation, ()); | 182 DEFINE_STATIC_LOCAL(AffineTransform, s_currentContentTransformation, ()); |
183 return s_currentContentTransformation; | 183 return s_currentContentTransformation; |
184 } | 184 } |
185 | 185 |
| 186 SubtreeContentTransformScope::SubtreeContentTransformScope(const AffineTransform
& subtreeContentTransformation) |
| 187 { |
| 188 AffineTransform& contentTransformation = currentContentTransformation(); |
| 189 m_savedContentTransformation = contentTransformation; |
| 190 contentTransformation = subtreeContentTransformation * contentTransformation
; |
| 191 } |
| 192 |
| 193 SubtreeContentTransformScope::~SubtreeContentTransformScope() |
| 194 { |
| 195 currentContentTransformation() = m_savedContentTransformation; |
| 196 } |
| 197 |
186 float SVGRenderingContext::calculateScreenFontSizeScalingFactor(const RenderObje
ct* renderer) | 198 float SVGRenderingContext::calculateScreenFontSizeScalingFactor(const RenderObje
ct* renderer) |
187 { | 199 { |
188 ASSERT(renderer); | 200 ASSERT(renderer); |
189 | 201 |
190 AffineTransform ctm; | 202 AffineTransform ctm; |
191 // FIXME: calculateDeviceSpaceTransformation() queries layer compositing sta
te - which is not | 203 // FIXME: calculateDeviceSpaceTransformation() queries layer compositing sta
te - which is not |
192 // supported during layout. Hence, the result may not include all CSS transf
orms. | 204 // supported during layout. Hence, the result may not include all CSS transf
orms. |
193 calculateDeviceSpaceTransformation(renderer, ctm); | 205 calculateDeviceSpaceTransformation(renderer, ctm); |
194 return narrowPrecisionToFloat(sqrt((pow(ctm.xScale(), 2) + pow(ctm.yScale(),
2)) / 2)); | 206 return narrowPrecisionToFloat(sqrt((pow(ctm.xScale(), 2) + pow(ctm.yScale(),
2)) / 2)); |
195 } | 207 } |
(...skipping 29 matching lines...) Expand all Loading... |
225 | 237 |
226 if (TransformationMatrix* layerTransform = layer->transform()) | 238 if (TransformationMatrix* layerTransform = layer->transform()) |
227 absoluteTransform = layerTransform->toAffineTransform() * absoluteTr
ansform; | 239 absoluteTransform = layerTransform->toAffineTransform() * absoluteTr
ansform; |
228 | 240 |
229 layer = layer->parent(); | 241 layer = layer->parent(); |
230 } | 242 } |
231 | 243 |
232 absoluteTransform.scale(deviceScaleFactor); | 244 absoluteTransform.scale(deviceScaleFactor); |
233 } | 245 } |
234 | 246 |
235 void SVGRenderingContext::renderSubtree(GraphicsContext* context, RenderObject*
item, const AffineTransform& subtreeContentTransformation) | 247 void SVGRenderingContext::renderSubtree(GraphicsContext* context, RenderObject*
item) |
236 { | 248 { |
| 249 ASSERT(context); |
237 ASSERT(item); | 250 ASSERT(item); |
238 ASSERT(context); | 251 ASSERT(!item->needsLayout()); |
239 | 252 |
240 PaintInfo info(context, PaintInfo::infiniteRect(), PaintPhaseForeground, Pai
ntBehaviorNormal); | 253 PaintInfo info(context, PaintInfo::infiniteRect(), PaintPhaseForeground, Pai
ntBehaviorNormal); |
241 | |
242 AffineTransform& contentTransformation = currentContentTransformation(); | |
243 AffineTransform savedContentTransformation = contentTransformation; | |
244 contentTransformation = subtreeContentTransformation * contentTransformation
; | |
245 | |
246 ASSERT(!item->needsLayout()); | |
247 item->paint(info, IntPoint()); | 254 item->paint(info, IntPoint()); |
248 | |
249 contentTransformation = savedContentTransformation; | |
250 } | 255 } |
251 | 256 |
252 FloatRect SVGRenderingContext::clampedAbsoluteTargetRect(const FloatRect& absolu
teTargetRect) | 257 FloatRect SVGRenderingContext::clampedAbsoluteTargetRect(const FloatRect& absolu
teTargetRect) |
253 { | 258 { |
254 const FloatSize maxImageBufferSize(kMaxImageBufferSize, kMaxImageBufferSize)
; | 259 const FloatSize maxImageBufferSize(kMaxImageBufferSize, kMaxImageBufferSize)
; |
255 return FloatRect(absoluteTargetRect.location(), absoluteTargetRect.size().sh
runkTo(maxImageBufferSize)); | 260 return FloatRect(absoluteTargetRect.location(), absoluteTargetRect.size().sh
runkTo(maxImageBufferSize)); |
256 } | 261 } |
257 | 262 |
258 void SVGRenderingContext::clear2DRotation(AffineTransform& transform) | 263 void SVGRenderingContext::clear2DRotation(AffineTransform& transform) |
259 { | 264 { |
(...skipping 28 matching lines...) Expand all Loading... |
288 SVGImagePainter::paintForeground(toRenderSVGImage(*m_object), buffer
edInfo); | 293 SVGImagePainter::paintForeground(toRenderSVGImage(*m_object), buffer
edInfo); |
289 } else | 294 } else |
290 return false; | 295 return false; |
291 } | 296 } |
292 | 297 |
293 m_paintInfo->context->drawImageBuffer(imageBuffer.get(), boundingBox); | 298 m_paintInfo->context->drawImageBuffer(imageBuffer.get(), boundingBox); |
294 return true; | 299 return true; |
295 } | 300 } |
296 | 301 |
297 } // namespace blink | 302 } // namespace blink |
OLD | NEW |