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

Unified Diff: src/gpu/GrBatchFontCache.cpp

Issue 1255943006: Allow setting of GrBatchFontCache atlas sizes (Closed) Base URL: https://skia.googlesource.com/skia.git@debugatlas2
Patch Set: tweaks 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/GrBatchFontCache.h ('k') | src/gpu/GrFontAtlasSizes.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 88b3a4db17044c49616ecbf03917776ab0c412f8..30dd0b6f8a94a7d8cf5c4dc9b9c157eb89c29e1f 100644
--- a/src/gpu/GrBatchFontCache.cpp
+++ b/src/gpu/GrBatchFontCache.cpp
@@ -7,7 +7,6 @@
#include "GrBatchFontCache.h"
#include "GrContext.h"
-#include "GrFontAtlasSizes.h"
#include "GrGpu.h"
#include "GrRectanizer.h"
#include "GrResourceProvider.h"
@@ -22,15 +21,11 @@ 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) {
- width = GR_FONT_ATLAS_A8_TEXTURE_WIDTH;
- numPlotsX = GR_FONT_ATLAS_A8_NUM_PLOTS_X;
- }
+ int width = fAtlasConfigs[index].fWidth;
+ int height = fAtlasConfigs[index].fHeight;
+ int numPlotsX = fAtlasConfigs[index].numPlotsX();
+ int numPlotsY = fAtlasConfigs[index].numPlotsY();
+
fAtlases[index] =
fContext->resourceProvider()->createAtlas(config, width, height,
numPlotsX, numPlotsY,
@@ -49,6 +44,22 @@ GrBatchFontCache::GrBatchFontCache(GrContext* context)
for (int i = 0; i < kMaskFormatCount; ++i) {
fAtlases[i] = NULL;
}
+
+ // setup default atlas configs
+ fAtlasConfigs[kA8_GrMaskFormat].fWidth = 2048;
+ fAtlasConfigs[kA8_GrMaskFormat].fHeight = 2048;
+ fAtlasConfigs[kA8_GrMaskFormat].fPlotWidth = 512;
+ fAtlasConfigs[kA8_GrMaskFormat].fPlotHeight = 256;
+
+ fAtlasConfigs[kA565_GrMaskFormat].fWidth = 1024;
+ fAtlasConfigs[kA565_GrMaskFormat].fHeight = 2048;
+ fAtlasConfigs[kA565_GrMaskFormat].fPlotWidth = 256;
+ fAtlasConfigs[kA565_GrMaskFormat].fPlotHeight = 256;
+
+ fAtlasConfigs[kARGB_GrMaskFormat].fWidth = 1024;
+ fAtlasConfigs[kARGB_GrMaskFormat].fHeight = 2048;
+ fAtlasConfigs[kARGB_GrMaskFormat].fPlotWidth = 256;
+ fAtlasConfigs[kARGB_GrMaskFormat].fPlotHeight = 256;
}
GrBatchFontCache::~GrBatchFontCache() {
@@ -114,6 +125,18 @@ void GrBatchFontCache::dump() const {
++gDumpCount;
}
+void GrBatchFontCache::setAtlasSizes_ForTesting(const GrBatchAtlasConfig configs[3]) {
+ // delete any old atlases, this should be safe to do as long as we are not in the middle of a
+ // flush
+ for (int i = 0; i < kMaskFormatCount; i++) {
+ if (fAtlases[i]) {
+ SkDELETE(fAtlases[i]);
+ fAtlases[i] = NULL;
+ }
+ }
+ memcpy(fAtlasConfigs, configs, sizeof(fAtlasConfigs));
+}
+
///////////////////////////////////////////////////////////////////////////////
/*
« no previous file with comments | « src/gpu/GrBatchFontCache.h ('k') | src/gpu/GrFontAtlasSizes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698