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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 void GrBitmapTextContext::flushGlyphs() { | 81 void GrBitmapTextContext::flushGlyphs() { |
82 if (NULL == fDrawTarget) { | 82 if (NULL == fDrawTarget) { |
83 return; | 83 return; |
84 } | 84 } |
85 | 85 |
86 GrDrawState* drawState = fDrawTarget->drawState(); | 86 GrDrawState* drawState = fDrawTarget->drawState(); |
87 GrDrawState::AutoRestoreEffects are(drawState); | 87 GrDrawState::AutoRestoreEffects are(drawState); |
88 drawState->setFromPaint(fPaint, SkMatrix::I(), fContext->getRenderTarget()); | 88 drawState->setFromPaint(fPaint, SkMatrix::I(), fContext->getRenderTarget()); |
89 | 89 |
90 if (fCurrVertex > 0) { | 90 if (fCurrVertex > 0) { |
91 fContext->getFontCache()->updateTextures(); | |
92 | |
93 // setup our sampler state for our text texture/atlas | 91 // setup our sampler state for our text texture/atlas |
94 SkASSERT(SkIsAlign4(fCurrVertex)); | 92 SkASSERT(SkIsAlign4(fCurrVertex)); |
95 SkASSERT(fCurrTexture); | 93 SkASSERT(fCurrTexture); |
96 GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kNon
e_FilterMode); | 94 GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kNon
e_FilterMode); |
97 | 95 |
98 // This effect could be stored with one of the cache objects (atlas?) | 96 // This effect could be stored with one of the cache objects (atlas?) |
99 int coordsIdx = drawState->hasColorVertexAttribute() ? kGlyphCoordsWithC
olorAttributeIndex : | 97 int coordsIdx = drawState->hasColorVertexAttribute() ? kGlyphCoordsWithC
olorAttributeIndex : |
100 kGlyphCoordsNoCol
orAttributeIndex; | 98 kGlyphCoordsNoCol
orAttributeIndex; |
101 drawState->addCoverageEffect( | 99 drawState->addCoverageEffect( |
102 GrCustomCoordsTextureEffect::Create(fCurrTexture
, params), | 100 GrCustomCoordsTextureEffect::Create(fCurrTexture
, params), |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 if (useColorVerts) { | 590 if (useColorVerts) { |
593 // color comes after position. | 591 // color comes after position. |
594 GrColor* colors = reinterpret_cast<GrColor*>(positions + 1); | 592 GrColor* colors = reinterpret_cast<GrColor*>(positions + 1); |
595 for (int i = 0; i < 4; ++i) { | 593 for (int i = 0; i < 4; ++i) { |
596 *colors = fPaint.getColor(); | 594 *colors = fPaint.getColor(); |
597 colors = reinterpret_cast<GrColor*>(reinterpret_cast<intptr_t>(colors
) + vertSize); | 595 colors = reinterpret_cast<GrColor*>(reinterpret_cast<intptr_t>(colors
) + vertSize); |
598 } | 596 } |
599 } | 597 } |
600 fCurrVertex += 4; | 598 fCurrVertex += 4; |
601 } | 599 } |
OLD | NEW |