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 "GrTextureProvider.h" | 8 #include "GrTextureProvider.h" |
9 | 9 |
10 #include "GrCaps.h" | 10 #include "GrCaps.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 } | 151 } |
152 } | 152 } |
153 | 153 |
154 if (!(kNoCreate_ScratchTextureFlag & flags)) { | 154 if (!(kNoCreate_ScratchTextureFlag & flags)) { |
155 return fGpu->createTexture(*desc, SkBudgeted::kYes); | 155 return fGpu->createTexture(*desc, SkBudgeted::kYes); |
156 } | 156 } |
157 | 157 |
158 return nullptr; | 158 return nullptr; |
159 } | 159 } |
160 | 160 |
161 GrTexture* GrTextureProvider::wrapBackendTexture(const GrBackendTextureDesc& des
c, | 161 sk_sp<GrTexture> GrTextureProvider::wrapBackendTexture(const GrBackendTextureDes
c& desc, |
162 GrWrapOwnership ownership) { | 162 GrWrapOwnership ownership
) { |
163 ASSERT_SINGLE_OWNER | 163 ASSERT_SINGLE_OWNER |
164 if (this->isAbandoned()) { | 164 if (this->isAbandoned()) { |
165 return nullptr; | 165 return nullptr; |
166 } | 166 } |
167 return fGpu->wrapBackendTexture(desc, ownership); | 167 return fGpu->wrapBackendTexture(desc, ownership); |
168 } | 168 } |
169 | 169 |
170 GrRenderTarget* GrTextureProvider::wrapBackendRenderTarget(const GrBackendRender
TargetDesc& desc) { | 170 sk_sp<GrRenderTarget> GrTextureProvider::wrapBackendRenderTarget( |
| 171 const GrBackendRenderTargetDesc& desc) |
| 172 { |
171 ASSERT_SINGLE_OWNER | 173 ASSERT_SINGLE_OWNER |
172 return this->isAbandoned() ? nullptr : fGpu->wrapBackendRenderTarget(desc, | 174 return this->isAbandoned() ? nullptr |
173 kBorrow
_GrWrapOwnership); | 175 : fGpu->wrapBackendRenderTarget(desc, kBorrow_GrW
rapOwnership); |
174 } | 176 } |
175 | 177 |
176 void GrTextureProvider::assignUniqueKeyToResource(const GrUniqueKey& key, GrGpuR
esource* resource) { | 178 void GrTextureProvider::assignUniqueKeyToResource(const GrUniqueKey& key, GrGpuR
esource* resource) { |
177 ASSERT_SINGLE_OWNER | 179 ASSERT_SINGLE_OWNER |
178 if (this->isAbandoned() || !resource) { | 180 if (this->isAbandoned() || !resource) { |
179 return; | 181 return; |
180 } | 182 } |
181 resource->resourcePriv().setUniqueKey(key); | 183 resource->resourcePriv().setUniqueKey(key); |
182 } | 184 } |
183 | 185 |
(...skipping 10 matching lines...) Expand all Loading... |
194 GrTexture* GrTextureProvider::findAndRefTextureByUniqueKey(const GrUniqueKey& ke
y) { | 196 GrTexture* GrTextureProvider::findAndRefTextureByUniqueKey(const GrUniqueKey& ke
y) { |
195 ASSERT_SINGLE_OWNER | 197 ASSERT_SINGLE_OWNER |
196 GrGpuResource* resource = this->findAndRefResourceByUniqueKey(key); | 198 GrGpuResource* resource = this->findAndRefResourceByUniqueKey(key); |
197 if (resource) { | 199 if (resource) { |
198 GrTexture* texture = static_cast<GrSurface*>(resource)->asTexture(); | 200 GrTexture* texture = static_cast<GrSurface*>(resource)->asTexture(); |
199 SkASSERT(texture); | 201 SkASSERT(texture); |
200 return texture; | 202 return texture; |
201 } | 203 } |
202 return NULL; | 204 return NULL; |
203 } | 205 } |
OLD | NEW |