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

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

Issue 376703009: Use the GrCacheable ID to eliminate the need for notifications to GrGpuGL when textures and RTs are… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: now with 64 bits Created 6 years, 5 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/GrCacheable.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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 }; 50 };
51 51
52 GrBitmapTextContext::GrBitmapTextContext(GrContext* context, 52 GrBitmapTextContext::GrBitmapTextContext(GrContext* context,
53 const SkDeviceProperties& properties) 53 const SkDeviceProperties& properties)
54 : GrTextContext(context, properties) { 54 : GrTextContext(context, properties) {
55 fStrike = NULL; 55 fStrike = NULL;
56 56
57 fCurrTexture = NULL; 57 fCurrTexture = NULL;
58 fCurrVertex = 0; 58 fCurrVertex = 0;
59 fEffectTextureGenID = 0; 59 fEffectTextureInstanceID = 0;
60 60
61 fVertices = NULL; 61 fVertices = NULL;
62 fMaxVertices = 0; 62 fMaxVertices = 0;
63 63
64 fVertexBounds.setLargestInverted(); 64 fVertexBounds.setLargestInverted();
65 } 65 }
66 66
67 GrBitmapTextContext::~GrBitmapTextContext() { 67 GrBitmapTextContext::~GrBitmapTextContext() {
68 this->flushGlyphs(); 68 this->flushGlyphs();
69 } 69 }
(...skipping 17 matching lines...) Expand all
87 GrDrawState* drawState = fDrawTarget->drawState(); 87 GrDrawState* drawState = fDrawTarget->drawState();
88 GrDrawState::AutoRestoreEffects are(drawState); 88 GrDrawState::AutoRestoreEffects are(drawState);
89 drawState->setFromPaint(fPaint, SkMatrix::I(), fContext->getRenderTarget()); 89 drawState->setFromPaint(fPaint, SkMatrix::I(), fContext->getRenderTarget());
90 90
91 if (fCurrVertex > 0) { 91 if (fCurrVertex > 0) {
92 // setup our sampler state for our text texture/atlas 92 // setup our sampler state for our text texture/atlas
93 SkASSERT(SkIsAlign4(fCurrVertex)); 93 SkASSERT(SkIsAlign4(fCurrVertex));
94 SkASSERT(fCurrTexture); 94 SkASSERT(fCurrTexture);
95 GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kNon e_FilterMode); 95 GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kNon e_FilterMode);
96 96
97 uint32_t textureGenID = fCurrTexture->getGenerationID(); 97 uint64_t textureInstanceID = fCurrTexture->getInstanceID();
98 98
99 if (textureGenID != fEffectTextureGenID) { 99 if (textureInstanceID != fEffectTextureInstanceID) {
100 fCachedEffect.reset(GrCustomCoordsTextureEffect::Create(fCurrTexture , params)); 100 fCachedEffect.reset(GrCustomCoordsTextureEffect::Create(fCurrTexture , params));
101 fEffectTextureGenID = textureGenID; 101 fEffectTextureInstanceID = textureInstanceID;
102 } 102 }
103 103
104 // This effect could be stored with one of the cache objects (atlas?) 104 // This effect could be stored with one of the cache objects (atlas?)
105 int coordsIdx = drawState->hasColorVertexAttribute() ? kGlyphCoordsWithC olorAttributeIndex : 105 int coordsIdx = drawState->hasColorVertexAttribute() ? kGlyphCoordsWithC olorAttributeIndex :
106 kGlyphCoordsNoCol orAttributeIndex; 106 kGlyphCoordsNoCol orAttributeIndex;
107 drawState->addCoverageEffect(fCachedEffect.get(), coordsIdx); 107 drawState->addCoverageEffect(fCachedEffect.get(), coordsIdx);
108 SkASSERT(NULL != fStrike); 108 SkASSERT(NULL != fStrike);
109 switch (fStrike->getMaskFormat()) { 109 switch (fStrike->getMaskFormat()) {
110 // Color bitmap text 110 // Color bitmap text
111 case kARGB_GrMaskFormat: 111 case kARGB_GrMaskFormat:
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 if (useColorVerts) { 596 if (useColorVerts) {
597 // color comes after position. 597 // color comes after position.
598 GrColor* colors = reinterpret_cast<GrColor*>(positions + 1); 598 GrColor* colors = reinterpret_cast<GrColor*>(positions + 1);
599 for (int i = 0; i < 4; ++i) { 599 for (int i = 0; i < 4; ++i) {
600 *colors = fPaint.getColor(); 600 *colors = fPaint.getColor();
601 colors = reinterpret_cast<GrColor*>(reinterpret_cast<intptr_t>(colors ) + vertSize); 601 colors = reinterpret_cast<GrColor*>(reinterpret_cast<intptr_t>(colors ) + vertSize);
602 } 602 }
603 } 603 }
604 fCurrVertex += 4; 604 fCurrVertex += 4;
605 } 605 }
OLDNEW
« no previous file with comments | « src/gpu/GrBitmapTextContext.h ('k') | src/gpu/GrCacheable.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698