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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 desc.fConfig = config; | 157 desc.fConfig = config; |
158 | 158 |
159 // We don't want to flush the context so we claim we're in the middle of flu
shing so as to | 159 // We don't want to flush the context so we claim we're in the middle of flu
shing so as to |
160 // guarantee we do not recieve a texture with pending IO | 160 // guarantee we do not recieve a texture with pending IO |
161 // TODO: Determine how to avoid having to do this. (http://skbug.com/4156) | 161 // TODO: Determine how to avoid having to do this. (http://skbug.com/4156) |
162 static const uint32_t kFlags = GrResourceProvider::kNoPendingIO_Flag; | 162 static const uint32_t kFlags = GrResourceProvider::kNoPendingIO_Flag; |
163 GrTexture* texture = this->createApproxTexture(desc, kFlags); | 163 GrTexture* texture = this->createApproxTexture(desc, kFlags); |
164 if (!texture) { | 164 if (!texture) { |
165 return nullptr; | 165 return nullptr; |
166 } | 166 } |
167 return new GrBatchAtlas(texture, numPlotsX, numPlotsY); | 167 GrBatchAtlas* atlas = new GrBatchAtlas(texture, numPlotsX, numPlotsY); |
| 168 atlas->registerEvictionCallback(func, data); |
| 169 return atlas; |
168 } | 170 } |
169 | 171 |
170 GrStencilAttachment* GrResourceProvider::attachStencilAttachment(GrRenderTarget*
rt) { | 172 GrStencilAttachment* GrResourceProvider::attachStencilAttachment(GrRenderTarget*
rt) { |
171 SkASSERT(rt); | 173 SkASSERT(rt); |
172 if (rt->renderTargetPriv().getStencilAttachment()) { | 174 if (rt->renderTargetPriv().getStencilAttachment()) { |
173 return rt->renderTargetPriv().getStencilAttachment(); | 175 return rt->renderTargetPriv().getStencilAttachment(); |
174 } | 176 } |
175 | 177 |
176 if (!rt->wasDestroyed() && rt->canAttemptStencilAttachment()) { | 178 if (!rt->wasDestroyed() && rt->canAttemptStencilAttachment()) { |
177 GrUniqueKey sbKey; | 179 GrUniqueKey sbKey; |
(...skipping 30 matching lines...) Expand all Loading... |
208 // FBO. But iOS doesn't allow a stencil-only FBO. It reports uns
upported | 210 // FBO. But iOS doesn't allow a stencil-only FBO. It reports uns
upported |
209 // FBO status. | 211 // FBO status. |
210 this->gpu()->clearStencil(rt); | 212 this->gpu()->clearStencil(rt); |
211 } | 213 } |
212 } | 214 } |
213 } | 215 } |
214 return rt->renderTargetPriv().getStencilAttachment(); | 216 return rt->renderTargetPriv().getStencilAttachment(); |
215 } | 217 } |
216 | 218 |
217 | 219 |
OLD | NEW |