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

Side by Side Diff: src/gpu/GrBitmapTextContext.cpp

Issue 347563005: Reduce texture uploads for font atlas. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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/GrAtlas.cpp ('k') | src/gpu/GrDistanceFieldTextContext.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 "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
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
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 }
OLDNEW
« no previous file with comments | « src/gpu/GrAtlas.cpp ('k') | src/gpu/GrDistanceFieldTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698