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

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

Issue 751283002: Add XferProcessor factory in GrPaint and GrDrawState. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix comiple bug Created 6 years 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/GrOptDrawState.cpp ('k') | src/gpu/GrProcOptInfo.h » ('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 /* 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
11 #include "GrBlend.h" 11 #include "GrBlend.h"
12 #include "GrProcOptInfo.h" 12 #include "GrProcOptInfo.h"
13 #include "effects/GrPorterDuffXferProcessor.h"
13 #include "effects/GrSimpleTextureEffect.h" 14 #include "effects/GrSimpleTextureEffect.h"
14 15
15 void GrPaint::addColorTextureProcessor(GrTexture* texture, const SkMatrix& matri x) { 16 void GrPaint::addColorTextureProcessor(GrTexture* texture, const SkMatrix& matri x) {
16 this->addColorProcessor(GrSimpleTextureEffect::Create(texture, matrix))->unr ef(); 17 this->addColorProcessor(GrSimpleTextureEffect::Create(texture, matrix))->unr ef();
17 } 18 }
18 19
19 void GrPaint::addCoverageTextureProcessor(GrTexture* texture, const SkMatrix& ma trix) { 20 void GrPaint::addCoverageTextureProcessor(GrTexture* texture, const SkMatrix& ma trix) {
20 this->addCoverageProcessor(GrSimpleTextureEffect::Create(texture, matrix))-> unref(); 21 this->addCoverageProcessor(GrSimpleTextureEffect::Create(texture, matrix))-> unref();
21 } 22 }
22 23
(...skipping 18 matching lines...) Expand all
41 uint32_t colorComps = 0; 42 uint32_t colorComps = 0;
42 if (this->getOpaqueAndKnownColor(&tempColor, &colorComps)) { 43 if (this->getOpaqueAndKnownColor(&tempColor, &colorComps)) {
43 if (kRGBA_GrColorComponentFlags == colorComps) { 44 if (kRGBA_GrColorComponentFlags == colorComps) {
44 *color = tempColor; 45 *color = tempColor;
45 return true; 46 return true;
46 } 47 }
47 } 48 }
48 return false; 49 return false;
49 } 50 }
50 51
52 void GrPaint::resetStages() {
53 fColorStages.reset();
54 fCoverageStages.reset();
55 fXPFactory.reset(GrPorterDuffXPFactory::Create(kOne_GrBlendCoeff,
56 kZero_GrBlendCoeff));
57 }
58
51 bool GrPaint::getOpaqueAndKnownColor(GrColor* solidColor, 59 bool GrPaint::getOpaqueAndKnownColor(GrColor* solidColor,
52 uint32_t* solidColorKnownComponents) const { 60 uint32_t* solidColorKnownComponents) const {
53 61
54 // TODO: Share this implementation with GrDrawState 62 // TODO: Share this implementation with GrDrawState
55 63
56 GrProcOptInfo coverageProcInfo; 64 GrProcOptInfo coverageProcInfo;
57 coverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), this->numCov erageStages(), 65 coverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), this->numCov erageStages(),
58 0xFFFFFFFF, kRGBA_GrColorComponentFla gs, true); 66 0xFFFFFFFF, kRGBA_GrColorComponentFla gs, true);
59 67
60 if (!coverageProcInfo.isSolidWhite()) { 68 if (!coverageProcInfo.isSolidWhite()) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 case kIConstA_GrBlendCoeff: 115 case kIConstA_GrBlendCoeff:
108 *solidColorKnownComponents = 0; 116 *solidColorKnownComponents = 0;
109 break; 117 break;
110 } 118 }
111 } else { 119 } else {
112 solidColorKnownComponents = 0; 120 solidColorKnownComponents = 0;
113 } 121 }
114 } 122 }
115 return opaque; 123 return opaque;
116 } 124 }
125
OLDNEW
« no previous file with comments | « src/gpu/GrOptDrawState.cpp ('k') | src/gpu/GrProcOptInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698