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

Side by Side Diff: src/gpu/GrResourceProvider.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 unified diff | Download patch
« no previous file with comments | « src/gpu/GrResourceProvider.h ('k') | no next file » | 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 "GrResourceProvider.h" 8 #include "GrResourceProvider.h"
9 9
10 #include "GrGpu.h" 10 #include "GrGpu.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } else { 135 } else {
136 scratchFlags = GrResourceCache::kPreferNoPendingIO_ScratchFlag; 136 scratchFlags = GrResourceCache::kPreferNoPendingIO_ScratchFlag;
137 } 137 }
138 GrGpuResource* resource = this->cache()->findAndRefScratchResource(key, scratchFlags); 138 GrGpuResource* resource = this->cache()->findAndRefScratchResource(key, scratchFlags);
139 if (resource) { 139 if (resource) {
140 return static_cast<GrVertexBuffer*>(resource); 140 return static_cast<GrVertexBuffer*>(resource);
141 } 141 }
142 } 142 }
143 return this->gpu()->createVertexBuffer(size, dynamic); 143 return this->gpu()->createVertexBuffer(size, dynamic);
144 } 144 }
145
146 GrBatchAtlas* GrResourceProvider::createAtlas(GrPixelConfig config,
147 int width, int height,
148 int numPlotsX, int numPlotsY,
149 GrBatchAtlas::EvictionFunc func, v oid* data) {
150 GrSurfaceDesc desc;
151 desc.fFlags = kNone_GrSurfaceFlags;
152 desc.fWidth = width;
153 desc.fHeight = height;
154 desc.fConfig = config;
155
156 // We don't want to flush the context so we claim we're in the middle of flu shing so as to
157 // guarantee we do not recieve a texture with pending IO
158 // TODO: Determine how to avoid having to do this. (http://skbug.com/4156)
159 static const uint32_t kFlags = GrResourceProvider::kNoPendingIO_Flag;
160 GrTexture* texture = this->createApproxTexture(desc, kFlags);
161 if (!texture) {
162 return NULL;
163 }
164 return SkNEW_ARGS(GrBatchAtlas, (texture, numPlotsX, numPlotsY));
165 }
OLDNEW
« no previous file with comments | « src/gpu/GrResourceProvider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698