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 "GrBuffer.h" | 10 #include "GrBuffer.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 desc.fConfig = config; | 146 desc.fConfig = config; |
147 | 147 |
148 // We don't want to flush the context so we claim we're in the middle of flu
shing so as to | 148 // We don't want to flush the context so we claim we're in the middle of flu
shing so as to |
149 // guarantee we do not recieve a texture with pending IO | 149 // guarantee we do not recieve a texture with pending IO |
150 // TODO: Determine how to avoid having to do this. (https://bug.skia.org/415
6) | 150 // TODO: Determine how to avoid having to do this. (https://bug.skia.org/415
6) |
151 static const uint32_t kFlags = GrResourceProvider::kNoPendingIO_Flag; | 151 static const uint32_t kFlags = GrResourceProvider::kNoPendingIO_Flag; |
152 GrTexture* texture = this->createApproxTexture(desc, kFlags); | 152 GrTexture* texture = this->createApproxTexture(desc, kFlags); |
153 if (!texture) { | 153 if (!texture) { |
154 return nullptr; | 154 return nullptr; |
155 } | 155 } |
156 GrBatchAtlas* atlas = new GrBatchAtlas(texture, numPlotsX, numPlotsY); | 156 GrBatchAtlas* atlas = new GrBatchAtlas(this, texture, |
| 157 numPlotsX, numPlotsY); |
157 atlas->registerEvictionCallback(func, data); | 158 atlas->registerEvictionCallback(func, data); |
158 return atlas; | 159 return atlas; |
159 } | 160 } |
160 | 161 |
161 GrStencilAttachment* GrResourceProvider::attachStencilAttachment(GrRenderTarget*
rt) { | 162 GrStencilAttachment* GrResourceProvider::attachStencilAttachment(GrRenderTarget*
rt) { |
162 SkASSERT(rt); | 163 SkASSERT(rt); |
163 if (rt->renderTargetPriv().getStencilAttachment()) { | 164 if (rt->renderTargetPriv().getStencilAttachment()) { |
164 return rt->renderTargetPriv().getStencilAttachment(); | 165 return rt->renderTargetPriv().getStencilAttachment(); |
165 } | 166 } |
166 | 167 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 return rt->renderTargetPriv().getStencilAttachment(); | 206 return rt->renderTargetPriv().getStencilAttachment(); |
206 } | 207 } |
207 | 208 |
208 GrRenderTarget* GrResourceProvider::wrapBackendTextureAsRenderTarget( | 209 GrRenderTarget* GrResourceProvider::wrapBackendTextureAsRenderTarget( |
209 const GrBackendTextureDesc& desc) { | 210 const GrBackendTextureDesc& desc) { |
210 if (this->isAbandoned()) { | 211 if (this->isAbandoned()) { |
211 return nullptr; | 212 return nullptr; |
212 } | 213 } |
213 return this->gpu()->wrapBackendTextureAsRenderTarget(desc); | 214 return this->gpu()->wrapBackendTextureAsRenderTarget(desc); |
214 } | 215 } |
OLD | NEW |