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

Side by Side Diff: src/gpu/GrDistanceFieldTextContext.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/GrBitmapTextContext.cpp ('k') | src/gpu/GrInOrderDrawBuffer.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 "GrDistanceFieldTextContext.h" 8 #include "GrDistanceFieldTextContext.h"
9 #include "GrAtlas.h" 9 #include "GrAtlas.h"
10 #include "SkColorFilter.h" 10 #include "SkColorFilter.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 void GrDistanceFieldTextContext::flushGlyphs() { 99 void GrDistanceFieldTextContext::flushGlyphs() {
100 if (NULL == fDrawTarget) { 100 if (NULL == fDrawTarget) {
101 return; 101 return;
102 } 102 }
103 103
104 GrDrawState* drawState = fDrawTarget->drawState(); 104 GrDrawState* drawState = fDrawTarget->drawState();
105 GrDrawState::AutoRestoreEffects are(drawState); 105 GrDrawState::AutoRestoreEffects are(drawState);
106 drawState->setFromPaint(fPaint, fContext->getMatrix(), fContext->getRenderTa rget()); 106 drawState->setFromPaint(fPaint, fContext->getMatrix(), fContext->getRenderTa rget());
107 107
108 if (fCurrVertex > 0) { 108 if (fCurrVertex > 0) {
109 fContext->getFontCache()->updateTextures();
110
111 // setup our sampler state for our text texture/atlas 109 // setup our sampler state for our text texture/atlas
112 SkASSERT(SkIsAlign4(fCurrVertex)); 110 SkASSERT(SkIsAlign4(fCurrVertex));
113 SkASSERT(fCurrTexture); 111 SkASSERT(fCurrTexture);
114 GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kBil erp_FilterMode); 112 GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kBil erp_FilterMode);
115 GrTextureParams gammaParams(SkShader::kClamp_TileMode, GrTextureParams:: kNone_FilterMode); 113 GrTextureParams gammaParams(SkShader::kClamp_TileMode, GrTextureParams:: kNone_FilterMode);
116 114
117 // Effects could be stored with one of the cache objects (atlas?) 115 // Effects could be stored with one of the cache objects (atlas?)
118 SkColor filteredColor; 116 SkColor filteredColor;
119 SkColorFilter* colorFilter = fSkPaint.getColorFilter(); 117 SkColorFilter* colorFilter = fSkPaint.getColorFilter();
120 if (NULL != colorFilter) { 118 if (NULL != colorFilter) {
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 SkScalarToFixed(x) - (glyph.fAdvanceX >> a lignShift), 567 SkScalarToFixed(x) - (glyph.fAdvanceX >> a lignShift),
570 SkScalarToFixed(y) - (glyph.fAdvanceY >> a lignShift), 568 SkScalarToFixed(y) - (glyph.fAdvanceY >> a lignShift),
571 fontScaler); 569 fontScaler);
572 } 570 }
573 pos += scalarsPerPosition; 571 pos += scalarsPerPosition;
574 } 572 }
575 } 573 }
576 574
577 this->finish(); 575 this->finish();
578 } 576 }
OLDNEW
« no previous file with comments | « src/gpu/GrBitmapTextContext.cpp ('k') | src/gpu/GrInOrderDrawBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698