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 "SkLightingImageFilter.h" | 8 #include "SkLightingImageFilter.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1817 texCoords.appendf("coord + vec2(%d, %d) * %s", dx, dy, imgInc); | 1817 texCoords.appendf("coord + vec2(%d, %d) * %s", dx, dy, imgInc); |
1818 SkString temp; | 1818 SkString temp; |
1819 temp.appendf("temp%d", index); | 1819 temp.appendf("temp%d", index); |
1820 fragBuilder->codeAppendf("vec4 %s;", temp.c_str()); | 1820 fragBuilder->codeAppendf("vec4 %s;", temp.c_str()); |
1821 fDomain.sampleTexture(fragBuilder, | 1821 fDomain.sampleTexture(fragBuilder, |
1822 args.fUniformHandler, | 1822 args.fUniformHandler, |
1823 args.fGLSLCaps, | 1823 args.fGLSLCaps, |
1824 le.domain(), | 1824 le.domain(), |
1825 temp.c_str(), | 1825 temp.c_str(), |
1826 texCoords, | 1826 texCoords, |
1827 args.fTexSamplers[0]); | 1827 uniformHandler->getSampler(args.fTexSamplers[0
])); |
1828 fragBuilder->codeAppendf("m[%d] = %s.a;", index, temp.c_str()); | 1828 fragBuilder->codeAppendf("m[%d] = %s.a;", index, temp.c_str()); |
1829 index++; | 1829 index++; |
1830 } | 1830 } |
1831 } | 1831 } |
1832 fragBuilder->codeAppend("\t\tvec3 surfaceToLight = "); | 1832 fragBuilder->codeAppend("\t\tvec3 surfaceToLight = "); |
1833 SkString arg; | 1833 SkString arg; |
1834 arg.appendf("%s * m[4]", surfScale); | 1834 arg.appendf("%s * m[4]", surfScale); |
1835 fLight->emitSurfaceToLight(uniformHandler, fragBuilder, arg.c_str()); | 1835 fLight->emitSurfaceToLight(uniformHandler, fragBuilder, arg.c_str()); |
1836 fragBuilder->codeAppend(";\n"); | 1836 fragBuilder->codeAppend(";\n"); |
1837 fragBuilder->codeAppendf("\t\t%s = %s(%s(m, %s), surfaceToLight, ", | 1837 fragBuilder->codeAppendf("\t\t%s = %s(%s(m, %s), surfaceToLight, ", |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2136 | 2136 |
2137 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 2137 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
2138 } | 2138 } |
2139 | 2139 |
2140 #endif | 2140 #endif |
2141 | 2141 |
2142 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 2142 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
2143 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 2143 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
2144 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 2144 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
2145 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 2145 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |