diff options
Diffstat (limited to 'src/gpu/effects/GrRectBlurEffect.cpp')
-rw-r--r-- | src/gpu/effects/GrRectBlurEffect.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/gpu/effects/GrRectBlurEffect.cpp b/src/gpu/effects/GrRectBlurEffect.cpp index 219fefa713..d423b786ce 100644 --- a/src/gpu/effects/GrRectBlurEffect.cpp +++ b/src/gpu/effects/GrRectBlurEffect.cpp @@ -46,13 +46,13 @@ public: fProfileSizeVar = args.fUniformHandler->addUniform(kFragment_GrShaderFlag, kHalf_GrSLType, kDefault_GrSLPrecision, "profileSize"); fragBuilder->codeAppendf( - "bool highPrecision = %s;\n@if (highPrecision) {\n float2 translatedPos = " - "sk_FragCoord.xy - %s.xy;\n float width = %s.z - %s.x;\n float height = %s.w " - "- %s.y;\n float2 smallDims = float2(width - float(%s), height - float(%s));\n " - " float center = 2.0 * floor(float(float(%s / 2.0) + 0.25)) - 1.0;\n float2 wh " - "= smallDims - float2(center, center);\n half hcoord = " - "half((abs(translatedPos.x - 0.5 * width) - 0.5 * wh.x) / float(%s));\n half " - "hlookup = texture(%s, float2(float(hcoord), 0.5)).%s.w", + "/* key */ bool highPrecision = %s;\n@if (highPrecision) {\n float2 " + "translatedPos = sk_FragCoord.xy - %s.xy;\n float width = %s.z - %s.x;\n " + "float height = %s.w - %s.y;\n float2 smallDims = float2(width - float(%s), " + "height - float(%s));\n float center = 2.0 * floor(float(float(%s / 2.0) + " + "0.25)) - 1.0;\n float2 wh = smallDims - float2(center, center);\n half " + "hcoord = half((abs(translatedPos.x - 0.5 * width) - 0.5 * wh.x) / float(%s));\n " + " half hlookup = texture(%s, float2(float(hcoord), ", (highPrecision ? "true" : "false"), args.fUniformHandler->getUniformCStr(fRectVar), args.fUniformHandler->getUniformCStr(fRectVar), args.fUniformHandler->getUniformCStr(fRectVar), @@ -62,16 +62,16 @@ public: args.fUniformHandler->getUniformCStr(fProfileSizeVar), args.fUniformHandler->getUniformCStr(fProfileSizeVar), args.fUniformHandler->getUniformCStr(fProfileSizeVar), - fragBuilder->getProgramBuilder()->samplerVariable(args.fTexSamplers[0]).c_str(), - fragBuilder->getProgramBuilder()->samplerSwizzle(args.fTexSamplers[0]).c_str()); + fragBuilder->getProgramBuilder()->samplerVariable(args.fTexSamplers[0]).c_str()); fragBuilder->codeAppendf( - ";\n half vcoord = half((abs(translatedPos.y - 0.5 * height) - 0.5 * wh.y) / " - "float(%s));\n half vlookup = texture(%s, float2(float(vcoord), 0.5)).%s.w;\n " - " %s = (%s * hlookup) * vlookup;\n} else {\n half2 translatedPos = " - "half2(sk_FragCoord.xy - %s.xy);\n half width = half(%s.z - %s.x);\n half " - "height = half(%s.w - %s.y);\n half2 smallDims = half2(width - %s, height - " - "%s);\n half center = half(2.0 * floor(float(float(%s / 2.0) + 0.25)) - 1.0);\n " - " half2 wh = smallDims - half2(float2(floa", + "0.5)).%s.w;\n half vcoord = half((abs(translatedPos.y - 0.5 * height) - 0.5 * " + "wh.y) / float(%s));\n half vlookup = texture(%s, float2(float(vcoord), " + "0.5)).%s.w;\n %s = (%s * hlookup) * vlookup;\n} else {\n half2 " + "translatedPos = half2(sk_FragCoord.xy - %s.xy);\n half width = half(%s.z - " + "%s.x);\n half height = half(%s.w - %s.y);\n half2 smallDims = half2(width - " + "%s, height - %s);\n half center = half(2.0 * floor(float(float(%s / 2.0) + " + "0.25)) - 1.0);\n half2 wh = smallDims - half2(f", + fragBuilder->getProgramBuilder()->samplerSwizzle(args.fTexSamplers[0]).c_str(), args.fUniformHandler->getUniformCStr(fProfileSizeVar), fragBuilder->getProgramBuilder()->samplerVariable(args.fTexSamplers[0]).c_str(), fragBuilder->getProgramBuilder()->samplerSwizzle(args.fTexSamplers[0]).c_str(), @@ -85,7 +85,7 @@ public: args.fUniformHandler->getUniformCStr(fProfileSizeVar), args.fUniformHandler->getUniformCStr(fProfileSizeVar)); fragBuilder->codeAppendf( - "t(center), float(center)));\n half hcoord = " + "loat2(float(center), float(center)));\n half hcoord = " "half((abs(float(float(translatedPos.x) - 0.5 * float(width))) - 0.5 * " "float(wh.x)) / float(%s));\n half hlookup = texture(%s, float2(float(hcoord), " "0.5)).%s.w;\n half vcoord = half((abs(float(float(translatedPos.y) - 0.5 * " |