OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
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 "SkArithmeticMode.h" | 8 #include "SkArithmeticMode.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 const char* dstColor; | 372 const char* dstColor; |
373 if (backgroundTex) { | 373 if (backgroundTex) { |
374 fsBuilder->codeAppend("\t\tvec4 bgColor = "); | 374 fsBuilder->codeAppend("\t\tvec4 bgColor = "); |
375 fsBuilder->appendTextureLookup(samplers[0], coords[0].c_str(), coords[0]
.type()); | 375 fsBuilder->appendTextureLookup(samplers[0], coords[0].c_str(), coords[0]
.type()); |
376 fsBuilder->codeAppendf(";\n"); | 376 fsBuilder->codeAppendf(";\n"); |
377 dstColor = "bgColor"; | 377 dstColor = "bgColor"; |
378 } else { | 378 } else { |
379 dstColor = fsBuilder->dstColor(); | 379 dstColor = fsBuilder->dstColor(); |
380 } | 380 } |
381 | 381 |
382 SkASSERT(NULL != dstColor); | 382 SkASSERT(dstColor); |
383 fKUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility, | 383 fKUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility, |
384 kVec4f_GrSLType, "k"); | 384 kVec4f_GrSLType, "k"); |
385 const char* kUni = builder->getUniformCStr(fKUni); | 385 const char* kUni = builder->getUniformCStr(fKUni); |
386 | 386 |
387 // We don't try to optimize for this case at all | 387 // We don't try to optimize for this case at all |
388 if (NULL == inputColor) { | 388 if (NULL == inputColor) { |
389 fsBuilder->codeAppendf("\t\tconst vec4 src = vec4(1);\n"); | 389 fsBuilder->codeAppendf("\t\tconst vec4 src = vec4(1);\n"); |
390 } else { | 390 } else { |
391 fsBuilder->codeAppendf("\t\tvec4 src = %s;\n", inputColor); | 391 fsBuilder->codeAppendf("\t\tvec4 src = %s;\n", inputColor); |
392 if (gUseUnpremul) { | 392 if (gUseUnpremul) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 background); | 449 background); |
450 } | 450 } |
451 return true; | 451 return true; |
452 } | 452 } |
453 | 453 |
454 #endif | 454 #endif |
455 | 455 |
456 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) | 456 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) |
457 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) | 457 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) |
458 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 458 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |