| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 RenderSVGModelObject::setNeedsBoundariesUpdate(); | 117 RenderSVGModelObject::setNeedsBoundariesUpdate(); |
| 118 | 118 |
| 119 repainter.repaintAfterLayout(); | 119 repainter.repaintAfterLayout(); |
| 120 setNeedsLayout(false); | 120 setNeedsLayout(false); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void RenderSVGImage::paint(PaintInfo& paintInfo, const LayoutPoint&) | 123 void RenderSVGImage::paint(PaintInfo& paintInfo, const LayoutPoint&) |
| 124 { | 124 { |
| 125 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this); | 125 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this); |
| 126 | 126 |
| 127 if (paintInfo.context->paintingDisabled() || style()->visibility() == HIDDEN
|| !m_imageResource->hasImage()) | 127 if (paintInfo.getContext()->paintingDisabled() || style()->visibility() == H
IDDEN || !m_imageResource->hasImage()) |
| 128 return; | 128 return; |
| 129 | 129 |
| 130 FloatRect boundingBox = repaintRectInLocalCoordinates(); | 130 FloatRect boundingBox = repaintRectInLocalCoordinates(); |
| 131 if (!SVGRenderSupport::paintInfoIntersectsRepaintRect(boundingBox, m_localTr
ansform, paintInfo)) | 131 if (!SVGRenderSupport::paintInfoIntersectsRepaintRect(boundingBox, m_localTr
ansform, paintInfo)) |
| 132 return; | 132 return; |
| 133 | 133 |
| 134 PaintInfo childPaintInfo(paintInfo); | 134 PaintInfo childPaintInfo(paintInfo); |
| 135 bool drawsOutline = style()->outlineWidth() && (childPaintInfo.phase == Pain
tPhaseOutline || childPaintInfo.phase == PaintPhaseSelfOutline); | 135 bool drawsOutline = style()->outlineWidth() && (childPaintInfo.getPhase() ==
PaintPhaseOutline || childPaintInfo.getPhase() == PaintPhaseSelfOutline); |
| 136 if (drawsOutline || childPaintInfo.phase == PaintPhaseForeground) { | 136 if (drawsOutline || childPaintInfo.getPhase() == PaintPhaseForeground) { |
| 137 GraphicsContextStateSaver stateSaver(*childPaintInfo.context); | 137 GraphicsContextStateSaver stateSaver(*(childPaintInfo.getContext())); |
| 138 childPaintInfo.applyTransform(m_localTransform); | 138 childPaintInfo.applyTransform(m_localTransform); |
| 139 | 139 |
| 140 if (childPaintInfo.phase == PaintPhaseForeground) { | 140 if (childPaintInfo.getPhase() == PaintPhaseForeground) { |
| 141 SVGRenderingContext renderingContext(this, childPaintInfo); | 141 SVGRenderingContext renderingContext(this, childPaintInfo); |
| 142 | 142 |
| 143 if (renderingContext.isRenderingPrepared()) { | 143 if (renderingContext.isRenderingPrepared()) { |
| 144 if (style()->svgStyle()->bufferedRendering() == BR_STATIC && re
nderingContext.bufferForeground(m_bufferedForeground)) | 144 if (style()->svgStyle()->bufferedRendering() == BR_STATIC && re
nderingContext.bufferForeground(m_bufferedForeground)) |
| 145 return; | 145 return; |
| 146 | 146 |
| 147 paintForeground(childPaintInfo); | 147 paintForeground(childPaintInfo); |
| 148 } | 148 } |
| 149 } | 149 } |
| 150 | 150 |
| 151 if (drawsOutline) | 151 if (drawsOutline) |
| 152 paintOutline(childPaintInfo, IntRect(boundingBox)); | 152 paintOutline(childPaintInfo, IntRect(boundingBox)); |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 | 155 |
| 156 void RenderSVGImage::paintForeground(PaintInfo& paintInfo) | 156 void RenderSVGImage::paintForeground(PaintInfo& paintInfo) |
| 157 { | 157 { |
| 158 RefPtr<Image> image = m_imageResource->image(); | 158 RefPtr<Image> image = m_imageResource->image(); |
| 159 FloatRect destRect = m_objectBoundingBox; | 159 FloatRect destRect = m_objectBoundingBox; |
| 160 FloatRect srcRect(0, 0, image->width(), image->height()); | 160 FloatRect srcRect(0, 0, image->width(), image->height()); |
| 161 | 161 |
| 162 SVGImageElement* imageElement = toSVGImageElement(node()); | 162 SVGImageElement* imageElement = toSVGImageElement(node()); |
| 163 imageElement->preserveAspectRatioCurrentValue().transformRect(destRect, srcR
ect); | 163 imageElement->preserveAspectRatioCurrentValue().transformRect(destRect, srcR
ect); |
| 164 | 164 |
| 165 bool useLowQualityScaling = false; | 165 bool useLowQualityScaling = false; |
| 166 if (style()->svgStyle()->bufferedRendering() != BR_STATIC) | 166 if (style()->svgStyle()->bufferedRendering() != BR_STATIC) |
| 167 useLowQualityScaling = ImageQualityController::imageQualityController()-
>shouldPaintAtLowQuality(paintInfo.context, this, image.get(), image.get(), Layo
utSize(destRect.size())); | 167 useLowQualityScaling = ImageQualityController::imageQualityController()-
>shouldPaintAtLowQuality(paintInfo.getContext(), this, image.get(), image.get(),
LayoutSize(destRect.size())); |
| 168 | 168 |
| 169 paintInfo.context->drawImage(image.get(), destRect, srcRect, CompositeSource
Over, DoNotRespectImageOrientation, useLowQualityScaling); | 169 paintInfo.getContext()->drawImage(image.get(), destRect, srcRect, CompositeS
ourceOver, DoNotRespectImageOrientation, useLowQualityScaling); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void RenderSVGImage::invalidateBufferedForeground() | 172 void RenderSVGImage::invalidateBufferedForeground() |
| 173 { | 173 { |
| 174 m_bufferedForeground.clear(); | 174 m_bufferedForeground.clear(); |
| 175 } | 175 } |
| 176 | 176 |
| 177 bool RenderSVGImage::nodeAtFloatPoint(const HitTestRequest& request, HitTestResu
lt& result, const FloatPoint& pointInParent, HitTestAction hitTestAction) | 177 bool RenderSVGImage::nodeAtFloatPoint(const HitTestRequest& request, HitTestResu
lt& result, const FloatPoint& pointInParent, HitTestAction hitTestAction) |
| 178 { | 178 { |
| 179 // We only draw in the forground phase, so we only hit-test then. | 179 // We only draw in the forground phase, so we only hit-test then. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 221 |
| 222 void RenderSVGImage::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint
&, const RenderLayerModelObject*) | 222 void RenderSVGImage::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint
&, const RenderLayerModelObject*) |
| 223 { | 223 { |
| 224 // this is called from paint() after the localTransform has already been app
lied | 224 // this is called from paint() after the localTransform has already been app
lied |
| 225 IntRect contentRect = enclosingIntRect(repaintRectInLocalCoordinates()); | 225 IntRect contentRect = enclosingIntRect(repaintRectInLocalCoordinates()); |
| 226 if (!contentRect.isEmpty()) | 226 if (!contentRect.isEmpty()) |
| 227 rects.append(contentRect); | 227 rects.append(contentRect); |
| 228 } | 228 } |
| 229 | 229 |
| 230 } // namespace WebCore | 230 } // namespace WebCore |
| OLD | NEW |