Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: src/gpu/GrGpu.cpp

Issue 2448593002: Remove SkAutoTUnref and SkAutoTDelete from public includes. (Closed)
Patch Set: And Vulcan. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrGpu.h ('k') | src/gpu/GrRenderTargetOpList.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2010 Google Inc. 2 * Copyright 2010 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 8
9 #include "GrGpu.h" 9 #include "GrGpu.h"
10 10
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // operations. 183 // operations.
184 if (isRT && texels.empty()) { 184 if (isRT && texels.empty()) {
185 GrRenderTarget* rt = tex->asRenderTarget(); 185 GrRenderTarget* rt = tex->asRenderTarget();
186 SkASSERT(rt); 186 SkASSERT(rt);
187 rt->discard(); 187 rt->discard();
188 } 188 }
189 } 189 }
190 return tex; 190 return tex;
191 } 191 }
192 192
193 GrTexture* GrGpu::wrapBackendTexture(const GrBackendTextureDesc& desc, GrWrapOwn ership ownership) { 193 sk_sp<GrTexture> GrGpu::wrapBackendTexture(const GrBackendTextureDesc& desc,
194 GrWrapOwnership ownership) {
194 this->handleDirtyContext(); 195 this->handleDirtyContext();
195 if (!this->caps()->isConfigTexturable(desc.fConfig)) { 196 if (!this->caps()->isConfigTexturable(desc.fConfig)) {
196 return nullptr; 197 return nullptr;
197 } 198 }
198 if ((desc.fFlags & kRenderTarget_GrBackendTextureFlag) && 199 if ((desc.fFlags & kRenderTarget_GrBackendTextureFlag) &&
199 !this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { 200 !this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) {
200 return nullptr; 201 return nullptr;
201 } 202 }
202 int maxSize = this->caps()->maxTextureSize(); 203 int maxSize = this->caps()->maxTextureSize();
203 if (desc.fWidth > maxSize || desc.fHeight > maxSize) { 204 if (desc.fWidth > maxSize || desc.fHeight > maxSize) {
204 return nullptr; 205 return nullptr;
205 } 206 }
206 GrTexture* tex = this->onWrapBackendTexture(desc, ownership); 207 sk_sp<GrTexture> tex = this->onWrapBackendTexture(desc, ownership);
207 if (nullptr == tex) { 208 if (!tex) {
208 return nullptr; 209 return nullptr;
209 } 210 }
210 // TODO: defer this and attach dynamically 211 // TODO: defer this and attach dynamically
211 GrRenderTarget* tgt = tex->asRenderTarget(); 212 GrRenderTarget* tgt = tex->asRenderTarget();
212 if (tgt && !fContext->resourceProvider()->attachStencilAttachment(tgt)) { 213 if (tgt && !fContext->resourceProvider()->attachStencilAttachment(tgt)) {
213 tex->unref();
214 return nullptr; 214 return nullptr;
215 } else {
216 return tex;
217 } 215 }
216 return tex;
218 } 217 }
219 218
220 GrRenderTarget* GrGpu::wrapBackendRenderTarget(const GrBackendRenderTargetDesc& desc, 219 sk_sp<GrRenderTarget> GrGpu::wrapBackendRenderTarget(const GrBackendRenderTarget Desc& desc,
221 GrWrapOwnership ownership) { 220 GrWrapOwnership ownership) {
222 if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { 221 if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) {
223 return nullptr; 222 return nullptr;
224 } 223 }
225 this->handleDirtyContext(); 224 this->handleDirtyContext();
226 return this->onWrapBackendRenderTarget(desc, ownership); 225 return this->onWrapBackendRenderTarget(desc, ownership);
227 } 226 }
228 227
229 GrRenderTarget* GrGpu::wrapBackendTextureAsRenderTarget(const GrBackendTextureDe sc& desc) { 228 sk_sp<GrRenderTarget> GrGpu::wrapBackendTextureAsRenderTarget(const GrBackendTex tureDesc& desc) {
230 this->handleDirtyContext(); 229 this->handleDirtyContext();
231 if (!(desc.fFlags & kRenderTarget_GrBackendTextureFlag)) { 230 if (!(desc.fFlags & kRenderTarget_GrBackendTextureFlag)) {
232 return nullptr; 231 return nullptr;
233 } 232 }
234 if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { 233 if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) {
235 return nullptr; 234 return nullptr;
236 } 235 }
237 int maxSize = this->caps()->maxTextureSize(); 236 int maxSize = this->caps()->maxTextureSize();
238 if (desc.fWidth > maxSize || desc.fHeight > maxSize) { 237 if (desc.fWidth > maxSize || desc.fHeight > maxSize) {
239 return nullptr; 238 return nullptr;
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 // This doesn't have geometric meaning. We just need to define an orderi ng for std::map. 495 // This doesn't have geometric meaning. We just need to define an orderi ng for std::map.
497 if (a[i].x() != b[i].x()) { 496 if (a[i].x() != b[i].x()) {
498 return a[i].x() < b[i].x(); 497 return a[i].x() < b[i].x();
499 } 498 }
500 if (a[i].y() != b[i].y()) { 499 if (a[i].y() != b[i].y()) {
501 return a[i].y() < b[i].y(); 500 return a[i].y() < b[i].y();
502 } 501 }
503 } 502 }
504 return false; // Equal. 503 return false; // Equal.
505 } 504 }
OLDNEW
« no previous file with comments | « src/gpu/GrGpu.h ('k') | src/gpu/GrRenderTargetOpList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698