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