| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 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 "SkMorphologyImageFilter.h" | 8 #include "SkMorphologyImageFilter.h" |
| 9 | 9 |
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 fragBuilder->codeAppendf("\t\tcoord.%s -= %d.0 * %s; \n", dir, me.radius(),
pixelSizeInc); | 232 fragBuilder->codeAppendf("\t\tcoord.%s -= %d.0 * %s; \n", dir, me.radius(),
pixelSizeInc); |
| 233 if (me.useRange()) { | 233 if (me.useRange()) { |
| 234 // highBound = min(highBound, coord.x + (width-1) * pixelSize); | 234 // highBound = min(highBound, coord.x + (width-1) * pixelSize); |
| 235 fragBuilder->codeAppendf("\t\tfloat highBound = min(%s.y, coord.%s + %f
* %s);", | 235 fragBuilder->codeAppendf("\t\tfloat highBound = min(%s.y, coord.%s + %f
* %s);", |
| 236 range, dir, float(width - 1), pixelSizeInc); | 236 range, dir, float(width - 1), pixelSizeInc); |
| 237 // coord.x = max(lowBound, coord.x); | 237 // coord.x = max(lowBound, coord.x); |
| 238 fragBuilder->codeAppendf("\t\tcoord.%s = max(%s.x, coord.%s);", dir, ran
ge, dir); | 238 fragBuilder->codeAppendf("\t\tcoord.%s = max(%s.x, coord.%s);", dir, ran
ge, dir); |
| 239 } | 239 } |
| 240 fragBuilder->codeAppendf("\t\tfor (int i = 0; i < %d; i++) {\n", width); | 240 fragBuilder->codeAppendf("\t\tfor (int i = 0; i < %d; i++) {\n", width); |
| 241 fragBuilder->codeAppendf("\t\t\t%s = %s(%s, ", args.fOutputColor, func, args
.fOutputColor); | 241 fragBuilder->codeAppendf("\t\t\t%s = %s(%s, ", args.fOutputColor, func, args
.fOutputColor); |
| 242 fragBuilder->appendTextureLookup(args.fTexSamplers[0], "coord"); | 242 fragBuilder->appendTextureLookup(uniformHandler->getSampler(args.fTexSampler
s[0]), "coord"); |
| 243 fragBuilder->codeAppend(");\n"); | 243 fragBuilder->codeAppend(");\n"); |
| 244 // coord.x += pixelSize; | 244 // coord.x += pixelSize; |
| 245 fragBuilder->codeAppendf("\t\t\tcoord.%s += %s;\n", dir, pixelSizeInc); | 245 fragBuilder->codeAppendf("\t\t\tcoord.%s += %s;\n", dir, pixelSizeInc); |
| 246 if (me.useRange()) { | 246 if (me.useRange()) { |
| 247 // coord.x = min(highBound, coord.x); | 247 // coord.x = min(highBound, coord.x); |
| 248 fragBuilder->codeAppendf("\t\t\tcoord.%s = min(highBound, coord.%s);", d
ir, dir); | 248 fragBuilder->codeAppendf("\t\t\tcoord.%s = min(highBound, coord.%s);", d
ir, dir); |
| 249 } | 249 } |
| 250 fragBuilder->codeAppend("\t\t}\n"); | 250 fragBuilder->codeAppend("\t\t}\n"); |
| 251 SkString modulate; | 251 SkString modulate; |
| 252 GrGLSLMulVarBy4f(&modulate, args.fOutputColor, args.fInputColor); | 252 GrGLSLMulVarBy4f(&modulate, args.fOutputColor, args.fInputColor); |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 inputBM.rowBytesAsPixels(), | 618 inputBM.rowBytesAsPixels(), |
| 619 &dst, height, srcBounds); | 619 &dst, height, srcBounds); |
| 620 } | 620 } |
| 621 offset->fX = bounds.left(); | 621 offset->fX = bounds.left(); |
| 622 offset->fY = bounds.top(); | 622 offset->fY = bounds.top(); |
| 623 | 623 |
| 624 return SkSpecialImage::MakeFromRaster(source->internal_getProxy(), | 624 return SkSpecialImage::MakeFromRaster(source->internal_getProxy(), |
| 625 SkIRect::MakeWH(bounds.width(), bounds
.height()), | 625 SkIRect::MakeWH(bounds.width(), bounds
.height()), |
| 626 dst, &source->props()); | 626 dst, &source->props()); |
| 627 } | 627 } |
| OLD | NEW |