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

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

Issue 1107973004: Pull cache out of GrContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fixpicturerenderer.cpp Created 5 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/GrAADistanceFieldPathRenderer.cpp ('k') | src/gpu/GrClipMaskCache.h » ('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 2015 Google Inc. 2 * Copyright 2015 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 "GrBatchFontCache.h" 8 #include "GrBatchFontCache.h"
9 #include "GrFontAtlasSizes.h" 9 #include "GrFontAtlasSizes.h"
10 #include "GrGpu.h" 10 #include "GrGpu.h"
11 #include "GrRectanizer.h" 11 #include "GrRectanizer.h"
12 #include "GrSurfacePriv.h" 12 #include "GrSurfacePriv.h"
13 #include "SkString.h" 13 #include "SkString.h"
14 14
15 #include "SkDistanceFieldGen.h" 15 #include "SkDistanceFieldGen.h"
16 16
17 /////////////////////////////////////////////////////////////////////////////// 17 ///////////////////////////////////////////////////////////////////////////////
18 18
19 static GrBatchAtlas* make_atlas(GrContext* context, GrPixelConfig config, 19 static GrBatchAtlas* make_atlas(GrContext* context, GrPixelConfig config,
20 int textureWidth, int textureHeight, 20 int textureWidth, int textureHeight,
21 int numPlotsX, int numPlotsY) { 21 int numPlotsX, int numPlotsY) {
22 GrSurfaceDesc desc; 22 GrSurfaceDesc desc;
23 desc.fFlags = kNone_GrSurfaceFlags; 23 desc.fFlags = kNone_GrSurfaceFlags;
24 desc.fWidth = textureWidth; 24 desc.fWidth = textureWidth;
25 desc.fHeight = textureHeight; 25 desc.fHeight = textureHeight;
26 desc.fConfig = config; 26 desc.fConfig = config;
27 27
28 // We don't want to flush the context so we claim we're in the middle of flu shing so as to 28 // We don't want to flush the context so we claim we're in the middle of flu shing so as to
29 // guarantee we do not recieve a texture with pending IO 29 // guarantee we do not recieve a texture with pending IO
30 GrTexture* texture = context->refScratchTexture(desc, GrContext::kApprox_Scr atchTexMatch, true); 30 GrTexture* texture = context->textureProvider()->refScratchTexture(
31 desc, GrTextureProvider::kApprox_ScratchTexMatch, true);
31 if (!texture) { 32 if (!texture) {
32 return NULL; 33 return NULL;
33 } 34 }
34 return SkNEW_ARGS(GrBatchAtlas, (texture, numPlotsX, numPlotsY)); 35 return SkNEW_ARGS(GrBatchAtlas, (texture, numPlotsX, numPlotsY));
35 } 36 }
36 37
37 bool GrBatchFontCache::initAtlas(GrMaskFormat format) { 38 bool GrBatchFontCache::initAtlas(GrMaskFormat format) {
38 int index = MaskFormatToAtlasIndex(format); 39 int index = MaskFormatToAtlasIndex(format);
39 if (!fAtlases[index]) { 40 if (!fAtlases[index]) {
40 GrPixelConfig config = this->getPixelConfig(format); 41 GrPixelConfig config = this->getPixelConfig(format);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 } 233 }
233 234
234 bool success = fBatchFontCache->addToAtlas(this, &glyph->fID, batchTarget, g lyph->fMaskFormat, 235 bool success = fBatchFontCache->addToAtlas(this, &glyph->fID, batchTarget, g lyph->fMaskFormat,
235 glyph->width(), glyph->height(), 236 glyph->width(), glyph->height(),
236 storage.get(), &glyph->fAtlasLoca tion); 237 storage.get(), &glyph->fAtlasLoca tion);
237 if (success) { 238 if (success) {
238 fAtlasedGlyphs++; 239 fAtlasedGlyphs++;
239 } 240 }
240 return success; 241 return success;
241 } 242 }
OLDNEW
« no previous file with comments | « src/gpu/GrAADistanceFieldPathRenderer.cpp ('k') | src/gpu/GrClipMaskCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698