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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 desc.fConfig = config; | 128 desc.fConfig = config; |
129 | 129 |
130 // We don't want to flush the context so we claim we're in the middle of flu
shing so as to | 130 // We don't want to flush the context so we claim we're in the middle of flu
shing so as to |
131 // guarantee we do not recieve a texture with pending IO | 131 // guarantee we do not recieve a texture with pending IO |
132 // TODO: Determine how to avoid having to do this. (https://bug.skia.org/415
6) | 132 // TODO: Determine how to avoid having to do this. (https://bug.skia.org/415
6) |
133 static const uint32_t kFlags = GrResourceProvider::kNoPendingIO_Flag; | 133 static const uint32_t kFlags = GrResourceProvider::kNoPendingIO_Flag; |
134 GrTexture* texture = this->createApproxTexture(desc, kFlags); | 134 GrTexture* texture = this->createApproxTexture(desc, kFlags); |
135 if (!texture) { | 135 if (!texture) { |
136 return nullptr; | 136 return nullptr; |
137 } | 137 } |
138 GrBatchAtlas* atlas = new GrBatchAtlas(texture, numPlotsX, numPlotsY); | 138 GrBatchAtlas* atlas = new GrBatchAtlas(this, texture, |
| 139 numPlotsX, numPlotsY); |
139 atlas->registerEvictionCallback(func, data); | 140 atlas->registerEvictionCallback(func, data); |
140 return atlas; | 141 return atlas; |
141 } | 142 } |
142 | 143 |
143 GrStencilAttachment* GrResourceProvider::attachStencilAttachment(GrRenderTarget*
rt) { | 144 GrStencilAttachment* GrResourceProvider::attachStencilAttachment(GrRenderTarget*
rt) { |
144 SkASSERT(rt); | 145 SkASSERT(rt); |
145 if (rt->renderTargetPriv().getStencilAttachment()) { | 146 if (rt->renderTargetPriv().getStencilAttachment()) { |
146 return rt->renderTargetPriv().getStencilAttachment(); | 147 return rt->renderTargetPriv().getStencilAttachment(); |
147 } | 148 } |
148 | 149 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 return rt->renderTargetPriv().getStencilAttachment(); | 188 return rt->renderTargetPriv().getStencilAttachment(); |
188 } | 189 } |
189 | 190 |
190 GrRenderTarget* GrResourceProvider::wrapBackendTextureAsRenderTarget( | 191 GrRenderTarget* GrResourceProvider::wrapBackendTextureAsRenderTarget( |
191 const GrBackendTextureDesc& desc) { | 192 const GrBackendTextureDesc& desc) { |
192 if (this->isAbandoned()) { | 193 if (this->isAbandoned()) { |
193 return nullptr; | 194 return nullptr; |
194 } | 195 } |
195 return this->gpu()->wrapBackendTextureAsRenderTarget(desc); | 196 return this->gpu()->wrapBackendTextureAsRenderTarget(desc); |
196 } | 197 } |
OLD | NEW |