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

Unified Diff: src/gpu/GrAADistanceFieldPathRenderer.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 | « no previous file | src/gpu/GrBatchFontCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAADistanceFieldPathRenderer.cpp
diff --git a/src/gpu/GrAADistanceFieldPathRenderer.cpp b/src/gpu/GrAADistanceFieldPathRenderer.cpp
index 086db5dd851c688a377e76bc484341bac42c1af7..b81fcc5c9a4e5f94a2e9ce89d4417418b580a800 100755
--- a/src/gpu/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/GrAADistanceFieldPathRenderer.cpp
@@ -529,30 +529,6 @@ private:
PathDataList* fPathList;
};
-static GrBatchAtlas* create_atlas(GrResourceProvider* provider, GrBatchAtlas::EvictionFunc func,
- void* data) {
- GrBatchAtlas* atlas;
- // Create a new atlas
- GrSurfaceDesc desc;
- desc.fFlags = kNone_GrSurfaceFlags;
- desc.fWidth = ATLAS_TEXTURE_WIDTH;
- desc.fHeight = ATLAS_TEXTURE_HEIGHT;
- desc.fConfig = kAlpha_8_GrPixelConfig;
-
- // 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 = provider->createApproxTexture(desc, kFlags);
- if (texture) {
- atlas = SkNEW_ARGS(GrBatchAtlas, (texture, NUM_PLOTS_X, NUM_PLOTS_Y));
- } else {
- return NULL;
- }
- atlas->registerEvictionCallback(func, data);
- return atlas;
-}
-
bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) {
// we've already bailed on inverse filled paths, so this is safe
if (args.fPath->isEmpty()) {
@@ -560,8 +536,11 @@ bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) {
}
if (!fAtlas) {
- fAtlas = create_atlas(args.fResourceProvider,
- &GrAADistanceFieldPathRenderer::HandleEviction, (void*)this);
+ fAtlas = args.fResourceProvider->createAtlas(kAlpha_8_GrPixelConfig,
+ ATLAS_TEXTURE_WIDTH, ATLAS_TEXTURE_HEIGHT,
+ NUM_PLOTS_X, NUM_PLOTS_Y,
+ &GrAADistanceFieldPathRenderer::HandleEviction,
+ (void*)this);
if (!fAtlas) {
return false;
}
@@ -631,8 +610,12 @@ BATCH_TEST_DEFINE(AADistanceFieldPathBatch) {
if (context->uniqueID() != gTestStruct.fContextID) {
gTestStruct.fContextID = context->uniqueID();
gTestStruct.reset();
- gTestStruct.fAtlas = create_atlas(context->resourceProvider(),
- &PathTestStruct::HandleEviction, (void*)&gTestStruct);
+ gTestStruct.fAtlas =
+ context->resourceProvider()->createAtlas(kAlpha_8_GrPixelConfig,
+ ATLAS_TEXTURE_WIDTH, ATLAS_TEXTURE_HEIGHT,
+ NUM_PLOTS_X, NUM_PLOTS_Y,
+ &PathTestStruct::HandleEviction,
+ (void*)&gTestStruct);
}
SkMatrix viewMatrix = GrTest::TestMatrix(random);
« no previous file with comments | « no previous file | src/gpu/GrBatchFontCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698