| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 | 8 |
| 9 #include "SkGr.h" | 9 #include "SkGr.h" |
| 10 #include "SkGrPriv.h" | 10 #include "SkGrPriv.h" |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 grPaint->setAllowSRGBInputs(dc->isGammaCorrect()); | 530 grPaint->setAllowSRGBInputs(dc->isGammaCorrect()); |
| 531 | 531 |
| 532 // Raw translation of the SkPaint color to our 4f format: | 532 // Raw translation of the SkPaint color to our 4f format: |
| 533 GrColor4f origColor = GrColor4f::FromGrColor(SkColorToUnpremulGrColor(skPain
t.getColor())); | 533 GrColor4f origColor = GrColor4f::FromGrColor(SkColorToUnpremulGrColor(skPain
t.getColor())); |
| 534 | 534 |
| 535 // Linearize, if the color is meant to be in sRGB gamma: | 535 // Linearize, if the color is meant to be in sRGB gamma: |
| 536 if (dc->isGammaCorrect()) { | 536 if (dc->isGammaCorrect()) { |
| 537 origColor.fRGBA[0] = exact_srgb_to_linear(origColor.fRGBA[0]); | 537 origColor.fRGBA[0] = exact_srgb_to_linear(origColor.fRGBA[0]); |
| 538 origColor.fRGBA[1] = exact_srgb_to_linear(origColor.fRGBA[1]); | 538 origColor.fRGBA[1] = exact_srgb_to_linear(origColor.fRGBA[1]); |
| 539 origColor.fRGBA[2] = exact_srgb_to_linear(origColor.fRGBA[2]); | 539 origColor.fRGBA[2] = exact_srgb_to_linear(origColor.fRGBA[2]); |
| 540 |
| 541 if (dc->getColorXformFromSRGB()) { |
| 542 origColor = dc->getColorXformFromSRGB()->apply(origColor); |
| 543 } |
| 540 } | 544 } |
| 541 | 545 |
| 542 // Setup the initial color considering the shader, the SkPaint color, and th
e presence or not | 546 // Setup the initial color considering the shader, the SkPaint color, and th
e presence or not |
| 543 // of per-vertex colors. | 547 // of per-vertex colors. |
| 544 sk_sp<GrFragmentProcessor> shaderFP; | 548 sk_sp<GrFragmentProcessor> shaderFP; |
| 545 if (!primColorMode || blend_requires_shader(*primColorMode, primitiveIsSrc))
{ | 549 if (!primColorMode || blend_requires_shader(*primColorMode, primitiveIsSrc))
{ |
| 546 if (shaderProcessor) { | 550 if (shaderProcessor) { |
| 547 shaderFP = *shaderProcessor; | 551 shaderFP = *shaderProcessor; |
| 548 } else if (const SkShader* shader = skPaint.getShader()) { | 552 } else if (const SkShader* shader = skPaint.getShader()) { |
| 549 shaderFP = shader->asFragmentProcessor(SkShader::AsFPArgs(context, &
viewM, nullptr, | 553 shaderFP = shader->asFragmentProcessor(SkShader::AsFPArgs(context, &
viewM, nullptr, |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 SkErrorInternals::SetError( kInvalidPaint_SkError, | 774 SkErrorInternals::SetError( kInvalidPaint_SkError, |
| 771 "Sorry, I don't understand the filtering
" | 775 "Sorry, I don't understand the filtering
" |
| 772 "mode you asked for. Falling back to " | 776 "mode you asked for. Falling back to " |
| 773 "MIPMaps."); | 777 "MIPMaps."); |
| 774 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 778 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
| 775 break; | 779 break; |
| 776 | 780 |
| 777 } | 781 } |
| 778 return textureFilterMode; | 782 return textureFilterMode; |
| 779 } | 783 } |
| OLD | NEW |