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 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; | 274 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; |
275 fPixelSizeUni = uniformHandler->addUniform(kFragment_GrShaderFlag, | 275 fPixelSizeUni = uniformHandler->addUniform(kFragment_GrShaderFlag, |
276 kFloat_GrSLType, kDefault_GrSLPre
cision, | 276 kFloat_GrSLType, kDefault_GrSLPre
cision, |
277 "PixelSize"); | 277 "PixelSize"); |
278 const char* pixelSizeInc = uniformHandler->getUniformCStr(fPixelSizeUni); | 278 const char* pixelSizeInc = uniformHandler->getUniformCStr(fPixelSizeUni); |
279 fRangeUni = uniformHandler->addUniform(kFragment_GrShaderFlag, | 279 fRangeUni = uniformHandler->addUniform(kFragment_GrShaderFlag, |
280 kVec2f_GrSLType, kDefault_GrSLPrecisi
on, | 280 kVec2f_GrSLType, kDefault_GrSLPrecisi
on, |
281 "Range"); | 281 "Range"); |
282 const char* range = uniformHandler->getUniformCStr(fRangeUni); | 282 const char* range = uniformHandler->getUniformCStr(fRangeUni); |
283 | 283 |
284 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; | 284 GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder; |
285 SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0); | 285 SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0); |
286 const char* func; | 286 const char* func; |
287 switch (me.type()) { | 287 switch (me.type()) { |
288 case GrMorphologyEffect::kErode_MorphologyType: | 288 case GrMorphologyEffect::kErode_MorphologyType: |
289 fragBuilder->codeAppendf("\t\t%s = vec4(1, 1, 1, 1);\n", args.fOutpu
tColor); | 289 fragBuilder->codeAppendf("\t\t%s = vec4(1, 1, 1, 1);\n", args.fOutpu
tColor); |
290 func = "min"; | 290 func = "min"; |
291 break; | 291 break; |
292 case GrMorphologyEffect::kDilate_MorphologyType: | 292 case GrMorphologyEffect::kDilate_MorphologyType: |
293 fragBuilder->codeAppendf("\t\t%s = vec4(0, 0, 0, 0);\n", args.fOutpu
tColor); | 293 fragBuilder->codeAppendf("\t\t%s = vec4(0, 0, 0, 0);\n", args.fOutpu
tColor); |
294 func = "max"; | 294 func = "max"; |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); | 651 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); |
652 } | 652 } |
653 | 653 |
654 bool SkErodeImageFilter::filterImageGPUDeprecated(Proxy* proxy, const SkBitmap&
src, | 654 bool SkErodeImageFilter::filterImageGPUDeprecated(Proxy* proxy, const SkBitmap&
src, |
655 const Context& ctx, | 655 const Context& ctx, |
656 SkBitmap* result, SkIPoint* of
fset) const { | 656 SkBitmap* result, SkIPoint* of
fset) const { |
657 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); | 657 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); |
658 } | 658 } |
659 | 659 |
660 #endif | 660 #endif |
OLD | NEW |