OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |