reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 1 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 2 | * Copyright 2010 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 9 | |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 10 | #include "GrTextContext.h" |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 11 | #include "GrAtlas.h" |
| 12 | #include "GrContext.h" |
bsalomon@google.com | f4a9c82 | 2012-03-16 14:02:46 +0000 | [diff] [blame] | 13 | #include "GrDrawTarget.h" |
| 14 | #include "GrFontScaler.h" |
| 15 | #include "GrGpuVertex.h" |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 16 | #include "GrIndexBuffer.h" |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 17 | #include "GrTextStrike.h" |
| 18 | #include "GrTextStrike_impl.h" |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 19 | #include "SkPath.h" |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 20 | |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 21 | enum { |
| 22 | kGlyphMaskStage = GrPaint::kTotalStages, |
| 23 | }; |
| 24 | |
| 25 | void GrTextContext::flushGlyphs() { |
tomhudson@google.com | cb325ce | 2012-07-11 14:41:19 +0000 | [diff] [blame^] | 26 | if (NULL == fDrawTarget) { |
| 27 | return; |
| 28 | } |
| 29 | GrDrawState* drawState = fDrawTarget->drawState(); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 30 | if (fCurrVertex > 0) { |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 31 | // setup our sampler state for our text texture/atlas |
bsalomon@google.com | 6aef1fb | 2011-05-05 12:33:22 +0000 | [diff] [blame] | 32 | GrSamplerState::Filter filter; |
| 33 | if (fExtMatrix.isIdentity()) { |
| 34 | filter = GrSamplerState::kNearest_Filter; |
| 35 | } else { |
| 36 | filter = GrSamplerState::kBilinear_Filter; |
| 37 | } |
bsalomon@google.com | 1e266f8 | 2011-12-12 16:11:33 +0000 | [diff] [blame] | 38 | drawState->sampler(kGlyphMaskStage)->reset( |
| 39 | GrSamplerState::kRepeat_WrapMode,filter); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 40 | |
| 41 | GrAssert(GrIsALIGN4(fCurrVertex)); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 42 | GrAssert(fCurrTexture); |
bsalomon@google.com | 8f9cbd6 | 2011-12-09 15:55:34 +0000 | [diff] [blame] | 43 | drawState->setTexture(kGlyphMaskStage, fCurrTexture); |
bsalomon@google.com | 080773c | 2011-03-15 19:09:25 +0000 | [diff] [blame] | 44 | |
bsalomon@google.com | 669fdc4 | 2011-04-05 17:08:27 +0000 | [diff] [blame] | 45 | if (!GrPixelConfigIsAlphaOnly(fCurrTexture->config())) { |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 46 | if (kOne_GrBlendCoeff != fPaint.fSrcBlendCoeff || |
| 47 | kISA_GrBlendCoeff != fPaint.fDstBlendCoeff || |
| 48 | fPaint.hasTexture()) { |
bsalomon@google.com | 080773c | 2011-03-15 19:09:25 +0000 | [diff] [blame] | 49 | GrPrintf("LCD Text will not draw correctly.\n"); |
| 50 | } |
| 51 | // setup blend so that we get mask * paintColor + (1-mask)*dstColor |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 52 | drawState->setBlendConstant(fPaint.fColor); |
bsalomon@google.com | 4705954 | 2012-06-06 20:51:20 +0000 | [diff] [blame] | 53 | drawState->setBlendFunc(kConstC_GrBlendCoeff, kISC_GrBlendCoeff); |
bsalomon@google.com | 080773c | 2011-03-15 19:09:25 +0000 | [diff] [blame] | 54 | // don't modulate by the paint's color in the frag since we're |
| 55 | // already doing it via the blend const. |
bsalomon@google.com | 8f9cbd6 | 2011-12-09 15:55:34 +0000 | [diff] [blame] | 56 | drawState->setColor(0xffffffff); |
bsalomon@google.com | 080773c | 2011-03-15 19:09:25 +0000 | [diff] [blame] | 57 | } else { |
| 58 | // set back to normal in case we took LCD path previously. |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 59 | drawState->setBlendFunc(fPaint.fSrcBlendCoeff, |
| 60 | fPaint.fDstBlendCoeff); |
| 61 | drawState->setColor(fPaint.fColor); |
bsalomon@google.com | 080773c | 2011-03-15 19:09:25 +0000 | [diff] [blame] | 62 | } |
| 63 | |
bsalomon@google.com | 934c570 | 2012-03-20 21:17:58 +0000 | [diff] [blame] | 64 | int nGlyphs = fCurrVertex / 4; |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 65 | fDrawTarget->setIndexSourceToBuffer(fContext->getQuadIndexBuffer()); |
bsalomon@google.com | 4705954 | 2012-06-06 20:51:20 +0000 | [diff] [blame] | 66 | fDrawTarget->drawIndexedInstances(kTriangles_GrPrimitiveType, |
bsalomon@google.com | 934c570 | 2012-03-20 21:17:58 +0000 | [diff] [blame] | 67 | nGlyphs, |
| 68 | 4, 6); |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 69 | fDrawTarget->resetVertexSource(); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 70 | fVertices = NULL; |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 71 | fMaxVertices = 0; |
| 72 | fCurrVertex = 0; |
| 73 | GrSafeSetNull(fCurrTexture); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 74 | } |
tomhudson@google.com | cb325ce | 2012-07-11 14:41:19 +0000 | [diff] [blame^] | 75 | drawState->disableStages(); |
| 76 | fDrawTarget = NULL; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 77 | } |
| 78 | |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 79 | GrTextContext::GrTextContext(GrContext* context, |
| 80 | const GrPaint& paint, |
| 81 | const GrMatrix* extMatrix) : fPaint(paint) { |
| 82 | fContext = context; |
bsalomon@google.com | f4a9c82 | 2012-03-16 14:02:46 +0000 | [diff] [blame] | 83 | fStrike = NULL; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 84 | |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 85 | fCurrTexture = NULL; |
| 86 | fCurrVertex = 0; |
| 87 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 88 | if (NULL != extMatrix) { |
| 89 | fExtMatrix = *extMatrix; |
| 90 | } else { |
bsalomon@google.com | 022a3e1 | 2012-03-16 15:41:40 +0000 | [diff] [blame] | 91 | fExtMatrix.reset(); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 92 | } |
bsalomon@google.com | 0b50b2e | 2011-03-08 21:07:21 +0000 | [diff] [blame] | 93 | if (context->getClip().hasConservativeBounds()) { |
bsalomon@google.com | d302f14 | 2011-03-03 13:54:13 +0000 | [diff] [blame] | 94 | if (!fExtMatrix.isIdentity()) { |
| 95 | GrMatrix inverse; |
bsalomon@google.com | 0b50b2e | 2011-03-08 21:07:21 +0000 | [diff] [blame] | 96 | GrRect r = context->getClip().getConservativeBounds(); |
bsalomon@google.com | d302f14 | 2011-03-03 13:54:13 +0000 | [diff] [blame] | 97 | if (fExtMatrix.invert(&inverse)) { |
| 98 | inverse.mapRect(&r); |
| 99 | r.roundOut(&fClipRect); |
| 100 | } |
| 101 | } else { |
bsalomon@google.com | 0b50b2e | 2011-03-08 21:07:21 +0000 | [diff] [blame] | 102 | context->getClip().getConservativeBounds().roundOut(&fClipRect); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 103 | } |
bsalomon@google.com | d302f14 | 2011-03-03 13:54:13 +0000 | [diff] [blame] | 104 | } else { |
| 105 | fClipRect.setLargest(); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 106 | } |
| 107 | |
bsalomon@google.com | 7d34d2e | 2011-01-24 17:41:47 +0000 | [diff] [blame] | 108 | // save the context's original matrix off and restore in destructor |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 109 | // this must be done before getTextTarget. |
bsalomon@google.com | 5782d71 | 2011-01-21 21:03:59 +0000 | [diff] [blame] | 110 | fOrigViewMatrix = fContext->getMatrix(); |
| 111 | fContext->setMatrix(fExtMatrix); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 112 | |
bsalomon@google.com | 3914958 | 2011-06-13 21:55:32 +0000 | [diff] [blame] | 113 | /* |
| 114 | We need to call preConcatMatrix with our viewmatrix's inverse, for each |
| 115 | texture and mask in the paint. However, computing the inverse can be |
| 116 | expensive, and its possible we may not have any textures or masks, so these |
| 117 | two loops are written such that we only compute the inverse (once) if we |
| 118 | need it. We do this on our copy of the paint rather than directly on the |
| 119 | draw target because we re-provide the paint to the context when we have |
| 120 | to flush our glyphs or draw a glyph as a path midstream. |
| 121 | */ |
| 122 | bool invVMComputed = false; |
| 123 | GrMatrix invVM; |
| 124 | for (int t = 0; t < GrPaint::kMaxTextures; ++t) { |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 125 | if (fPaint.isTextureStageEnabled(t)) { |
bsalomon@google.com | 3914958 | 2011-06-13 21:55:32 +0000 | [diff] [blame] | 126 | if (invVMComputed || fOrigViewMatrix.invert(&invVM)) { |
| 127 | invVMComputed = true; |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 128 | fPaint.textureSampler(t)->preConcatMatrix(invVM); |
bsalomon@google.com | 3914958 | 2011-06-13 21:55:32 +0000 | [diff] [blame] | 129 | } |
| 130 | } |
| 131 | } |
| 132 | for (int m = 0; m < GrPaint::kMaxMasks; ++m) { |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 133 | if (fPaint.isMaskStageEnabled(m)) { |
bsalomon@google.com | 3914958 | 2011-06-13 21:55:32 +0000 | [diff] [blame] | 134 | if (invVMComputed || fOrigViewMatrix.invert(&invVM)) { |
| 135 | invVMComputed = true; |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 136 | fPaint.maskSampler(m)->preConcatMatrix(invVM); |
bsalomon@google.com | 3914958 | 2011-06-13 21:55:32 +0000 | [diff] [blame] | 137 | } |
| 138 | } |
| 139 | } |
| 140 | |
tomhudson@google.com | cb325ce | 2012-07-11 14:41:19 +0000 | [diff] [blame^] | 141 | fDrawTarget = NULL; |
bsalomon@google.com | 7d34d2e | 2011-01-24 17:41:47 +0000 | [diff] [blame] | 142 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 143 | fVertices = NULL; |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 144 | fMaxVertices = 0; |
bsalomon@google.com | 26c2d0a | 2011-05-17 20:15:30 +0000 | [diff] [blame] | 145 | |
| 146 | fVertexLayout = |
| 147 | GrDrawTarget::kTextFormat_VertexLayoutBit | |
| 148 | GrDrawTarget::StageTexCoordVertexLayoutBit(kGlyphMaskStage, 0); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 149 | } |
| 150 | |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 151 | GrTextContext::~GrTextContext() { |
| 152 | this->flushGlyphs(); |
| 153 | if (fDrawTarget) { |
| 154 | fDrawTarget->drawState()->disableStages(); |
| 155 | } |
bsalomon@google.com | 5782d71 | 2011-01-21 21:03:59 +0000 | [diff] [blame] | 156 | fContext->setMatrix(fOrigViewMatrix); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 157 | } |
| 158 | |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 159 | void GrTextContext::flush() { |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 160 | this->flushGlyphs(); |
| 161 | } |
| 162 | |
| 163 | static inline void setRectFan(GrGpuTextVertex v[4], int l, int t, int r, int b, |
| 164 | int stride) { |
| 165 | v[0 * stride].setI(l, t); |
| 166 | v[1 * stride].setI(l, b); |
| 167 | v[2 * stride].setI(r, b); |
| 168 | v[3 * stride].setI(r, t); |
| 169 | } |
| 170 | |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 171 | void GrTextContext::drawPackedGlyph(GrGlyph::PackedID packed, |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 172 | GrFixed vx, GrFixed vy, |
| 173 | GrFontScaler* scaler) { |
| 174 | if (NULL == fStrike) { |
| 175 | fStrike = fContext->getFontCache()->getStrike(scaler); |
| 176 | } |
| 177 | |
| 178 | GrGlyph* glyph = fStrike->getGlyph(packed, scaler); |
| 179 | if (NULL == glyph || glyph->fBounds.isEmpty()) { |
| 180 | return; |
| 181 | } |
| 182 | |
| 183 | vx += GrIntToFixed(glyph->fBounds.fLeft); |
| 184 | vy += GrIntToFixed(glyph->fBounds.fTop); |
| 185 | |
| 186 | // keep them as ints until we've done the clip-test |
| 187 | GrFixed width = glyph->fBounds.width(); |
| 188 | GrFixed height = glyph->fBounds.height(); |
| 189 | |
| 190 | // check if we clipped out |
| 191 | if (true || NULL == glyph->fAtlas) { |
| 192 | int x = vx >> 16; |
| 193 | int y = vy >> 16; |
| 194 | if (fClipRect.quickReject(x, y, x + width, y + height)) { |
| 195 | // Gr_clz(3); // so we can set a break-point in the debugger |
| 196 | return; |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | if (NULL == glyph->fAtlas) { |
| 201 | if (fStrike->getGlyphAtlas(glyph, scaler)) { |
| 202 | goto HAS_ATLAS; |
| 203 | } |
reed@google.com | 0ebe81a | 2011-04-04 20:06:59 +0000 | [diff] [blame] | 204 | |
| 205 | // before we purge the cache, we must flush any accumulated draws |
| 206 | this->flushGlyphs(); |
bsalomon@google.com | 193395c | 2012-03-30 17:35:12 +0000 | [diff] [blame] | 207 | fContext->flush(); |
reed@google.com | 313e403 | 2010-12-22 22:16:59 +0000 | [diff] [blame] | 208 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 209 | // try to purge |
| 210 | fContext->getFontCache()->purgeExceptFor(fStrike); |
| 211 | if (fStrike->getGlyphAtlas(glyph, scaler)) { |
| 212 | goto HAS_ATLAS; |
| 213 | } |
| 214 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 215 | if (NULL == glyph->fPath) { |
tomhudson@google.com | c377baf | 2012-07-09 20:17:56 +0000 | [diff] [blame] | 216 | SkPath* path = SkNEW(SkPath); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 217 | if (!scaler->getGlyphPath(glyph->glyphID(), path)) { |
| 218 | // flag the glyph as being dead? |
| 219 | delete path; |
| 220 | return; |
| 221 | } |
| 222 | glyph->fPath = path; |
| 223 | } |
reed@google.com | 07f3ee1 | 2011-05-16 17:21:57 +0000 | [diff] [blame] | 224 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 225 | GrPoint translate; |
| 226 | translate.set(GrFixedToScalar(vx - GrIntToFixed(glyph->fBounds.fLeft)), |
| 227 | GrFixedToScalar(vy - GrIntToFixed(glyph->fBounds.fTop))); |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 228 | fContext->drawPath(fPaint, *glyph->fPath, kWinding_GrPathFill, |
bsalomon@google.com | 5782d71 | 2011-01-21 21:03:59 +0000 | [diff] [blame] | 229 | &translate); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 230 | return; |
| 231 | } |
| 232 | |
| 233 | HAS_ATLAS: |
| 234 | GrAssert(glyph->fAtlas); |
| 235 | |
| 236 | // now promote them to fixed |
| 237 | width = GrIntToFixed(width); |
| 238 | height = GrIntToFixed(height); |
| 239 | |
| 240 | GrTexture* texture = glyph->fAtlas->texture(); |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 241 | GrAssert(texture); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 242 | |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 243 | if (fCurrTexture != texture || fCurrVertex + 4 > fMaxVertices) { |
| 244 | this->flushGlyphs(); |
| 245 | fCurrTexture = texture; |
| 246 | fCurrTexture->ref(); |
| 247 | } |
| 248 | |
| 249 | if (NULL == fVertices) { |
| 250 | // If we need to reserve vertices allow the draw target to suggest |
| 251 | // a number of verts to reserve and whether to perform a flush. |
| 252 | fMaxVertices = kMinRequestedVerts; |
tomhudson@google.com | cb325ce | 2012-07-11 14:41:19 +0000 | [diff] [blame^] | 253 | bool flush = (NULL != fDrawTarget) && |
| 254 | fDrawTarget->geometryHints(fVertexLayout, |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 255 | &fMaxVertices, |
| 256 | NULL); |
| 257 | if (flush) { |
| 258 | this->flushGlyphs(); |
| 259 | fContext->flush(); |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 260 | } |
tomhudson@google.com | cb325ce | 2012-07-11 14:41:19 +0000 | [diff] [blame^] | 261 | fDrawTarget = fContext->getTextTarget(fPaint); |
| 262 | fMaxVertices = kDefaultRequestedVerts; |
| 263 | // ignore return, no point in flushing again. |
| 264 | fDrawTarget->geometryHints(fVertexLayout, |
| 265 | &fMaxVertices, |
| 266 | NULL); |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 267 | |
| 268 | int maxQuadVertices = 4 * fContext->getQuadIndexBuffer()->maxQuads(); |
| 269 | if (fMaxVertices < kMinRequestedVerts) { |
| 270 | fMaxVertices = kDefaultRequestedVerts; |
| 271 | } else if (fMaxVertices > maxQuadVertices) { |
| 272 | // don't exceed the limit of the index buffer |
| 273 | fMaxVertices = maxQuadVertices; |
| 274 | } |
| 275 | bool success = fDrawTarget->reserveVertexAndIndexSpace( |
| 276 | fVertexLayout, |
| 277 | fMaxVertices, |
| 278 | 0, |
| 279 | GrTCast<void**>(&fVertices), |
| 280 | NULL); |
| 281 | GrAlwaysAssert(success); |
| 282 | } |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 283 | |
| 284 | GrFixed tx = GrIntToFixed(glyph->fAtlasLocation.fX); |
| 285 | GrFixed ty = GrIntToFixed(glyph->fAtlasLocation.fY); |
| 286 | |
bsalomon@google.com | 2717d56 | 2012-05-07 19:10:52 +0000 | [diff] [blame] | 287 | #if GR_TEXT_SCALAR_IS_USHORT |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 288 | int x = vx >> 16; |
| 289 | int y = vy >> 16; |
| 290 | int w = width >> 16; |
| 291 | int h = height >> 16; |
| 292 | |
| 293 | setRectFan(&fVertices[2*fCurrVertex], x, y, x + w, y + h, 2); |
| 294 | setRectFan(&fVertices[2*fCurrVertex+1], |
| 295 | texture->normalizeFixedX(tx), |
| 296 | texture->normalizeFixedY(ty), |
| 297 | texture->normalizeFixedX(tx + width), |
| 298 | texture->normalizeFixedY(ty + height), |
| 299 | 2); |
| 300 | #else |
| 301 | fVertices[2*fCurrVertex].setXRectFan(vx, vy, vx + width, vy + height, |
| 302 | 2 * sizeof(GrGpuTextVertex)); |
| 303 | fVertices[2*fCurrVertex+1].setXRectFan(texture->normalizeFixedX(tx), |
| 304 | texture->normalizeFixedY(ty), |
| 305 | texture->normalizeFixedX(tx + width), |
| 306 | texture->normalizeFixedY(ty + height), |
| 307 | 2 * sizeof(GrGpuTextVertex)); |
| 308 | #endif |
| 309 | fCurrVertex += 4; |
| 310 | } |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 311 | |