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 1785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1796 static const GrGLSLShaderVar gSobelArgs[] = { | 1796 static const GrGLSLShaderVar gSobelArgs[] = { |
1797 GrGLSLShaderVar("a", kFloat_GrSLType), | 1797 GrGLSLShaderVar("a", kFloat_GrSLType), |
1798 GrGLSLShaderVar("b", kFloat_GrSLType), | 1798 GrGLSLShaderVar("b", kFloat_GrSLType), |
1799 GrGLSLShaderVar("c", kFloat_GrSLType), | 1799 GrGLSLShaderVar("c", kFloat_GrSLType), |
1800 GrGLSLShaderVar("d", kFloat_GrSLType), | 1800 GrGLSLShaderVar("d", kFloat_GrSLType), |
1801 GrGLSLShaderVar("e", kFloat_GrSLType), | 1801 GrGLSLShaderVar("e", kFloat_GrSLType), |
1802 GrGLSLShaderVar("f", kFloat_GrSLType), | 1802 GrGLSLShaderVar("f", kFloat_GrSLType), |
1803 GrGLSLShaderVar("scale", kFloat_GrSLType), | 1803 GrGLSLShaderVar("scale", kFloat_GrSLType), |
1804 }; | 1804 }; |
1805 SkString sobelFuncName; | 1805 SkString sobelFuncName; |
1806 SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0); | 1806 SkString coords2D = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]); |
1807 | 1807 |
1808 fragBuilder->emitFunction(kFloat_GrSLType, | 1808 fragBuilder->emitFunction(kFloat_GrSLType, |
1809 "sobel", | 1809 "sobel", |
1810 SK_ARRAY_COUNT(gSobelArgs), | 1810 SK_ARRAY_COUNT(gSobelArgs), |
1811 gSobelArgs, | 1811 gSobelArgs, |
1812 "\treturn (-a + b - 2.0 * c + 2.0 * d -e + f) * sc
ale;\n", | 1812 "\treturn (-a + b - 2.0 * c + 2.0 * d -e + f) * sc
ale;\n", |
1813 &sobelFuncName); | 1813 &sobelFuncName); |
1814 static const GrGLSLShaderVar gPointToNormalArgs[] = { | 1814 static const GrGLSLShaderVar gPointToNormalArgs[] = { |
1815 GrGLSLShaderVar("x", kFloat_GrSLType), | 1815 GrGLSLShaderVar("x", kFloat_GrSLType), |
1816 GrGLSLShaderVar("y", kFloat_GrSLType), | 1816 GrGLSLShaderVar("y", kFloat_GrSLType), |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2171 | 2171 |
2172 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 2172 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
2173 } | 2173 } |
2174 | 2174 |
2175 #endif | 2175 #endif |
2176 | 2176 |
2177 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 2177 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
2178 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 2178 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
2179 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 2179 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
2180 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 2180 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |