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

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

Issue 269423007: Add CPU backing store for GrAtlas to reduce texture uploads (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add assert to GrPlot::uploadTexture() Created 6 years, 7 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.h ('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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « src/gpu/GrBitmapTextContext.h ('k') | src/gpu/GrDistanceFieldTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698