OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> | 2 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> |
3 * Copyright (C) 2006 Apple Computer, Inc. | 3 * Copyright (C) 2006 Apple Computer, Inc. |
4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
5 * Copyright (C) 2007, 2008, 2009 Rob Buis <buis@kde.org> | 5 * Copyright (C) 2007, 2008, 2009 Rob Buis <buis@kde.org> |
6 * Copyright (C) 2009 Google, Inc. | 6 * Copyright (C) 2009 Google, Inc. |
7 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 7 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
8 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> | 8 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } | 50 } |
51 | 51 |
52 RenderSVGImage::~RenderSVGImage() | 52 RenderSVGImage::~RenderSVGImage() |
53 { | 53 { |
54 ImageQualityController::remove(this); | 54 ImageQualityController::remove(this); |
55 m_imageResource->shutdown(); | 55 m_imageResource->shutdown(); |
56 } | 56 } |
57 | 57 |
58 bool RenderSVGImage::updateImageViewport() | 58 bool RenderSVGImage::updateImageViewport() |
59 { | 59 { |
60 SVGImageElement* image = static_cast<SVGImageElement*>(node()); | 60 SVGImageElement* image = toSVGImageElement(node()); |
61 FloatRect oldBoundaries = m_objectBoundingBox; | 61 FloatRect oldBoundaries = m_objectBoundingBox; |
62 bool updatedViewport = false; | 62 bool updatedViewport = false; |
63 | 63 |
64 SVGLengthContext lengthContext(image); | 64 SVGLengthContext lengthContext(image); |
65 m_objectBoundingBox = FloatRect(image->x().value(lengthContext), image->y().
value(lengthContext), image->width().value(lengthContext), image->height().value
(lengthContext)); | 65 m_objectBoundingBox = FloatRect(image->x().value(lengthContext), image->y().
value(lengthContext), image->width().value(lengthContext), image->height().value
(lengthContext)); |
66 | 66 |
67 // Images with preserveAspectRatio=none should force non-uniform scaling. Th
is can be achieved | 67 // Images with preserveAspectRatio=none should force non-uniform scaling. Th
is can be achieved |
68 // by setting the image's container size to its intrinsic size. | 68 // by setting the image's container size to its intrinsic size. |
69 // See: http://www.w3.org/TR/SVG/single-page.html, 7.8 The ‘preserveAspectRa
tio’ attribute. | 69 // See: http://www.w3.org/TR/SVG/single-page.html, 7.8 The ‘preserveAspectRa
tio’ attribute. |
70 if (image->preserveAspectRatio().align() == SVGPreserveAspectRatio::SVG_PRES
ERVEASPECTRATIO_NONE) { | 70 if (image->preserveAspectRatio().align() == SVGPreserveAspectRatio::SVG_PRES
ERVEASPECTRATIO_NONE) { |
(...skipping 19 matching lines...) Expand all Loading... |
90 void RenderSVGImage::layout() | 90 void RenderSVGImage::layout() |
91 { | 91 { |
92 StackStats::LayoutCheckPoint layoutCheckPoint; | 92 StackStats::LayoutCheckPoint layoutCheckPoint; |
93 ASSERT(needsLayout()); | 93 ASSERT(needsLayout()); |
94 | 94 |
95 LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringL
ayout(this) && selfNeedsLayout()); | 95 LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringL
ayout(this) && selfNeedsLayout()); |
96 updateImageViewport(); | 96 updateImageViewport(); |
97 | 97 |
98 bool transformOrBoundariesUpdate = m_needsTransformUpdate || m_needsBoundari
esUpdate; | 98 bool transformOrBoundariesUpdate = m_needsTransformUpdate || m_needsBoundari
esUpdate; |
99 if (m_needsTransformUpdate) { | 99 if (m_needsTransformUpdate) { |
100 m_localTransform = static_cast<SVGImageElement*>(node())->animatedLocalT
ransform(); | 100 m_localTransform = toSVGImageElement(node())->animatedLocalTransform(); |
101 m_needsTransformUpdate = false; | 101 m_needsTransformUpdate = false; |
102 } | 102 } |
103 | 103 |
104 if (m_needsBoundariesUpdate) { | 104 if (m_needsBoundariesUpdate) { |
105 m_repaintBoundingBoxExcludingShadow = m_objectBoundingBox; | 105 m_repaintBoundingBoxExcludingShadow = m_objectBoundingBox; |
106 SVGRenderSupport::intersectRepaintRectWithResources(this, m_repaintBound
ingBoxExcludingShadow); | 106 SVGRenderSupport::intersectRepaintRectWithResources(this, m_repaintBound
ingBoxExcludingShadow); |
107 | 107 |
108 m_repaintBoundingBox = m_repaintBoundingBoxExcludingShadow; | 108 m_repaintBoundingBox = m_repaintBoundingBoxExcludingShadow; |
109 SVGRenderSupport::intersectRepaintRectWithShadows(this, m_repaintBoundin
gBox); | 109 SVGRenderSupport::intersectRepaintRectWithShadows(this, m_repaintBoundin
gBox); |
110 | 110 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 paintOutline(childPaintInfo, IntRect(boundingBox)); | 155 paintOutline(childPaintInfo, IntRect(boundingBox)); |
156 } | 156 } |
157 } | 157 } |
158 | 158 |
159 void RenderSVGImage::paintForeground(PaintInfo& paintInfo) | 159 void RenderSVGImage::paintForeground(PaintInfo& paintInfo) |
160 { | 160 { |
161 RefPtr<Image> image = m_imageResource->image(); | 161 RefPtr<Image> image = m_imageResource->image(); |
162 FloatRect destRect = m_objectBoundingBox; | 162 FloatRect destRect = m_objectBoundingBox; |
163 FloatRect srcRect(0, 0, image->width(), image->height()); | 163 FloatRect srcRect(0, 0, image->width(), image->height()); |
164 | 164 |
165 SVGImageElement* imageElement = static_cast<SVGImageElement*>(node()); | 165 SVGImageElement* imageElement = toSVGImageElement(node()); |
166 imageElement->preserveAspectRatio().transformRect(destRect, srcRect); | 166 imageElement->preserveAspectRatio().transformRect(destRect, srcRect); |
167 | 167 |
168 bool useLowQualityScaling = false; | 168 bool useLowQualityScaling = false; |
169 if (style()->svgStyle()->bufferedRendering() != BR_STATIC) | 169 if (style()->svgStyle()->bufferedRendering() != BR_STATIC) |
170 useLowQualityScaling = ImageQualityController::imageQualityController()-
>shouldPaintAtLowQuality(paintInfo.context, this, image.get(), image.get(), Layo
utSize(destRect.size())); | 170 useLowQualityScaling = ImageQualityController::imageQualityController()-
>shouldPaintAtLowQuality(paintInfo.context, this, image.get(), image.get(), Layo
utSize(destRect.size())); |
171 | 171 |
172 paintInfo.context->drawImage(image.get(), destRect, srcRect, CompositeSource
Over, DoNotRespectImageOrientation, useLowQualityScaling); | 172 paintInfo.context->drawImage(image.get(), destRect, srcRect, CompositeSource
Over, DoNotRespectImageOrientation, useLowQualityScaling); |
173 } | 173 } |
174 | 174 |
175 void RenderSVGImage::invalidateBufferedForeground() | 175 void RenderSVGImage::invalidateBufferedForeground() |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 | 224 |
225 void RenderSVGImage::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint
&, const RenderLayerModelObject*) | 225 void RenderSVGImage::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint
&, const RenderLayerModelObject*) |
226 { | 226 { |
227 // this is called from paint() after the localTransform has already been app
lied | 227 // this is called from paint() after the localTransform has already been app
lied |
228 IntRect contentRect = enclosingIntRect(repaintRectInLocalCoordinates()); | 228 IntRect contentRect = enclosingIntRect(repaintRectInLocalCoordinates()); |
229 if (!contentRect.isEmpty()) | 229 if (!contentRect.isEmpty()) |
230 rects.append(contentRect); | 230 rects.append(contentRect); |
231 } | 231 } |
232 | 232 |
233 } // namespace WebCore | 233 } // namespace WebCore |
OLD | NEW |