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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/filters/FEGaussianBlur.cpp

Issue 2329803002: Drop FilterEffect::m_absolutePaintRect (Closed)
Patch Set: Add comment Created 4 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
6 * Copyright (C) 2010 Igalia, S.L. 6 * Copyright (C) 2010 Igalia, S.L.
7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
8 * Copyright (C) 2013 Google Inc. All rights reserved. 8 * Copyright (C) 2013 Google Inc. All rights reserved.
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 { 80 {
81 FloatRect result = rect; 81 FloatRect result = rect;
82 IntSize kernelSize = calculateKernelSize(getFilter(), FloatPoint(m_stdX, m_s tdY)); 82 IntSize kernelSize = calculateKernelSize(getFilter(), FloatPoint(m_stdX, m_s tdY));
83 83
84 // We take the half kernel size and multiply it with three, because we run b ox blur three times. 84 // We take the half kernel size and multiply it with three, because we run b ox blur three times.
85 result.inflateX(3.0f * kernelSize.width() * 0.5f); 85 result.inflateX(3.0f * kernelSize.width() * 0.5f);
86 result.inflateY(3.0f * kernelSize.height() * 0.5f); 86 result.inflateY(3.0f * kernelSize.height() * 0.5f);
87 return result; 87 return result;
88 } 88 }
89 89
90 FloatRect FEGaussianBlur::determineAbsolutePaintRect(const FloatRect& originalRe questedRect) 90 FloatRect FEGaussianBlur::determineAbsolutePaintRect(const FloatRect& originalRe questedRect) const
91 { 91 {
92 FloatRect requestedRect = originalRequestedRect; 92 FloatRect requestedRect = originalRequestedRect;
93 if (clipsToBounds()) 93 if (clipsToBounds())
94 requestedRect.intersect(absoluteBounds()); 94 requestedRect.intersect(absoluteBounds());
95 95
96 FilterEffect* input = inputEffect(0); 96 FilterEffect* input = inputEffect(0);
97 FloatRect inputRect = input->determineAbsolutePaintRect(mapRect(requestedRec t, false)); 97 FloatRect inputRect = input->determineAbsolutePaintRect(mapRect(requestedRec t, false));
98 FloatRect outputRect = mapRect(inputRect, true); 98 FloatRect outputRect = mapRect(inputRect, true);
99 outputRect.intersect(requestedRect); 99 outputRect.intersect(requestedRect);
100 addAbsolutePaintRect(outputRect);
101 100
102 // Blur needs space for both input and output pixels in the paint area. 101 // Blur needs space for both input and output pixels in the paint area.
103 // Input is also clipped to subregion. 102 // Input is also clipped to subregion.
104 if (clipsToBounds()) 103 if (clipsToBounds())
105 inputRect.intersect(absoluteBounds()); 104 inputRect.intersect(absoluteBounds());
106 addAbsolutePaintRect(inputRect);
107 return outputRect; 105 return outputRect;
108 } 106 }
109 107
110 sk_sp<SkImageFilter> FEGaussianBlur::createImageFilter() 108 sk_sp<SkImageFilter> FEGaussianBlur::createImageFilter()
111 { 109 {
112 sk_sp<SkImageFilter> input(SkiaImageFilterBuilder::build(inputEffect(0), ope ratingColorSpace())); 110 sk_sp<SkImageFilter> input(SkiaImageFilterBuilder::build(inputEffect(0), ope ratingColorSpace()));
113 float stdX = getFilter()->applyHorizontalScale(m_stdX); 111 float stdX = getFilter()->applyHorizontalScale(m_stdX);
114 float stdY = getFilter()->applyVerticalScale(m_stdY); 112 float stdY = getFilter()->applyVerticalScale(m_stdY);
115 SkImageFilter::CropRect rect = getCropRect(); 113 SkImageFilter::CropRect rect = getCropRect();
116 return SkBlurImageFilter::Make(SkFloatToScalar(stdX), SkFloatToScalar(stdY), std::move(input), &rect); 114 return SkBlurImageFilter::Make(SkFloatToScalar(stdX), SkFloatToScalar(stdY), std::move(input), &rect);
117 } 115 }
118 116
119 TextStream& FEGaussianBlur::externalRepresentation(TextStream& ts, int indent) c onst 117 TextStream& FEGaussianBlur::externalRepresentation(TextStream& ts, int indent) c onst
120 { 118 {
121 writeIndent(ts, indent); 119 writeIndent(ts, indent);
122 ts << "[feGaussianBlur"; 120 ts << "[feGaussianBlur";
123 FilterEffect::externalRepresentation(ts); 121 FilterEffect::externalRepresentation(ts);
124 ts << " stdDeviation=\"" << m_stdX << ", " << m_stdY << "\"]\n"; 122 ts << " stdDeviation=\"" << m_stdX << ", " << m_stdY << "\"]\n";
125 inputEffect(0)->externalRepresentation(ts, indent + 1); 123 inputEffect(0)->externalRepresentation(ts, indent + 1);
126 return ts; 124 return ts;
127 } 125 }
128 126
129 } // namespace blink 127 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698