| OLD | NEW |
| 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 "GrBitmapTextContext.h" | 8 #include "GrBitmapTextContext.h" |
| 9 #include "GrAtlas.h" | 9 #include "GrAtlas.h" |
| 10 #include "GrDrawTarget.h" | 10 #include "GrDrawTarget.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 void GrBitmapTextContext::flushGlyphs() { | 61 void GrBitmapTextContext::flushGlyphs() { |
| 62 if (NULL == fDrawTarget) { | 62 if (NULL == fDrawTarget) { |
| 63 return; | 63 return; |
| 64 } | 64 } |
| 65 | 65 |
| 66 GrDrawState* drawState = fDrawTarget->drawState(); | 66 GrDrawState* drawState = fDrawTarget->drawState(); |
| 67 GrDrawState::AutoRestoreEffects are(drawState); | 67 GrDrawState::AutoRestoreEffects are(drawState); |
| 68 drawState->setFromPaint(fPaint, SkMatrix::I(), fContext->getRenderTarget()); | 68 drawState->setFromPaint(fPaint, SkMatrix::I(), fContext->getRenderTarget()); |
| 69 | 69 |
| 70 if (fCurrVertex > 0) { | 70 if (fCurrVertex > 0) { |
| 71 fContext->getFontCache()->updateTextures(); |
| 72 |
| 71 // setup our sampler state for our text texture/atlas | 73 // setup our sampler state for our text texture/atlas |
| 72 SkASSERT(SkIsAlign4(fCurrVertex)); | 74 SkASSERT(SkIsAlign4(fCurrVertex)); |
| 73 SkASSERT(fCurrTexture); | 75 SkASSERT(fCurrTexture); |
| 74 GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kNon
e_FilterMode); | 76 GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kNon
e_FilterMode); |
| 75 | 77 |
| 76 // This effect could be stored with one of the cache objects (atlas?) | 78 // This effect could be stored with one of the cache objects (atlas?) |
| 77 drawState->addCoverageEffect( | 79 drawState->addCoverageEffect( |
| 78 GrCustomCoordsTextureEffect::Create(fCurrTexture
, params), | 80 GrCustomCoordsTextureEffect::Create(fCurrTexture
, params), |
| 79 kGlyphCoordsAttributeIndex)->unref(); | 81 kGlyphCoordsAttributeIndex)->unref(); |
| 80 | 82 |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 | 626 |
| 625 fVertices[2*fCurrVertex].setRectFan(r.fLeft, r.fTop, r.fRight, r.fBottom, | 627 fVertices[2*fCurrVertex].setRectFan(r.fLeft, r.fTop, r.fRight, r.fBottom, |
| 626 2 * sizeof(SkPoint)); | 628 2 * sizeof(SkPoint)); |
| 627 fVertices[2*fCurrVertex+1].setRectFan(SkFixedToFloat(texture->normalizeFixed
X(tx)), | 629 fVertices[2*fCurrVertex+1].setRectFan(SkFixedToFloat(texture->normalizeFixed
X(tx)), |
| 628 SkFixedToFloat(texture->normalizeFixed
Y(ty)), | 630 SkFixedToFloat(texture->normalizeFixed
Y(ty)), |
| 629 SkFixedToFloat(texture->normalizeFixed
X(tx + width)), | 631 SkFixedToFloat(texture->normalizeFixed
X(tx + width)), |
| 630 SkFixedToFloat(texture->normalizeFixed
Y(ty + height)), | 632 SkFixedToFloat(texture->normalizeFixed
Y(ty + height)), |
| 631 2 * sizeof(SkPoint)); | 633 2 * sizeof(SkPoint)); |
| 632 fCurrVertex += 4; | 634 fCurrVertex += 4; |
| 633 } | 635 } |
| OLD | NEW |