Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: src/effects/SkLightingImageFilter.cpp

Issue 12547012: Make GrGLEffects use an interface to append their code. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/effects/SkDisplacementMapEffect.cpp ('k') | src/effects/SkMagnifierImageFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 void emitLightColorUniform(GrGLShaderBuilder*); 408 void emitLightColorUniform(GrGLShaderBuilder*);
409 409
410 /** 410 /**
411 * These two functions are called from GrGLLightingEffect's emitCode() funct ion. 411 * These two functions are called from GrGLLightingEffect's emitCode() funct ion.
412 * emitSurfaceToLight places an expression in param out that is the vector f rom the surface to 412 * emitSurfaceToLight places an expression in param out that is the vector f rom the surface to
413 * the light. The expression will be used in the FS. emitLightColor writes a n expression into 413 * the light. The expression will be used in the FS. emitLightColor writes a n expression into
414 * the FS that is the color of the light. Either function may add functions and/or uniforms to 414 * the FS that is the color of the light. Either function may add functions and/or uniforms to
415 * the FS. The default of emitLightColor appends the name of the constant li ght color uniform 415 * the FS. The default of emitLightColor appends the name of the constant li ght color uniform
416 * and so this function only needs to be overridden if the light color varie s spatially. 416 * and so this function only needs to be overridden if the light color varie s spatially.
417 */ 417 */
418 virtual void emitSurfaceToLight(GrGLShaderBuilder*, SkString* out, const cha r* z) = 0; 418 virtual void emitSurfaceToLight(GrGLShaderBuilder*, const char* z) = 0;
419 virtual void emitLightColor(GrGLShaderBuilder*, const char *surfaceToLight); 419 virtual void emitLightColor(GrGLShaderBuilder*, const char *surfaceToLight);
420 420
421 // This is called from GrGLLightingEffect's setData(). Subclasses of GrGLLig ht must call 421 // This is called from GrGLLightingEffect's setData(). Subclasses of GrGLLig ht must call
422 // INHERITED::setData(). 422 // INHERITED::setData().
423 virtual void setData(const GrGLUniformManager&, const SkLight* light) const; 423 virtual void setData(const GrGLUniformManager&, const SkLight* light) const;
424 424
425 protected: 425 protected:
426 /** 426 /**
427 * Gets the constant light color uniform. Subclasses can use this in their e mitLightColor 427 * Gets the constant light color uniform. Subclasses can use this in their e mitLightColor
428 * function. 428 * function.
429 */ 429 */
430 UniformHandle lightColorUni() const { return fColorUni; } 430 UniformHandle lightColorUni() const { return fColorUni; }
431 431
432 private: 432 private:
433 UniformHandle fColorUni; 433 UniformHandle fColorUni;
434 434
435 typedef SkRefCnt INHERITED; 435 typedef SkRefCnt INHERITED;
436 }; 436 };
437 437
438 /////////////////////////////////////////////////////////////////////////////// 438 ///////////////////////////////////////////////////////////////////////////////
439 439
440 class GrGLDistantLight : public GrGLLight { 440 class GrGLDistantLight : public GrGLLight {
441 public: 441 public:
442 virtual ~GrGLDistantLight() {} 442 virtual ~GrGLDistantLight() {}
443 virtual void setData(const GrGLUniformManager&, const SkLight* light) const SK_OVERRIDE; 443 virtual void setData(const GrGLUniformManager&, const SkLight* light) const SK_OVERRIDE;
444 virtual void emitSurfaceToLight(GrGLShaderBuilder*, SkString* out, const ch ar* z) SK_OVERRIDE; 444 virtual void emitSurfaceToLight(GrGLShaderBuilder*, const char* z) SK_OVERRI DE;
445 private: 445 private:
446 typedef GrGLLight INHERITED; 446 typedef GrGLLight INHERITED;
447 UniformHandle fDirectionUni; 447 UniformHandle fDirectionUni;
448 }; 448 };
449 449
450 /////////////////////////////////////////////////////////////////////////////// 450 ///////////////////////////////////////////////////////////////////////////////
451 451
452 class GrGLPointLight : public GrGLLight { 452 class GrGLPointLight : public GrGLLight {
453 public: 453 public:
454 virtual ~GrGLPointLight() {} 454 virtual ~GrGLPointLight() {}
455 virtual void setData(const GrGLUniformManager&, const SkLight* light) const SK_OVERRIDE; 455 virtual void setData(const GrGLUniformManager&, const SkLight* light) const SK_OVERRIDE;
456 virtual void emitSurfaceToLight(GrGLShaderBuilder*, SkString* out, const cha r* z) SK_OVERRIDE; 456 virtual void emitSurfaceToLight(GrGLShaderBuilder*, const char* z) SK_OVERRI DE;
457 private: 457 private:
458 typedef GrGLLight INHERITED; 458 typedef GrGLLight INHERITED;
459 SkPoint3 fLocation; 459 SkPoint3 fLocation;
460 UniformHandle fLocationUni; 460 UniformHandle fLocationUni;
461 }; 461 };
462 462
463 /////////////////////////////////////////////////////////////////////////////// 463 ///////////////////////////////////////////////////////////////////////////////
464 464
465 class GrGLSpotLight : public GrGLLight { 465 class GrGLSpotLight : public GrGLLight {
466 public: 466 public:
467 virtual ~GrGLSpotLight() {} 467 virtual ~GrGLSpotLight() {}
468 virtual void setData(const GrGLUniformManager&, const SkLight* light) const SK_OVERRIDE; 468 virtual void setData(const GrGLUniformManager&, const SkLight* light) const SK_OVERRIDE;
469 virtual void emitSurfaceToLight(GrGLShaderBuilder*, SkString* out, const cha r* z) SK_OVERRIDE; 469 virtual void emitSurfaceToLight(GrGLShaderBuilder*, const char* z) SK_OVERRI DE;
470 virtual void emitLightColor(GrGLShaderBuilder*, const char *surfaceToLight) SK_OVERRIDE; 470 virtual void emitLightColor(GrGLShaderBuilder*, const char *surfaceToLight) SK_OVERRIDE;
471 private: 471 private:
472 typedef GrGLLight INHERITED; 472 typedef GrGLLight INHERITED;
473 473
474 SkString fLightColorFunc; 474 SkString fLightColorFunc;
475 UniformHandle fLocationUni; 475 UniformHandle fLocationUni;
476 UniformHandle fExponentUni; 476 UniformHandle fExponentUni;
477 UniformHandle fCosOuterConeAngleUni; 477 UniformHandle fCosOuterConeAngleUni;
478 UniformHandle fCosInnerConeAngleUni; 478 UniformHandle fCosInnerConeAngleUni;
479 UniformHandle fConeScaleUni; 479 UniformHandle fConeScaleUni;
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 const char* coords; 1115 const char* coords;
1116 fEffectMatrix.emitCodeMakeFSCoords2D(builder, key, vertexCoords, &coords); 1116 fEffectMatrix.emitCodeMakeFSCoords2D(builder, key, vertexCoords, &coords);
1117 1117
1118 fImageIncrementUni = builder->addUniform(GrGLShaderBuilder::kFragment_Shader Type, 1118 fImageIncrementUni = builder->addUniform(GrGLShaderBuilder::kFragment_Shader Type,
1119 kVec2f_GrSLType, 1119 kVec2f_GrSLType,
1120 "ImageIncrement"); 1120 "ImageIncrement");
1121 fSurfaceScaleUni = builder->addUniform(GrGLShaderBuilder::kFragment_ShaderTy pe, 1121 fSurfaceScaleUni = builder->addUniform(GrGLShaderBuilder::kFragment_ShaderTy pe,
1122 kFloat_GrSLType, 1122 kFloat_GrSLType,
1123 "SurfaceScale"); 1123 "SurfaceScale");
1124 fLight->emitLightColorUniform(builder); 1124 fLight->emitLightColorUniform(builder);
1125 SkString* code = &builder->fFSCode;
1126 SkString lightFunc; 1125 SkString lightFunc;
1127 this->emitLightFunc(builder, &lightFunc); 1126 this->emitLightFunc(builder, &lightFunc);
1128 static const GrGLShaderVar gSobelArgs[] = { 1127 static const GrGLShaderVar gSobelArgs[] = {
1129 GrGLShaderVar("a", kFloat_GrSLType), 1128 GrGLShaderVar("a", kFloat_GrSLType),
1130 GrGLShaderVar("b", kFloat_GrSLType), 1129 GrGLShaderVar("b", kFloat_GrSLType),
1131 GrGLShaderVar("c", kFloat_GrSLType), 1130 GrGLShaderVar("c", kFloat_GrSLType),
1132 GrGLShaderVar("d", kFloat_GrSLType), 1131 GrGLShaderVar("d", kFloat_GrSLType),
1133 GrGLShaderVar("e", kFloat_GrSLType), 1132 GrGLShaderVar("e", kFloat_GrSLType),
1134 GrGLShaderVar("f", kFloat_GrSLType), 1133 GrGLShaderVar("f", kFloat_GrSLType),
1135 GrGLShaderVar("scale", kFloat_GrSLType), 1134 GrGLShaderVar("scale", kFloat_GrSLType),
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 sobelFuncName.c_str()); 1168 sobelFuncName.c_str());
1170 SkString interiorNormalName; 1169 SkString interiorNormalName;
1171 builder->emitFunction(GrGLShaderBuilder::kFragment_ShaderType, 1170 builder->emitFunction(GrGLShaderBuilder::kFragment_ShaderType,
1172 kVec3f_GrSLType, 1171 kVec3f_GrSLType,
1173 "interiorNormal", 1172 "interiorNormal",
1174 SK_ARRAY_COUNT(gInteriorNormalArgs), 1173 SK_ARRAY_COUNT(gInteriorNormalArgs),
1175 gInteriorNormalArgs, 1174 gInteriorNormalArgs,
1176 interiorNormalBody.c_str(), 1175 interiorNormalBody.c_str(),
1177 &interiorNormalName); 1176 &interiorNormalName);
1178 1177
1179 code->appendf("\t\tvec2 coord = %s;\n", coords); 1178 builder->fsCodeAppendf("\t\tvec2 coord = %s;\n", coords);
1180 code->appendf("\t\tfloat m[9];\n"); 1179 builder->fsCodeAppend("\t\tfloat m[9];\n");
1181 1180
1182 const char* imgInc = builder->getUniformCStr(fImageIncrementUni); 1181 const char* imgInc = builder->getUniformCStr(fImageIncrementUni);
1183 const char* surfScale = builder->getUniformCStr(fSurfaceScaleUni); 1182 const char* surfScale = builder->getUniformCStr(fSurfaceScaleUni);
1184 1183
1185 int index = 0; 1184 int index = 0;
1186 for (int dy = -1; dy <= 1; dy++) { 1185 for (int dy = -1; dy <= 1; dy++) {
1187 for (int dx = -1; dx <= 1; dx++) { 1186 for (int dx = -1; dx <= 1; dx++) {
1188 SkString texCoords; 1187 SkString texCoords;
1189 texCoords.appendf("coord + vec2(%d, %d) * %s", dx, dy, imgInc); 1188 texCoords.appendf("coord + vec2(%d, %d) * %s", dx, dy, imgInc);
1190 code->appendf("\t\tm[%d] = ", index++); 1189 builder->fsCodeAppendf("\t\tm[%d] = ", index++);
1191 builder->appendTextureLookup(code, samplers[0], texCoords.c_str()); 1190 builder->appendTextureLookup(GrGLShaderBuilder::kFragment_ShaderType ,
1192 code->appendf(".a;\n"); 1191 samplers[0],
1192 texCoords.c_str());
1193 builder->fsCodeAppend(".a;\n");
1193 } 1194 }
1194 } 1195 }
1195 code->appendf("\t\tvec3 surfaceToLight = "); 1196 builder->fsCodeAppend("\t\tvec3 surfaceToLight = ");
1196 SkString arg; 1197 SkString arg;
1197 arg.appendf("%s * m[4]", surfScale); 1198 arg.appendf("%s * m[4]", surfScale);
1198 fLight->emitSurfaceToLight(builder, code, arg.c_str()); 1199 fLight->emitSurfaceToLight(builder, arg.c_str());
1199 code->append(";\n"); 1200 builder->fsCodeAppend(";\n");
1200 code->appendf("\t\t%s = %s(%s(m, %s), surfaceToLight, ", 1201 builder->fsCodeAppendf("\t\t%s = %s(%s(m, %s), surfaceToLight, ",
1201 outputColor, lightFunc.c_str(), interiorNormalName.c_str(), su rfScale); 1202 outputColor, lightFunc.c_str(), interiorNormalName.c_ str(), surfScale);
1202 fLight->emitLightColor(builder, "surfaceToLight"); 1203 fLight->emitLightColor(builder, "surfaceToLight");
1203 code->append(");\n"); 1204 builder->fsCodeAppend(");\n");
1204 GrGLSLMulVarBy4f(code, 2, outputColor, inputColor); 1205 SkString modulate;
1206 GrGLSLMulVarBy4f(&modulate, 2, outputColor, inputColor);
1207 builder->fsCodeAppend(modulate.c_str());
1205 } 1208 }
1206 1209
1207 GrGLEffect::EffectKey GrGLLightingEffect::GenKey(const GrEffectStage& s, 1210 GrGLEffect::EffectKey GrGLLightingEffect::GenKey(const GrEffectStage& s,
1208 const GrGLCaps& caps) { 1211 const GrGLCaps& caps) {
1209 const GrLightingEffect& effect = GetEffectFromStage<GrLightingEffect>(s); 1212 const GrLightingEffect& effect = GetEffectFromStage<GrLightingEffect>(s);
1210 EffectKey key = effect.light()->type(); 1213 EffectKey key = effect.light()->type();
1211 key <<= GrGLEffectMatrix::kKeyBits; 1214 key <<= GrGLEffectMatrix::kKeyBits;
1212 EffectKey matrixKey = GrGLEffectMatrix::GenKey(effect.getMatrix(), 1215 EffectKey matrixKey = GrGLEffectMatrix::GenKey(effect.getMatrix(),
1213 s.getCoordChangeMatrix(), 1216 s.getCoordChangeMatrix(),
1214 effect.texture(0)); 1217 effect.texture(0));
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 } 1350 }
1348 1351
1349 /////////////////////////////////////////////////////////////////////////////// 1352 ///////////////////////////////////////////////////////////////////////////////
1350 void GrGLLight::emitLightColorUniform(GrGLShaderBuilder* builder) { 1353 void GrGLLight::emitLightColorUniform(GrGLShaderBuilder* builder) {
1351 fColorUni = builder->addUniform(GrGLShaderBuilder::kFragment_ShaderType, 1354 fColorUni = builder->addUniform(GrGLShaderBuilder::kFragment_ShaderType,
1352 kVec3f_GrSLType, "LightColor"); 1355 kVec3f_GrSLType, "LightColor");
1353 } 1356 }
1354 1357
1355 void GrGLLight::emitLightColor(GrGLShaderBuilder* builder, 1358 void GrGLLight::emitLightColor(GrGLShaderBuilder* builder,
1356 const char *surfaceToLight) { 1359 const char *surfaceToLight) {
1357 builder->fFSCode.append(builder->getUniformCStr(this->lightColorUni())); 1360 builder->fsCodeAppend(builder->getUniformCStr(this->lightColorUni()));
1358 } 1361 }
1359 1362
1360 void GrGLLight::setData(const GrGLUniformManager& uman, 1363 void GrGLLight::setData(const GrGLUniformManager& uman,
1361 const SkLight* light) const { 1364 const SkLight* light) const {
1362 setUniformPoint3(uman, fColorUni, light->color() * SkScalarInvert(SkIntToSca lar(255))); 1365 setUniformPoint3(uman, fColorUni, light->color() * SkScalarInvert(SkIntToSca lar(255)));
1363 } 1366 }
1364 1367
1365 /////////////////////////////////////////////////////////////////////////////// 1368 ///////////////////////////////////////////////////////////////////////////////
1366 1369
1367 void GrGLDistantLight::setData(const GrGLUniformManager& uman, const SkLight* li ght) const { 1370 void GrGLDistantLight::setData(const GrGLUniformManager& uman, const SkLight* li ght) const {
1368 INHERITED::setData(uman, light); 1371 INHERITED::setData(uman, light);
1369 SkASSERT(light->type() == SkLight::kDistant_LightType); 1372 SkASSERT(light->type() == SkLight::kDistant_LightType);
1370 const SkDistantLight* distantLight = static_cast<const SkDistantLight*>(ligh t); 1373 const SkDistantLight* distantLight = static_cast<const SkDistantLight*>(ligh t);
1371 setUniformNormal3(uman, fDirectionUni, distantLight->direction()); 1374 setUniformNormal3(uman, fDirectionUni, distantLight->direction());
1372 } 1375 }
1373 1376
1374 void GrGLDistantLight::emitSurfaceToLight(GrGLShaderBuilder* builder, 1377 void GrGLDistantLight::emitSurfaceToLight(GrGLShaderBuilder* builder, const char * z) {
1375 SkString* out,
1376 const char* z) {
1377 const char* dir; 1378 const char* dir;
1378 fDirectionUni = builder->addUniform(GrGLShaderBuilder::kFragment_ShaderType, kVec3f_GrSLType, 1379 fDirectionUni = builder->addUniform(GrGLShaderBuilder::kFragment_ShaderType, kVec3f_GrSLType,
1379 "LightDirection", &dir); 1380 "LightDirection", &dir);
1380 out->append(dir); 1381 builder->fsCodeAppend(dir);
1381 } 1382 }
1382 1383
1383 /////////////////////////////////////////////////////////////////////////////// 1384 ///////////////////////////////////////////////////////////////////////////////
1384 1385
1385 void GrGLPointLight::setData(const GrGLUniformManager& uman, 1386 void GrGLPointLight::setData(const GrGLUniformManager& uman,
1386 const SkLight* light) const { 1387 const SkLight* light) const {
1387 INHERITED::setData(uman, light); 1388 INHERITED::setData(uman, light);
1388 SkASSERT(light->type() == SkLight::kPoint_LightType); 1389 SkASSERT(light->type() == SkLight::kPoint_LightType);
1389 const SkPointLight* pointLight = static_cast<const SkPointLight*>(light); 1390 const SkPointLight* pointLight = static_cast<const SkPointLight*>(light);
1390 setUniformPoint3(uman, fLocationUni, pointLight->location()); 1391 setUniformPoint3(uman, fLocationUni, pointLight->location());
1391 } 1392 }
1392 1393
1393 void GrGLPointLight::emitSurfaceToLight(GrGLShaderBuilder* builder, 1394 void GrGLPointLight::emitSurfaceToLight(GrGLShaderBuilder* builder, const char* z) {
1394 SkString* out,
1395 const char* z) {
1396 const char* loc; 1395 const char* loc;
1397 fLocationUni = builder->addUniform(GrGLShaderBuilder::kFragment_ShaderType, kVec3f_GrSLType, 1396 fLocationUni = builder->addUniform(GrGLShaderBuilder::kFragment_ShaderType, kVec3f_GrSLType,
1398 "LightLocation", &loc); 1397 "LightLocation", &loc);
1399 out->appendf("normalize(%s - vec3(%s.xy, %s))", loc, builder->fragmentPositi on(), z); 1398 builder->fsCodeAppendf("normalize(%s - vec3(%s.xy, %s))", loc, builder->frag mentPosition(), z);
1400 } 1399 }
1401 1400
1402 /////////////////////////////////////////////////////////////////////////////// 1401 ///////////////////////////////////////////////////////////////////////////////
1403 1402
1404 void GrGLSpotLight::setData(const GrGLUniformManager& uman, 1403 void GrGLSpotLight::setData(const GrGLUniformManager& uman,
1405 const SkLight* light) const { 1404 const SkLight* light) const {
1406 INHERITED::setData(uman, light); 1405 INHERITED::setData(uman, light);
1407 SkASSERT(light->type() == SkLight::kSpot_LightType); 1406 SkASSERT(light->type() == SkLight::kSpot_LightType);
1408 const SkSpotLight* spotLight = static_cast<const SkSpotLight *>(light); 1407 const SkSpotLight* spotLight = static_cast<const SkSpotLight *>(light);
1409 setUniformPoint3(uman, fLocationUni, spotLight->location()); 1408 setUniformPoint3(uman, fLocationUni, spotLight->location());
1410 uman.set1f(fExponentUni, spotLight->specularExponent()); 1409 uman.set1f(fExponentUni, spotLight->specularExponent());
1411 uman.set1f(fCosInnerConeAngleUni, spotLight->cosInnerConeAngle()); 1410 uman.set1f(fCosInnerConeAngleUni, spotLight->cosInnerConeAngle());
1412 uman.set1f(fCosOuterConeAngleUni, spotLight->cosOuterConeAngle()); 1411 uman.set1f(fCosOuterConeAngleUni, spotLight->cosOuterConeAngle());
1413 uman.set1f(fConeScaleUni, spotLight->coneScale()); 1412 uman.set1f(fConeScaleUni, spotLight->coneScale());
1414 setUniformNormal3(uman, fSUni, spotLight->s()); 1413 setUniformNormal3(uman, fSUni, spotLight->s());
1415 } 1414 }
1416 1415
1417 void GrGLSpotLight::emitSurfaceToLight(GrGLShaderBuilder* builder, 1416 void GrGLSpotLight::emitSurfaceToLight(GrGLShaderBuilder* builder, const char* z ) {
1418 SkString* out,
1419 const char* z) {
1420 const char* location; 1417 const char* location;
1421 fLocationUni = builder->addUniform(GrGLShaderBuilder::kFragment_ShaderType, 1418 fLocationUni = builder->addUniform(GrGLShaderBuilder::kFragment_ShaderType,
1422 kVec3f_GrSLType, "LightLocation", &locati on); 1419 kVec3f_GrSLType, "LightLocation", &locati on);
1423 out->appendf("normalize(%s - vec3(%s.xy, %s))", location, builder->fragmentP osition(), z); 1420 builder->fsCodeAppendf("normalize(%s - vec3(%s.xy, %s))",
1421 location, builder->fragmentPosition(), z);
1424 } 1422 }
1425 1423
1426 void GrGLSpotLight::emitLightColor(GrGLShaderBuilder* builder, 1424 void GrGLSpotLight::emitLightColor(GrGLShaderBuilder* builder,
1427 const char *surfaceToLight) { 1425 const char *surfaceToLight) {
1428 1426
1429 const char* color = builder->getUniformCStr(this->lightColorUni()); // creat ed by parent class. 1427 const char* color = builder->getUniformCStr(this->lightColorUni()); // creat ed by parent class.
1430 1428
1431 const char* exponent; 1429 const char* exponent;
1432 const char* cosInner; 1430 const char* cosInner;
1433 const char* cosOuter; 1431 const char* cosOuter;
(...skipping 25 matching lines...) Expand all
1459 lightColorBody.appendf("\t}\n"); 1457 lightColorBody.appendf("\t}\n");
1460 lightColorBody.appendf("\treturn %s;\n", color); 1458 lightColorBody.appendf("\treturn %s;\n", color);
1461 builder->emitFunction(GrGLShaderBuilder::kFragment_ShaderType, 1459 builder->emitFunction(GrGLShaderBuilder::kFragment_ShaderType,
1462 kVec3f_GrSLType, 1460 kVec3f_GrSLType,
1463 "lightColor", 1461 "lightColor",
1464 SK_ARRAY_COUNT(gLightColorArgs), 1462 SK_ARRAY_COUNT(gLightColorArgs),
1465 gLightColorArgs, 1463 gLightColorArgs,
1466 lightColorBody.c_str(), 1464 lightColorBody.c_str(),
1467 &fLightColorFunc); 1465 &fLightColorFunc);
1468 1466
1469 builder->fFSCode.appendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); 1467 builder->fsCodeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight);
1470 } 1468 }
1471 1469
1472 #endif 1470 #endif
1473 1471
1474 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) 1472 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter)
1475 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) 1473 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter)
1476 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) 1474 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter)
1477 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDistantLight) 1475 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDistantLight)
1478 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPointLight) 1476 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPointLight)
1479 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpotLight) 1477 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpotLight)
1480 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1478 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/effects/SkDisplacementMapEffect.cpp ('k') | src/effects/SkMagnifierImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698