OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 The Android Open Source Project | 2 * Copyright 2011 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkBlurImageFilter.h" | 9 #include "SkBlurImageFilter.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 int kernelSizeX, kernelSizeX3, lowOffsetX, highOffsetX; | 97 int kernelSizeX, kernelSizeX3, lowOffsetX, highOffsetX; |
98 int kernelSizeY, kernelSizeY3, lowOffsetY, highOffsetY; | 98 int kernelSizeY, kernelSizeY3, lowOffsetY, highOffsetY; |
99 getBox3Params(sigma.x(), &kernelSizeX, &kernelSizeX3, &lowOffsetX, &highOffs
etX); | 99 getBox3Params(sigma.x(), &kernelSizeX, &kernelSizeX3, &lowOffsetX, &highOffs
etX); |
100 getBox3Params(sigma.y(), &kernelSizeY, &kernelSizeY3, &lowOffsetY, &highOffs
etY); | 100 getBox3Params(sigma.y(), &kernelSizeY, &kernelSizeY3, &lowOffsetY, &highOffs
etY); |
101 | 101 |
102 if (kernelSizeX < 0 || kernelSizeY < 0) { | 102 if (kernelSizeX < 0 || kernelSizeY < 0) { |
103 return false; | 103 return false; |
104 } | 104 } |
105 | 105 |
106 if (kernelSizeX == 0 && kernelSizeY == 0) { | 106 if (kernelSizeX == 0 && kernelSizeY == 0) { |
107 src.extractSubset(dst, srcBounds); | 107 src.extractSubset(dst, srcBounds.makeOffset(-srcOffset.x(), -srcOffset.y
())); |
108 offset->fX = srcBounds.x(); | 108 offset->fX = srcBounds.x(); |
109 offset->fY = srcBounds.y(); | 109 offset->fY = srcBounds.y(); |
110 return true; | 110 return true; |
111 } | 111 } |
112 | 112 |
113 SkAutoLockPixels alp(src); | 113 SkAutoLockPixels alp(src); |
114 if (!src.getPixels()) { | 114 if (!src.getPixels()) { |
115 return false; | 115 return false; |
116 } | 116 } |
117 | 117 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 srcBounds.offset(srcOffset); | 211 srcBounds.offset(srcOffset); |
212 SkIRect dstBounds; | 212 SkIRect dstBounds; |
213 if (!this->applyCropRect(this->mapContext(ctx), srcBounds, &dstBounds)) { | 213 if (!this->applyCropRect(this->mapContext(ctx), srcBounds, &dstBounds)) { |
214 return false; | 214 return false; |
215 } | 215 } |
216 if (!srcBounds.intersect(dstBounds)) { | 216 if (!srcBounds.intersect(dstBounds)) { |
217 return false; | 217 return false; |
218 } | 218 } |
219 SkVector sigma = map_sigma(fSigma, ctx.ctm()); | 219 SkVector sigma = map_sigma(fSigma, ctx.ctm()); |
220 if (sigma.x() == 0 && sigma.y() == 0) { | 220 if (sigma.x() == 0 && sigma.y() == 0) { |
221 input.extractSubset(result, srcBounds); | 221 input.extractSubset(result, srcBounds.makeOffset(-srcOffset.x(), -srcOff
set.y())); |
222 offset->fX = srcBounds.x(); | 222 offset->fX = srcBounds.x(); |
223 offset->fY = srcBounds.y(); | 223 offset->fY = srcBounds.y(); |
224 return true; | 224 return true; |
225 } | 225 } |
226 offset->fX = dstBounds.fLeft; | 226 offset->fX = dstBounds.fLeft; |
227 offset->fY = dstBounds.fTop; | 227 offset->fY = dstBounds.fTop; |
228 srcBounds.offset(-srcOffset); | 228 srcBounds.offset(-srcOffset); |
229 dstBounds.offset(-srcOffset); | 229 dstBounds.offset(-srcOffset); |
230 SkRect srcBoundsF(SkRect::Make(srcBounds)); | 230 SkRect srcBoundsF(SkRect::Make(srcBounds)); |
231 GrTexture* inputTexture = input.getTexture(); | 231 GrTexture* inputTexture = input.getTexture(); |
(...skipping 20 matching lines...) Expand all Loading... |
252 str->appendf("SkBlurImageFilter: ("); | 252 str->appendf("SkBlurImageFilter: ("); |
253 str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight); | 253 str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight); |
254 | 254 |
255 if (this->getInput(0)) { | 255 if (this->getInput(0)) { |
256 this->getInput(0)->toString(str); | 256 this->getInput(0)->toString(str); |
257 } | 257 } |
258 | 258 |
259 str->append("))"); | 259 str->append("))"); |
260 } | 260 } |
261 #endif | 261 #endif |
OLD | NEW |