| 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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 const char* imgInc = builder->getUniformCStr(fImageIncrementUni); | 392 const char* imgInc = builder->getUniformCStr(fImageIncrementUni); |
| 393 | 393 |
| 394 fsBuilder->codeAppendf("\t\tvec2 coord = %s - %d.0 * %s;\n", coords2D.c_str(
), fRadius, imgInc); | 394 fsBuilder->codeAppendf("\t\tvec2 coord = %s - %d.0 * %s;\n", coords2D.c_str(
), fRadius, imgInc); |
| 395 fsBuilder->codeAppendf("\t\tfor (int i = 0; i < %d; i++) {\n", this->width()
); | 395 fsBuilder->codeAppendf("\t\tfor (int i = 0; i < %d; i++) {\n", this->width()
); |
| 396 fsBuilder->codeAppendf("\t\t\t%s = %s(%s, ", outputColor, func, outputColor)
; | 396 fsBuilder->codeAppendf("\t\t\t%s = %s(%s, ", outputColor, func, outputColor)
; |
| 397 fsBuilder->appendTextureLookup(samplers[0], "coord"); | 397 fsBuilder->appendTextureLookup(samplers[0], "coord"); |
| 398 fsBuilder->codeAppend(");\n"); | 398 fsBuilder->codeAppend(");\n"); |
| 399 fsBuilder->codeAppendf("\t\t\tcoord += %s;\n", imgInc); | 399 fsBuilder->codeAppendf("\t\t\tcoord += %s;\n", imgInc); |
| 400 fsBuilder->codeAppend("\t\t}\n"); | 400 fsBuilder->codeAppend("\t\t}\n"); |
| 401 SkString modulate; | 401 SkString modulate; |
| 402 GrGLSLMulVarBy4f(&modulate, 2, outputColor, inputColor); | 402 GrGLSLMulVarBy4f(&modulate, outputColor, inputColor); |
| 403 fsBuilder->codeAppend(modulate.c_str()); | 403 fsBuilder->codeAppend(modulate.c_str()); |
| 404 } | 404 } |
| 405 | 405 |
| 406 void GrGLMorphologyEffect::GenKey(const GrProcessor& proc, | 406 void GrGLMorphologyEffect::GenKey(const GrProcessor& proc, |
| 407 const GrGLCaps&, GrProcessorKeyBuilder* b) { | 407 const GrGLCaps&, GrProcessorKeyBuilder* b) { |
| 408 const GrMorphologyEffect& m = proc.cast<GrMorphologyEffect>(); | 408 const GrMorphologyEffect& m = proc.cast<GrMorphologyEffect>(); |
| 409 uint32_t key = static_cast<uint32_t>(m.radius()); | 409 uint32_t key = static_cast<uint32_t>(m.radius()); |
| 410 key |= (m.type() << 8); | 410 key |= (m.type() << 8); |
| 411 b->add32(key); | 411 b->add32(key); |
| 412 } | 412 } |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 SkBitmap* result, SkIPoint* offset) con
st { | 604 SkBitmap* result, SkIPoint* offset) con
st { |
| 605 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); | 605 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); |
| 606 } | 606 } |
| 607 | 607 |
| 608 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, | 608 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, |
| 609 SkBitmap* result, SkIPoint* offset) cons
t { | 609 SkBitmap* result, SkIPoint* offset) cons
t { |
| 610 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); | 610 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); |
| 611 } | 611 } |
| 612 | 612 |
| 613 #endif | 613 #endif |
| OLD | NEW |