| 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 #include "GrTextureMaker.h" | 8 #include "GrTextureMaker.h" |
| 9 | 9 |
| 10 #include "SkGr.h" | 10 #include "SkGr.h" |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 | 696 |
| 697 // Setup the initial color considering the shader, the SkPaint color, and th
e presence or not | 697 // Setup the initial color considering the shader, the SkPaint color, and th
e presence or not |
| 698 // of per-vertex colors. | 698 // of per-vertex colors. |
| 699 SkAutoTUnref<const GrFragmentProcessor> aufp; | 699 SkAutoTUnref<const GrFragmentProcessor> aufp; |
| 700 const GrFragmentProcessor* shaderFP = nullptr; | 700 const GrFragmentProcessor* shaderFP = nullptr; |
| 701 if (!primColorMode || blend_requires_shader(*primColorMode, primitiveIsSrc))
{ | 701 if (!primColorMode || blend_requires_shader(*primColorMode, primitiveIsSrc))
{ |
| 702 if (shaderProcessor) { | 702 if (shaderProcessor) { |
| 703 shaderFP = *shaderProcessor; | 703 shaderFP = *shaderProcessor; |
| 704 } else if (const SkShader* shader = skPaint.getShader()) { | 704 } else if (const SkShader* shader = skPaint.getShader()) { |
| 705 aufp.reset(shader->asFragmentProcessor(context, viewM, nullptr, | 705 aufp.reset(shader->asFragmentProcessor(context, viewM, nullptr, |
| 706 skPaint.getFilterQuality(), | 706 skPaint.getFilterQuality())); |
| 707 grPaint->getProcessorDataMana
ger())); | |
| 708 shaderFP = aufp; | 707 shaderFP = aufp; |
| 709 if (!shaderFP) { | 708 if (!shaderFP) { |
| 710 return false; | 709 return false; |
| 711 } | 710 } |
| 712 } | 711 } |
| 713 } | 712 } |
| 714 | 713 |
| 715 // Set this in below cases if the output of the shader/paint-color/paint-alp
ha/primXfermode is | 714 // Set this in below cases if the output of the shader/paint-color/paint-alp
ha/primXfermode is |
| 716 // a known constant value. In that case we can simply apply a color filter d
uring this | 715 // a known constant value. In that case we can simply apply a color filter d
uring this |
| 717 // conversion without converting the color filter to a GrFragmentProcessor. | 716 // conversion without converting the color filter to a GrFragmentProcessor. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 applyColorFilterToPaintColor = true; | 784 applyColorFilterToPaintColor = true; |
| 786 } | 785 } |
| 787 } | 786 } |
| 788 | 787 |
| 789 SkColorFilter* colorFilter = skPaint.getColorFilter(); | 788 SkColorFilter* colorFilter = skPaint.getColorFilter(); |
| 790 if (colorFilter) { | 789 if (colorFilter) { |
| 791 if (applyColorFilterToPaintColor) { | 790 if (applyColorFilterToPaintColor) { |
| 792 grPaint->setColor(SkColorToPremulGrColor(colorFilter->filterColor(sk
Paint.getColor()))); | 791 grPaint->setColor(SkColorToPremulGrColor(colorFilter->filterColor(sk
Paint.getColor()))); |
| 793 } else { | 792 } else { |
| 794 SkAutoTUnref<const GrFragmentProcessor> cfFP( | 793 SkAutoTUnref<const GrFragmentProcessor> cfFP( |
| 795 colorFilter->asFragmentProcessor(context, grPaint->getProcessorD
ataManager())); | 794 colorFilter->asFragmentProcessor(context)); |
| 796 if (cfFP) { | 795 if (cfFP) { |
| 797 grPaint->addColorFragmentProcessor(cfFP); | 796 grPaint->addColorFragmentProcessor(cfFP); |
| 798 } else { | 797 } else { |
| 799 return false; | 798 return false; |
| 800 } | 799 } |
| 801 } | 800 } |
| 802 } | 801 } |
| 803 | 802 |
| 804 SkXfermode* mode = skPaint.getXfermode(); | 803 SkXfermode* mode = skPaint.getXfermode(); |
| 805 GrXPFactory* xpFactory = nullptr; | 804 GrXPFactory* xpFactory = nullptr; |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 SkBitmap stretchedBmp = stretch_on_cpu(bitmap, stretch); | 973 SkBitmap stretchedBmp = stretch_on_cpu(bitmap, stretch); |
| 975 return create_unstretched_bitmap_texture(ctx, stretchedBmp, GrUniqueKey(
)); | 974 return create_unstretched_bitmap_texture(ctx, stretchedBmp, GrUniqueKey(
)); |
| 976 } else { | 975 } else { |
| 977 SkAutoTUnref<GrTexture> unstretched(this->onRefUnstretchedTexture(ctx)); | 976 SkAutoTUnref<GrTexture> unstretched(this->onRefUnstretchedTexture(ctx)); |
| 978 if (!unstretched) { | 977 if (!unstretched) { |
| 979 return nullptr; | 978 return nullptr; |
| 980 } | 979 } |
| 981 return stretch_texture(unstretched, stretch, nullptr, GrUniqueKey()); | 980 return stretch_texture(unstretched, stretch, nullptr, GrUniqueKey()); |
| 982 } | 981 } |
| 983 } | 982 } |
| OLD | NEW |