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

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: Update gyp 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
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/GrDefaultXferProcessor.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(GrDefaultXPFactory::Create());
bsalomon 2014/11/26 21:02:45 again, do we need the hasXPFactory if we install o
egdaniel 2014/12/01 18:18:24 gone
56 }
57
51 bool GrPaint::getOpaqueAndKnownColor(GrColor* solidColor, 58 bool GrPaint::getOpaqueAndKnownColor(GrColor* solidColor,
52 uint32_t* solidColorKnownComponents) const { 59 uint32_t* solidColorKnownComponents) const {
53 60
54 // TODO: Share this implementation with GrDrawState 61 // TODO: Share this implementation with GrDrawState
55 62
56 GrProcOptInfo coverageProcInfo; 63 GrProcOptInfo coverageProcInfo;
57 coverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), this->numCov erageStages(), 64 coverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), this->numCov erageStages(),
58 0xFFFFFFFF, kRGBA_GrColorComponentFla gs, true); 65 0xFFFFFFFF, kRGBA_GrColorComponentFla gs, true);
59 66
60 if (!coverageProcInfo.isSolidWhite()) { 67 if (!coverageProcInfo.isSolidWhite()) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 case kIConstA_GrBlendCoeff: 114 case kIConstA_GrBlendCoeff:
108 *solidColorKnownComponents = 0; 115 *solidColorKnownComponents = 0;
109 break; 116 break;
110 } 117 }
111 } else { 118 } else {
112 solidColorKnownComponents = 0; 119 solidColorKnownComponents = 0;
113 } 120 }
114 } 121 }
115 return opaque; 122 return opaque;
116 } 123 }
124
125
joshualitt 2014/11/26 20:10:34 extra newlines
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698