| 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 GrBatchAtlas* atlas = new GrBatchAtlas(texture, numPlotsX, numPlotsY); | 167 return new GrBatchAtlas(texture, numPlotsX, numPlotsY); |
| 168 atlas->registerEvictionCallback(func, data); | |
| 169 return atlas; | |
| 170 } | 168 } |
| 171 | 169 |
| 172 GrStencilAttachment* GrResourceProvider::attachStencilAttachment(GrRenderTarget*
rt) { | 170 GrStencilAttachment* GrResourceProvider::attachStencilAttachment(GrRenderTarget*
rt) { |
| 173 SkASSERT(rt); | 171 SkASSERT(rt); |
| 174 if (rt->renderTargetPriv().getStencilAttachment()) { | 172 if (rt->renderTargetPriv().getStencilAttachment()) { |
| 175 return rt->renderTargetPriv().getStencilAttachment(); | 173 return rt->renderTargetPriv().getStencilAttachment(); |
| 176 } | 174 } |
| 177 | 175 |
| 178 if (!rt->wasDestroyed() && rt->canAttemptStencilAttachment()) { | 176 if (!rt->wasDestroyed() && rt->canAttemptStencilAttachment()) { |
| 179 GrUniqueKey sbKey; | 177 GrUniqueKey sbKey; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 210 // FBO. But iOS doesn't allow a stencil-only FBO. It reports uns
upported | 208 // FBO. But iOS doesn't allow a stencil-only FBO. It reports uns
upported |
| 211 // FBO status. | 209 // FBO status. |
| 212 this->gpu()->clearStencil(rt); | 210 this->gpu()->clearStencil(rt); |
| 213 } | 211 } |
| 214 } | 212 } |
| 215 } | 213 } |
| 216 return rt->renderTargetPriv().getStencilAttachment(); | 214 return rt->renderTargetPriv().getStencilAttachment(); |
| 217 } | 215 } |
| 218 | 216 |
| 219 | 217 |
| OLD | NEW |