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

Unified Diff: src/gpu/GrBatchFontCache.cpp

Issue 1260183006: Move atlas creation to internal to GrResourceProvider (Closed) Base URL: https://skia.googlesource.com/skia.git@debugatlas
Patch Set: tweak Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrAADistanceFieldPathRenderer.cpp ('k') | src/gpu/GrResourceProvider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrBatchFontCache.cpp
diff --git a/src/gpu/GrBatchFontCache.cpp b/src/gpu/GrBatchFontCache.cpp
index b85c5bd59569bf91cacb673caa768a413fb9c02f..dfab80af2663a4d26fd871f795b09be58a531f9d 100644
--- a/src/gpu/GrBatchFontCache.cpp
+++ b/src/gpu/GrBatchFontCache.cpp
@@ -18,49 +18,25 @@
///////////////////////////////////////////////////////////////////////////////
-static GrBatchAtlas* make_atlas(GrContext* context, GrPixelConfig config,
- int textureWidth, int textureHeight,
- int numPlotsX, int numPlotsY) {
- GrSurfaceDesc desc;
- desc.fFlags = kNone_GrSurfaceFlags;
- desc.fWidth = textureWidth;
- desc.fHeight = textureHeight;
- desc.fConfig = config;
-
- // We don't want to flush the context so we claim we're in the middle of flushing so as to
- // guarantee we do not recieve a texture with pending IO
- // TODO: Determine how to avoid having to do this. (http://skbug.com/4156)
- static const uint32_t kFlags = GrResourceProvider::kNoPendingIO_Flag;
- GrTexture* texture = context->resourceProvider()->createApproxTexture(desc, kFlags);
- if (!texture) {
- return NULL;
- }
- return SkNEW_ARGS(GrBatchAtlas, (texture, numPlotsX, numPlotsY));
-}
-
bool GrBatchFontCache::initAtlas(GrMaskFormat format) {
int index = MaskFormatToAtlasIndex(format);
if (!fAtlases[index]) {
GrPixelConfig config = MaskFormatToPixelConfig(format);
+ int width = GR_FONT_ATLAS_TEXTURE_WIDTH;
+ int height = GR_FONT_ATLAS_TEXTURE_HEIGHT;
+ int numPlotsX = GR_FONT_ATLAS_NUM_PLOTS_X;
+ int numPlotsY = GR_FONT_ATLAS_NUM_PLOTS_Y;
+
if (kA8_GrMaskFormat == format) {
- fAtlases[index] = make_atlas(fContext, config,
- GR_FONT_ATLAS_A8_TEXTURE_WIDTH,
- GR_FONT_ATLAS_TEXTURE_HEIGHT,
- GR_FONT_ATLAS_A8_NUM_PLOTS_X,
- GR_FONT_ATLAS_NUM_PLOTS_Y);
- } else {
- fAtlases[index] = make_atlas(fContext, config,
- GR_FONT_ATLAS_TEXTURE_WIDTH,
- GR_FONT_ATLAS_TEXTURE_HEIGHT,
- GR_FONT_ATLAS_NUM_PLOTS_X,
- GR_FONT_ATLAS_NUM_PLOTS_Y);
+ width = GR_FONT_ATLAS_A8_TEXTURE_WIDTH;
+ numPlotsX = GR_FONT_ATLAS_A8_NUM_PLOTS_X;
}
-
- // Atlas creation can fail
- if (fAtlases[index]) {
- fAtlases[index]->registerEvictionCallback(&GrBatchFontCache::HandleEviction,
- (void*)this);
- } else {
+ fAtlases[index] =
+ fContext->resourceProvider()->createAtlas(config, width, height,
+ numPlotsX, numPlotsY,
+ &GrBatchFontCache::HandleEviction,
+ (void*)this);
+ if (!fAtlases[index]) {
return false;
}
}
« no previous file with comments | « src/gpu/GrAADistanceFieldPathRenderer.cpp ('k') | src/gpu/GrResourceProvider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698