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

Side by Side Diff: src/gpu/SkGr.cpp

Issue 1368423003: Use child processors to implement compose color filter. (Closed) Base URL: https://skia.googlesource.com/skia.git@upm
Patch Set: Address comments Created 5 years, 2 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
« no previous file with comments | « src/gpu/GrProcOptInfo.h ('k') | tests/GpuColorFilterTest.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 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 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 grPaint->setColor(SkColorToPremulGrColor(skPaint.getColor())); 805 grPaint->setColor(SkColorToPremulGrColor(skPaint.getColor()));
806 applyColorFilterToPaintColor = true; 806 applyColorFilterToPaintColor = true;
807 } 807 }
808 } 808 }
809 809
810 SkColorFilter* colorFilter = skPaint.getColorFilter(); 810 SkColorFilter* colorFilter = skPaint.getColorFilter();
811 if (colorFilter) { 811 if (colorFilter) {
812 if (applyColorFilterToPaintColor) { 812 if (applyColorFilterToPaintColor) {
813 grPaint->setColor(SkColorToPremulGrColor(colorFilter->filterColor(sk Paint.getColor()))); 813 grPaint->setColor(SkColorToPremulGrColor(colorFilter->filterColor(sk Paint.getColor())));
814 } else { 814 } else {
815 SkTDArray<const GrFragmentProcessor*> array; 815 SkAutoTUnref<const GrFragmentProcessor> cfFP(
816 if (colorFilter->asFragmentProcessors(context, grPaint->getProcessor DataManager(), 816 colorFilter->asFragmentProcessor(context, grPaint->getProcessorD ataManager()));
817 &array)) { 817 if (cfFP) {
818 for (int i = 0; i < array.count(); ++i) { 818 grPaint->addColorFragmentProcessor(cfFP);
819 grPaint->addColorFragmentProcessor(array[i])->unref();
820 }
821 } else { 819 } else {
822 return false; 820 return false;
823 } 821 }
824 } 822 }
825 } 823 }
826 824
827 SkXfermode* mode = skPaint.getXfermode(); 825 SkXfermode* mode = skPaint.getXfermode();
828 GrXPFactory* xpFactory = nullptr; 826 GrXPFactory* xpFactory = nullptr;
829 if (!SkXfermode::AsXPFactory(mode, &xpFactory)) { 827 if (!SkXfermode::AsXPFactory(mode, &xpFactory)) {
830 // Fall back to src-over 828 // Fall back to src-over
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 SkErrorInternals::SetError( kInvalidPaint_SkError, 939 SkErrorInternals::SetError( kInvalidPaint_SkError,
942 "Sorry, I don't understand the filtering " 940 "Sorry, I don't understand the filtering "
943 "mode you asked for. Falling back to " 941 "mode you asked for. Falling back to "
944 "MIPMaps."); 942 "MIPMaps.");
945 textureFilterMode = GrTextureParams::kMipMap_FilterMode; 943 textureFilterMode = GrTextureParams::kMipMap_FilterMode;
946 break; 944 break;
947 945
948 } 946 }
949 return textureFilterMode; 947 return textureFilterMode;
950 } 948 }
OLDNEW
« no previous file with comments | « src/gpu/GrProcOptInfo.h ('k') | tests/GpuColorFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698