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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 const TextureSamplerArray& samplers) { | 384 const TextureSamplerArray& samplers) { |
385 fPixelSizeUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility
, | 385 fPixelSizeUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility
, |
386 kFloat_GrSLType, kDefault_GrSLPrecis
ion, | 386 kFloat_GrSLType, kDefault_GrSLPrecis
ion, |
387 "PixelSize"); | 387 "PixelSize"); |
388 const char* pixelSizeInc = builder->getUniformCStr(fPixelSizeUni); | 388 const char* pixelSizeInc = builder->getUniformCStr(fPixelSizeUni); |
389 fRangeUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility, | 389 fRangeUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility, |
390 kVec2f_GrSLType, kDefault_GrSLPrecis
ion, | 390 kVec2f_GrSLType, kDefault_GrSLPrecis
ion, |
391 "Range"); | 391 "Range"); |
392 const char* range = builder->getUniformCStr(fRangeUni); | 392 const char* range = builder->getUniformCStr(fRangeUni); |
393 | 393 |
394 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); | 394 GrGLFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); |
395 SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0); | 395 SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0); |
396 const char* func; | 396 const char* func; |
397 switch (fType) { | 397 switch (fType) { |
398 case GrMorphologyEffect::kErode_MorphologyType: | 398 case GrMorphologyEffect::kErode_MorphologyType: |
399 fsBuilder->codeAppendf("\t\t%s = vec4(1, 1, 1, 1);\n", outputColor); | 399 fsBuilder->codeAppendf("\t\t%s = vec4(1, 1, 1, 1);\n", outputColor); |
400 func = "min"; | 400 func = "min"; |
401 break; | 401 break; |
402 case GrMorphologyEffect::kDilate_MorphologyType: | 402 case GrMorphologyEffect::kDilate_MorphologyType: |
403 fsBuilder->codeAppendf("\t\t%s = vec4(0, 0, 0, 0);\n", outputColor); | 403 fsBuilder->codeAppendf("\t\t%s = vec4(0, 0, 0, 0);\n", outputColor); |
404 func = "max"; | 404 func = "max"; |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 SkBitmap* result, SkIPoint* offset) con
st { | 747 SkBitmap* result, SkIPoint* offset) con
st { |
748 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); | 748 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); |
749 } | 749 } |
750 | 750 |
751 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, | 751 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, |
752 SkBitmap* result, SkIPoint* offset) cons
t { | 752 SkBitmap* result, SkIPoint* offset) cons
t { |
753 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); | 753 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); |
754 } | 754 } |
755 | 755 |
756 #endif | 756 #endif |
OLD | NEW |