| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 | 8 |
| 9 | 9 |
| 10 #include "GrTextContext.h" | 10 #include "GrTextContext.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 182 |
| 183 if (fCurrTexture != texture || fCurrVertex + 4 > fMaxVertices) { | 183 if (fCurrTexture != texture || fCurrVertex + 4 > fMaxVertices) { |
| 184 this->flushGlyphs(); | 184 this->flushGlyphs(); |
| 185 fCurrTexture = texture; | 185 fCurrTexture = texture; |
| 186 fCurrTexture->ref(); | 186 fCurrTexture->ref(); |
| 187 } | 187 } |
| 188 | 188 |
| 189 if (NULL == fVertices) { | 189 if (NULL == fVertices) { |
| 190 // position + texture coord | 190 // position + texture coord |
| 191 static const GrVertexAttrib kVertexAttribs[] = { | 191 static const GrVertexAttrib kVertexAttribs[] = { |
| 192 GrVertexAttrib(kVec2f_GrVertexAttribType, 0), | 192 {kVec2f_GrVertexAttribType, 0}, |
| 193 GrVertexAttrib(kVec2f_GrVertexAttribType, sizeof(GrPoint)) | 193 {kVec2f_GrVertexAttribType, sizeof(GrPoint)} |
| 194 }; | 194 }; |
| 195 static const GrAttribBindings kAttribBindings = GrDrawState::ExplicitTex
CoordAttribBindingsBit(kGlyphMaskStage); | 195 static const GrAttribBindings kAttribBindings = GrDrawState::ExplicitTex
CoordAttribBindingsBit(kGlyphMaskStage); |
| 196 | 196 |
| 197 // If we need to reserve vertices allow the draw target to suggest | 197 // If we need to reserve vertices allow the draw target to suggest |
| 198 // a number of verts to reserve and whether to perform a flush. | 198 // a number of verts to reserve and whether to perform a flush. |
| 199 fMaxVertices = kMinRequestedVerts; | 199 fMaxVertices = kMinRequestedVerts; |
| 200 bool flush = false; | 200 bool flush = false; |
| 201 fDrawTarget = fContext->getTextTarget(fPaint); | 201 fDrawTarget = fContext->getTextTarget(fPaint); |
| 202 if (NULL != fDrawTarget) { | 202 if (NULL != fDrawTarget) { |
| 203 fDrawTarget->drawState()->setVertexAttribs(kVertexAttribs, SK_ARRAY_
COUNT(kVertexAttribs)); | 203 fDrawTarget->drawState()->setVertexAttribs(kVertexAttribs, SK_ARRAY_
COUNT(kVertexAttribs)); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 SkFixedToFloat(vx + width), | 241 SkFixedToFloat(vx + width), |
| 242 SkFixedToFloat(vy + height), | 242 SkFixedToFloat(vy + height), |
| 243 2 * sizeof(SkPoint)); | 243 2 * sizeof(SkPoint)); |
| 244 fVertices[2*fCurrVertex+1].setRectFan(SkFixedToFloat(texture->normalizeFixed
X(tx)), | 244 fVertices[2*fCurrVertex+1].setRectFan(SkFixedToFloat(texture->normalizeFixed
X(tx)), |
| 245 SkFixedToFloat(texture->normalizeFixed
Y(ty)), | 245 SkFixedToFloat(texture->normalizeFixed
Y(ty)), |
| 246 SkFixedToFloat(texture->normalizeFixed
X(tx + width)), | 246 SkFixedToFloat(texture->normalizeFixed
X(tx + width)), |
| 247 SkFixedToFloat(texture->normalizeFixed
Y(ty + height)), | 247 SkFixedToFloat(texture->normalizeFixed
Y(ty + height)), |
| 248 2 * sizeof(SkPoint)); | 248 2 * sizeof(SkPoint)); |
| 249 fCurrVertex += 4; | 249 fCurrVertex += 4; |
| 250 } | 250 } |
| OLD | NEW |