OLD | NEW |
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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) |
91 { | 91 { |
92 FloatRect requestedRect = originalRequestedRect; | 92 FloatRect requestedRect = originalRequestedRect; |
93 if (clipsToBounds()) | 93 if (clipsToBounds()) |
94 requestedRect.intersect(maxEffectRect()); | 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); | 100 addAbsolutePaintRect(outputRect); |
101 | 101 |
102 // Blur needs space for both input and output pixels in the paint area. | 102 // Blur needs space for both input and output pixels in the paint area. |
103 // Input is also clipped to subregion. | 103 // Input is also clipped to subregion. |
104 if (clipsToBounds()) | 104 if (clipsToBounds()) |
105 inputRect.intersect(maxEffectRect()); | 105 inputRect.intersect(absoluteBounds()); |
106 addAbsolutePaintRect(inputRect); | 106 addAbsolutePaintRect(inputRect); |
107 return outputRect; | 107 return outputRect; |
108 } | 108 } |
109 | 109 |
110 sk_sp<SkImageFilter> FEGaussianBlur::createImageFilter() | 110 sk_sp<SkImageFilter> FEGaussianBlur::createImageFilter() |
111 { | 111 { |
112 sk_sp<SkImageFilter> input(SkiaImageFilterBuilder::build(inputEffect(0), ope
ratingColorSpace())); | 112 sk_sp<SkImageFilter> input(SkiaImageFilterBuilder::build(inputEffect(0), ope
ratingColorSpace())); |
113 float stdX = getFilter()->applyHorizontalScale(m_stdX); | 113 float stdX = getFilter()->applyHorizontalScale(m_stdX); |
114 float stdY = getFilter()->applyVerticalScale(m_stdY); | 114 float stdY = getFilter()->applyVerticalScale(m_stdY); |
115 SkImageFilter::CropRect rect = getCropRect(); | 115 SkImageFilter::CropRect rect = getCropRect(); |
116 return SkBlurImageFilter::Make(SkFloatToScalar(stdX), SkFloatToScalar(stdY),
std::move(input), &rect); | 116 return SkBlurImageFilter::Make(SkFloatToScalar(stdX), SkFloatToScalar(stdY),
std::move(input), &rect); |
117 } | 117 } |
118 | 118 |
119 TextStream& FEGaussianBlur::externalRepresentation(TextStream& ts, int indent) c
onst | 119 TextStream& FEGaussianBlur::externalRepresentation(TextStream& ts, int indent) c
onst |
120 { | 120 { |
121 writeIndent(ts, indent); | 121 writeIndent(ts, indent); |
122 ts << "[feGaussianBlur"; | 122 ts << "[feGaussianBlur"; |
123 FilterEffect::externalRepresentation(ts); | 123 FilterEffect::externalRepresentation(ts); |
124 ts << " stdDeviation=\"" << m_stdX << ", " << m_stdY << "\"]\n"; | 124 ts << " stdDeviation=\"" << m_stdX << ", " << m_stdY << "\"]\n"; |
125 inputEffect(0)->externalRepresentation(ts, indent + 1); | 125 inputEffect(0)->externalRepresentation(ts, indent + 1); |
126 return ts; | 126 return ts; |
127 } | 127 } |
128 | 128 |
129 } // namespace blink | 129 } // namespace blink |
OLD | NEW |