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

Side by Side Diff: Source/core/paint/SVGImagePainter.cpp

Issue 1160643004: Fix cull rect computation for SVG{Container,Image,Shape}Painter outlines (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/paint/SVGImagePainter.h" 6 #include "core/paint/SVGImagePainter.h"
7 7
8 #include "core/layout/ImageQualityController.h" 8 #include "core/layout/ImageQualityController.h"
9 #include "core/layout/LayoutImageResource.h" 9 #include "core/layout/LayoutImageResource.h"
10 #include "core/layout/svg/LayoutSVGImage.h" 10 #include "core/layout/svg/LayoutSVGImage.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 paintContext.paintInfo().context->drawPicture(bufferedForegr ound.get()); 54 paintContext.paintInfo().context->drawPicture(bufferedForegr ound.get());
55 } 55 }
56 } 56 }
57 } 57 }
58 } 58 }
59 59
60 if (m_layoutSVGImage.style()->outlineWidth()) { 60 if (m_layoutSVGImage.style()->outlineWidth()) {
61 PaintInfo outlinePaintInfo(paintInfoBeforeFiltering); 61 PaintInfo outlinePaintInfo(paintInfoBeforeFiltering);
62 outlinePaintInfo.phase = PaintPhaseSelfOutline; 62 outlinePaintInfo.phase = PaintPhaseSelfOutline;
63 LayoutRect layoutBoundingBox(boundingBox); 63 LayoutRect layoutBoundingBox(boundingBox);
64 ObjectPainter(m_layoutSVGImage).paintOutline(outlinePaintInfo, layoutBou ndingBox, layoutBoundingBox); 64 LayoutRect visualOverflowRect = ObjectPainter::outlineBounds(layoutBound ingBox, m_layoutSVGImage.styleRef());
65 ObjectPainter(m_layoutSVGImage).paintOutline(outlinePaintInfo, layoutBou ndingBox, visualOverflowRect);
65 } 66 }
66 } 67 }
67 68
68 void SVGImagePainter::paintForeground(const PaintInfo& paintInfo) 69 void SVGImagePainter::paintForeground(const PaintInfo& paintInfo)
69 { 70 {
70 RefPtr<Image> image = m_layoutSVGImage.imageResource()->image(); 71 RefPtr<Image> image = m_layoutSVGImage.imageResource()->image();
71 FloatRect destRect = m_layoutSVGImage.objectBoundingBox(); 72 FloatRect destRect = m_layoutSVGImage.objectBoundingBox();
72 FloatRect srcRect(0, 0, image->width(), image->height()); 73 FloatRect srcRect(0, 0, image->width(), image->height());
73 74
74 SVGImageElement* imageElement = toSVGImageElement(m_layoutSVGImage.element() ); 75 SVGImageElement* imageElement = toSVGImageElement(m_layoutSVGImage.element() );
75 imageElement->preserveAspectRatio()->currentValue()->transformRect(destRect, srcRect); 76 imageElement->preserveAspectRatio()->currentValue()->transformRect(destRect, srcRect);
76 77
77 InterpolationQuality interpolationQuality = InterpolationDefault; 78 InterpolationQuality interpolationQuality = InterpolationDefault;
78 if (m_layoutSVGImage.style()->svgStyle().bufferedRendering() != BR_STATIC || RuntimeEnabledFeatures::slimmingPaintEnabled()) 79 if (m_layoutSVGImage.style()->svgStyle().bufferedRendering() != BR_STATIC || RuntimeEnabledFeatures::slimmingPaintEnabled())
79 interpolationQuality = ImageQualityController::imageQualityController()- >chooseInterpolationQuality(paintInfo.context, &m_layoutSVGImage, image.get(), i mage.get(), LayoutSize(destRect.size())); 80 interpolationQuality = ImageQualityController::imageQualityController()- >chooseInterpolationQuality(paintInfo.context, &m_layoutSVGImage, image.get(), i mage.get(), LayoutSize(destRect.size()));
80 81
81 InterpolationQuality previousInterpolationQuality = paintInfo.context->image InterpolationQuality(); 82 InterpolationQuality previousInterpolationQuality = paintInfo.context->image InterpolationQuality();
82 paintInfo.context->setImageInterpolationQuality(interpolationQuality); 83 paintInfo.context->setImageInterpolationQuality(interpolationQuality);
83 paintInfo.context->drawImage(image.get(), destRect, srcRect, SkXfermode::kSr cOver_Mode); 84 paintInfo.context->drawImage(image.get(), destRect, srcRect, SkXfermode::kSr cOver_Mode);
84 paintInfo.context->setImageInterpolationQuality(previousInterpolationQuality ); 85 paintInfo.context->setImageInterpolationQuality(previousInterpolationQuality );
85 } 86 }
86 87
87 } // namespace blink 88 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698