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

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

Issue 1131513005: remove localmatrix from GrGeometryProcessor base class (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanup4
Patch Set: tweaks Created 5 years, 7 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/effects/GrBitmapTextGeoProc.h ('k') | src/gpu/effects/GrDashingEffect.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 "GrFontAtlasSizes.h" 9 #include "GrFontAtlasSizes.h"
10 #include "GrInvariantOutput.h" 10 #include "GrInvariantOutput.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 const GrBatchTracker& bt) override { 81 const GrBatchTracker& bt) override {
82 const BitmapTextBatchTracker& local = bt.cast<BitmapTextBatchTracker>(); 82 const BitmapTextBatchTracker& local = bt.cast<BitmapTextBatchTracker>();
83 if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColo r) { 83 if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColo r) {
84 GrGLfloat c[4]; 84 GrGLfloat c[4];
85 GrColorToRGBAFloat(local.fColor, c); 85 GrColorToRGBAFloat(local.fColor, c);
86 pdman.set4fv(fColorUniform, 1, c); 86 pdman.set4fv(fColorUniform, 1, c);
87 fColor = local.fColor; 87 fColor = local.fColor;
88 } 88 }
89 } 89 }
90 90
91 void setTransformData(const GrPrimitiveProcessor& primProc,
92 const GrGLProgramDataManager& pdman,
93 int index,
94 const SkTArray<const GrCoordTransform*, true>& transfo rms) override {
95 this->setTransformDataHelper<GrBitmapTextGeoProc>(primProc, pdman, index , transforms);
96 }
97
91 static inline void GenKey(const GrGeometryProcessor& proc, 98 static inline void GenKey(const GrGeometryProcessor& proc,
92 const GrBatchTracker& bt, 99 const GrBatchTracker& bt,
93 const GrGLSLCaps&, 100 const GrGLSLCaps&,
94 GrProcessorKeyBuilder* b) { 101 GrProcessorKeyBuilder* b) {
95 const BitmapTextBatchTracker& local = bt.cast<BitmapTextBatchTracker>(); 102 const BitmapTextBatchTracker& local = bt.cast<BitmapTextBatchTracker>();
96 // We have to put the optional vertex attribute as part of the key. See the comment 103 // We have to put the optional vertex attribute as part of the key. See the comment
97 // on addVertexAttrib. 104 // on addVertexAttrib.
98 // TODO When we have deferred geometry we can fix this 105 // TODO When we have deferred geometry we can fix this
99 const GrBitmapTextGeoProc& gp = proc.cast<GrBitmapTextGeoProc>(); 106 const GrBitmapTextGeoProc& gp = proc.cast<GrBitmapTextGeoProc>();
100 uint32_t key = 0; 107 uint32_t key = 0;
101 key |= SkToBool(gp.inColor()) ? 0x1 : 0x0; 108 key |= SkToBool(gp.inColor()) ? 0x1 : 0x0;
102 key |= local.fUsesLocalCoords && proc.localMatrix().hasPerspective() ? 0 x2 : 0x0; 109 key |= local.fUsesLocalCoords && gp.localMatrix().hasPerspective() ? 0x2 : 0x0;
103 key |= gp.maskFormat() == kARGB_GrMaskFormat ? 0x4 : 0x0; 110 key |= gp.maskFormat() == kARGB_GrMaskFormat ? 0x4 : 0x0;
104 b->add32(local.fInputColorType << 16 | key); 111 b->add32(local.fInputColorType << 16 | key);
105 } 112 }
106 113
107 private: 114 private:
108 GrColor fColor; 115 GrColor fColor;
109 UniformHandle fColorUniform; 116 UniformHandle fColorUniform;
110 117
111 typedef GrGLGeometryProcessor INHERITED; 118 typedef GrGLGeometryProcessor INHERITED;
112 }; 119 };
113 120
114 /////////////////////////////////////////////////////////////////////////////// 121 ///////////////////////////////////////////////////////////////////////////////
115 122
116 GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, GrTexture* texture, 123 GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, GrTexture* texture,
117 const GrTextureParams& params, GrMaskFo rmat format, 124 const GrTextureParams& params, GrMaskFo rmat format,
118 const SkMatrix& localMatrix) 125 const SkMatrix& localMatrix)
119 : INHERITED(localMatrix) 126 : fColor(color)
120 , fColor(color) 127 , fLocalMatrix(localMatrix)
121 , fTextureAccess(texture, params) 128 , fTextureAccess(texture, params)
122 , fInColor(NULL) 129 , fInColor(NULL)
123 , fMaskFormat(format) { 130 , fMaskFormat(format) {
124 this->initClassID<GrBitmapTextGeoProc>(); 131 this->initClassID<GrBitmapTextGeoProc>();
125 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex AttribType)); 132 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex AttribType));
126 133
127 bool hasVertexColor = kA8_GrMaskFormat == fMaskFormat; 134 bool hasVertexColor = kA8_GrMaskFormat == fMaskFormat;
128 if (hasVertexColor) { 135 if (hasVertexColor) {
129 fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexA ttribType)); 136 fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexA ttribType));
130 } 137 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 format = kA565_GrMaskFormat; 192 format = kA565_GrMaskFormat;
186 break; 193 break;
187 case 2: 194 case 2:
188 format = kARGB_GrMaskFormat; 195 format = kARGB_GrMaskFormat;
189 break; 196 break;
190 } 197 }
191 198
192 return GrBitmapTextGeoProc::Create(GrRandomColor(random), textures[texIdx], params, 199 return GrBitmapTextGeoProc::Create(GrRandomColor(random), textures[texIdx], params,
193 format, GrTest::TestMatrix(random)); 200 format, GrTest::TestMatrix(random));
194 } 201 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrBitmapTextGeoProc.h ('k') | src/gpu/effects/GrDashingEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698