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

Side by Side Diff: src/gpu/effects/GrBitmapTextGeoProc.cpp

Issue 791743003: Remove GP from drawstate, revision of invariant output for GP (Closed) Base URL: https://skia.googlesource.com/skia.git@color-to-gp
Patch Set: more windows fix 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/effects/GrBitmapTextGeoProc.h ('k') | src/gpu/effects/GrConvexPolyEffect.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 2013 Google Inc. 2 * Copyright 2013 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 "GrBitmapTextGeoProc.h" 8 #include "GrBitmapTextGeoProc.h"
9 #include "GrInvariantOutput.h" 9 #include "GrInvariantOutput.h"
10 #include "GrTexture.h" 10 #include "GrTexture.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 59 }
60 60
61 61
62 private: 62 private:
63 typedef GrGLGeometryProcessor INHERITED; 63 typedef GrGLGeometryProcessor INHERITED;
64 }; 64 };
65 65
66 /////////////////////////////////////////////////////////////////////////////// 66 ///////////////////////////////////////////////////////////////////////////////
67 67
68 GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, GrTexture* texture, 68 GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, GrTexture* texture,
69 const GrTextureParams& params, bool use ColorAttrib) 69 const GrTextureParams& params, bool use ColorAttrib,
70 : INHERITED(color), fTextureAccess(texture, params), fInColor(NULL) { 70 bool opaqueVertexColors)
71 : INHERITED(color, opaqueVertexColors), fTextureAccess(texture, params), fIn Color(NULL) {
71 this->initClassID<GrBitmapTextGeoProc>(); 72 this->initClassID<GrBitmapTextGeoProc>();
72 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVert exAttribType)); 73 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVert exAttribType));
73 if (useColorAttrib) { 74 if (useColorAttrib) {
74 fInColor = &this->addVertexAttrib(GrAttribute("inColor", kVec4ub_GrVerte xAttribType)); 75 fInColor = &this->addVertexAttrib(GrAttribute("inColor", kVec4ub_GrVerte xAttribType));
75 this->setHasVertexColor(); 76 this->setHasVertexColor();
76 } 77 }
77 fInTextureCoords = &this->addVertexAttrib(GrAttribute("inTextureCoords", 78 fInTextureCoords = &this->addVertexAttrib(GrAttribute("inTextureCoords",
78 kVec2f_GrVertexAttribT ype)); 79 kVec2f_GrVertexAttribT ype));
79 this->addTextureAccess(&fTextureAccess); 80 this->addTextureAccess(&fTextureAccess);
80 } 81 }
81 82
82 bool GrBitmapTextGeoProc::onIsEqual(const GrGeometryProcessor& other) const { 83 bool GrBitmapTextGeoProc::onIsEqual(const GrGeometryProcessor& other) const {
83 const GrBitmapTextGeoProc& gp = other.cast<GrBitmapTextGeoProc>(); 84 const GrBitmapTextGeoProc& gp = other.cast<GrBitmapTextGeoProc>();
84 return SkToBool(this->inColor()) == SkToBool(gp.inColor()); 85 return SkToBool(this->inColor()) == SkToBool(gp.inColor());
85 } 86 }
86 87
87 void GrBitmapTextGeoProc::onComputeInvariantOutput(GrInvariantOutput* inout) con st { 88 void GrBitmapTextGeoProc::onGetInvariantOutputCoverage(GrInitInvariantOutput* ou t) const {
88 if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) { 89 if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) {
89 inout->mulByUnknownAlpha(); 90 out->setUnknownSingleComponent();
90 } else if (GrPixelConfigIsOpaque(this->texture(0)->config())) { 91 } else if (GrPixelConfigIsOpaque(this->texture(0)->config())) {
91 inout->mulByUnknownOpaqueColor(); 92 out->setUnknownOpaqueFourComponents();
92 inout->setUsingLCDCoverage(); 93 out->setUsingLCDCoverage();
93 } else { 94 } else {
94 inout->mulByUnknownColor(); 95 out->setUnknownFourComponents();
95 inout->setUsingLCDCoverage(); 96 out->setUsingLCDCoverage();
96 } 97 }
97 } 98 }
98 99
99 void GrBitmapTextGeoProc::getGLProcessorKey(const GrBatchTracker& bt, 100 void GrBitmapTextGeoProc::getGLProcessorKey(const GrBatchTracker& bt,
100 const GrGLCaps& caps, 101 const GrGLCaps& caps,
101 GrProcessorKeyBuilder* b) const { 102 GrProcessorKeyBuilder* b) const {
102 GrGLBitmapTextGeoProc::GenKey(*this, bt, caps, b); 103 GrGLBitmapTextGeoProc::GenKey(*this, bt, caps, b);
103 } 104 }
104 105
105 GrGLGeometryProcessor* 106 GrGLGeometryProcessor*
(...skipping 16 matching lines...) Expand all
122 SkShader::kMirror_TileMode, 123 SkShader::kMirror_TileMode,
123 }; 124 };
124 SkShader::TileMode tileModes[] = { 125 SkShader::TileMode tileModes[] = {
125 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], 126 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))],
126 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], 127 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))],
127 }; 128 };
128 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil erp_FilterMode : 129 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil erp_FilterMode :
129 GrTextureParams::kNon e_FilterMode); 130 GrTextureParams::kNon e_FilterMode);
130 131
131 return GrBitmapTextGeoProc::Create(GrRandomColor(random), textures[texIdx], params, 132 return GrBitmapTextGeoProc::Create(GrRandomColor(random), textures[texIdx], params,
132 random->nextBool()); 133 random->nextBool(), random->nextBool());
133 } 134 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrBitmapTextGeoProc.h ('k') | src/gpu/effects/GrConvexPolyEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698