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 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1447 fsBuilder->codeAppend("\t\tvec3 surfaceToLight = "); | 1447 fsBuilder->codeAppend("\t\tvec3 surfaceToLight = "); |
1448 SkString arg; | 1448 SkString arg; |
1449 arg.appendf("%s * m[4]", surfScale); | 1449 arg.appendf("%s * m[4]", surfScale); |
1450 fLight->emitSurfaceToLight(builder, arg.c_str()); | 1450 fLight->emitSurfaceToLight(builder, arg.c_str()); |
1451 fsBuilder->codeAppend(";\n"); | 1451 fsBuilder->codeAppend(";\n"); |
1452 fsBuilder->codeAppendf("\t\t%s = %s(%s(m, %s), surfaceToLight, ", | 1452 fsBuilder->codeAppendf("\t\t%s = %s(%s(m, %s), surfaceToLight, ", |
1453 outputColor, lightFunc.c_str(), interiorNormalName.c_
str(), surfScale); | 1453 outputColor, lightFunc.c_str(), interiorNormalName.c_
str(), surfScale); |
1454 fLight->emitLightColor(builder, "surfaceToLight"); | 1454 fLight->emitLightColor(builder, "surfaceToLight"); |
1455 fsBuilder->codeAppend(");\n"); | 1455 fsBuilder->codeAppend(");\n"); |
1456 SkString modulate; | 1456 SkString modulate; |
1457 GrGLSLMulVarBy4f(&modulate, 2, outputColor, inputColor); | 1457 GrGLSLMulVarBy4f(&modulate, outputColor, inputColor); |
1458 fsBuilder->codeAppend(modulate.c_str()); | 1458 fsBuilder->codeAppend(modulate.c_str()); |
1459 } | 1459 } |
1460 | 1460 |
1461 void GrGLLightingEffect::GenKey(const GrProcessor& proc, | 1461 void GrGLLightingEffect::GenKey(const GrProcessor& proc, |
1462 const GrGLCaps& caps, GrProcessorKeyBuilder* b)
{ | 1462 const GrGLCaps& caps, GrProcessorKeyBuilder* b)
{ |
1463 b->add32(proc.cast<GrLightingEffect>().light()->type()); | 1463 b->add32(proc.cast<GrLightingEffect>().light()->type()); |
1464 } | 1464 } |
1465 | 1465 |
1466 void GrGLLightingEffect::setData(const GrGLProgramDataManager& pdman, | 1466 void GrGLLightingEffect::setData(const GrGLProgramDataManager& pdman, |
1467 const GrProcessor& proc) { | 1467 const GrProcessor& proc) { |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1719 | 1719 |
1720 fsBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 1720 fsBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
1721 } | 1721 } |
1722 | 1722 |
1723 #endif | 1723 #endif |
1724 | 1724 |
1725 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 1725 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
1726 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 1726 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
1727 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 1727 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
1728 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1728 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |