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

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

Issue 608253002: Add isSingleComponent bool to getConstantColorComponent (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrPaint.h" 9 #include "GrPaint.h"
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 return false; 47 return false;
48 } 48 }
49 49
50 bool GrPaint::getOpaqueAndKnownColor(GrColor* solidColor, 50 bool GrPaint::getOpaqueAndKnownColor(GrColor* solidColor,
51 uint32_t* solidColorKnownComponents) const { 51 uint32_t* solidColorKnownComponents) const {
52 52
53 // TODO: Share this implementation with GrDrawState 53 // TODO: Share this implementation with GrDrawState
54 54
55 GrColor coverage = GrColorPackRGBA(fCoverage, fCoverage, fCoverage, fCoverag e); 55 GrColor coverage = GrColorPackRGBA(fCoverage, fCoverage, fCoverage, fCoverag e);
56 uint32_t coverageComps = kRGBA_GrColorComponentFlags; 56 uint32_t coverageComps = kRGBA_GrColorComponentFlags;
57 bool isSingleComponent = false;
57 int count = fCoverageStages.count(); 58 int count = fCoverageStages.count();
58 for (int i = 0; i < count; ++i) { 59 for (int i = 0; i < count; ++i) {
59 fCoverageStages[i].getProcessor()->getConstantColorComponents(&coverage, &coverageComps); 60 fCoverageStages[i].getProcessor()->getConstantColorComponents(&coverage, &coverageComps,
61 &isSingleC omponent);
60 } 62 }
61 if (kRGBA_GrColorComponentFlags != coverageComps || 0xffffffff != coverage) { 63 if (kRGBA_GrColorComponentFlags != coverageComps || 0xffffffff != coverage) {
62 return false; 64 return false;
63 } 65 }
64 66
65 GrColor color = fColor; 67 GrColor color = fColor;
66 uint32_t colorComps = kRGBA_GrColorComponentFlags; 68 uint32_t colorComps = kRGBA_GrColorComponentFlags;
69 isSingleComponent = false;
67 count = fColorStages.count(); 70 count = fColorStages.count();
68 for (int i = 0; i < count; ++i) { 71 for (int i = 0; i < count; ++i) {
69 fColorStages[i].getProcessor()->getConstantColorComponents(&color, &colo rComps); 72 fColorStages[i].getProcessor()->getConstantColorComponents(&color, &colo rComps,
73 &isSingleComp onent);
70 } 74 }
71 75
72 SkASSERT((NULL == solidColor) == (NULL == solidColorKnownComponents)); 76 SkASSERT((NULL == solidColor) == (NULL == solidColorKnownComponents));
73 77
74 GrBlendCoeff srcCoeff = fSrcBlendCoeff; 78 GrBlendCoeff srcCoeff = fSrcBlendCoeff;
75 GrBlendCoeff dstCoeff = fDstBlendCoeff; 79 GrBlendCoeff dstCoeff = fDstBlendCoeff;
76 GrSimplifyBlend(&srcCoeff, &dstCoeff, color, colorComps, 0, 0, 0); 80 GrSimplifyBlend(&srcCoeff, &dstCoeff, color, colorComps, 0, 0, 0);
77 81
78 bool opaque = kZero_GrBlendCoeff == dstCoeff && !GrBlendCoeffRefsDst(srcCoef f); 82 bool opaque = kZero_GrBlendCoeff == dstCoeff && !GrBlendCoeffRefsDst(srcCoef f);
79 if (solidColor) { 83 if (solidColor) {
(...skipping 30 matching lines...) Expand all
110 case kIConstA_GrBlendCoeff: 114 case kIConstA_GrBlendCoeff:
111 *solidColorKnownComponents = 0; 115 *solidColorKnownComponents = 0;
112 break; 116 break;
113 } 117 }
114 } else { 118 } else {
115 solidColorKnownComponents = 0; 119 solidColorKnownComponents = 0;
116 } 120 }
117 } 121 }
118 return opaque; 122 return opaque;
119 } 123 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698