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 "SkGr.h" | 8 #include "SkGr.h" |
9 | 9 |
10 #include "GrCaps.h" | 10 #include "GrCaps.h" |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 SkColorFilter* colorFilter = skPaint.getColorFilter(); | 713 SkColorFilter* colorFilter = skPaint.getColorFilter(); |
714 if (colorFilter) { | 714 if (colorFilter) { |
715 // if the source color is a constant then apply the filter here once rat
her than per pixel | 715 // if the source color is a constant then apply the filter here once rat
her than per pixel |
716 // in a shader. | 716 // in a shader. |
717 if (constantColor) { | 717 if (constantColor) { |
718 SkColor filtered = colorFilter->filterColor(skPaint.getColor()); | 718 SkColor filtered = colorFilter->filterColor(skPaint.getColor()); |
719 grPaint->setColor(SkColor2GrColor(filtered)); | 719 grPaint->setColor(SkColor2GrColor(filtered)); |
720 } else { | 720 } else { |
721 SkTDArray<GrFragmentProcessor*> array; | 721 SkTDArray<GrFragmentProcessor*> array; |
722 // return false if failed? | 722 // return false if failed? |
723 if (colorFilter->asFragmentProcessors(context, &array)) { | 723 if (colorFilter->asFragmentProcessors(context, grPaint->getShaderDat
aManager(), |
| 724 &array)) { |
724 for (int i = 0; i < array.count(); ++i) { | 725 for (int i = 0; i < array.count(); ++i) { |
725 grPaint->addColorProcessor(array[i]); | 726 grPaint->addColorProcessor(array[i]); |
726 array[i]->unref(); | 727 array[i]->unref(); |
727 } | 728 } |
728 } | 729 } |
729 } | 730 } |
730 } | 731 } |
731 | 732 |
732 #ifndef SK_IGNORE_GPU_DITHER | 733 #ifndef SK_IGNORE_GPU_DITHER |
733 // If the dither flag is set, then we need to see if the underlying context | 734 // If the dither flag is set, then we need to see if the underlying context |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 } | 799 } |
799 return SkImageInfo::Make(w, h, ct, at); | 800 return SkImageInfo::Make(w, h, ct, at); |
800 } | 801 } |
801 | 802 |
802 | 803 |
803 void GrWrapTextureInBitmap(GrTexture* src, int w, int h, bool isOpaque, SkBitmap
* dst) { | 804 void GrWrapTextureInBitmap(GrTexture* src, int w, int h, bool isOpaque, SkBitmap
* dst) { |
804 const SkImageInfo info = GrMakeInfoFromTexture(src, w, h, isOpaque); | 805 const SkImageInfo info = GrMakeInfoFromTexture(src, w, h, isOpaque); |
805 dst->setInfo(info); | 806 dst->setInfo(info); |
806 dst->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, src)))->unref(); | 807 dst->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, src)))->unref(); |
807 } | 808 } |
OLD | NEW |