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

Side by Side Diff: src/gpu/vk/GrVkTexture.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/vk/GrVkTexture.h ('k') | src/gpu/vk/GrVkTextureRenderTarget.h » ('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 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 "GrVkTexture.h" 8 #include "GrVkTexture.h"
9 #include "GrVkGpu.h" 9 #include "GrVkGpu.h"
10 #include "GrVkImageView.h" 10 #include "GrVkImageView.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 GrVkImageView::kColor _Type, 71 GrVkImageView::kColor _Type,
72 info.fLevelCount); 72 info.fLevelCount);
73 if (!imageView) { 73 if (!imageView) {
74 GrVkImage::DestroyImageInfo(gpu, &info); 74 GrVkImage::DestroyImageInfo(gpu, &info);
75 return nullptr; 75 return nullptr;
76 } 76 }
77 77
78 return new GrVkTexture(gpu, budgeted, desc, info, imageView); 78 return new GrVkTexture(gpu, budgeted, desc, info, imageView);
79 } 79 }
80 80
81 GrVkTexture* GrVkTexture::CreateWrappedTexture(GrVkGpu* gpu, 81 sk_sp<GrVkTexture> GrVkTexture::MakeWrappedTexture(GrVkGpu* gpu,
82 const GrSurfaceDesc& desc, 82 const GrSurfaceDesc& desc,
83 GrWrapOwnership ownership, 83 GrWrapOwnership ownership,
84 const GrVkImageInfo* info) { 84 const GrVkImageInfo* info) {
85 SkASSERT(info); 85 SkASSERT(info);
86 // Wrapped textures require both image and allocation (because they can be m apped) 86 // Wrapped textures require both image and allocation (because they can be m apped)
87 SkASSERT(VK_NULL_HANDLE != info->fImage && VK_NULL_HANDLE != info->fAlloc.fM emory); 87 SkASSERT(VK_NULL_HANDLE != info->fImage && VK_NULL_HANDLE != info->fAlloc.fM emory);
88 88
89 const GrVkImageView* imageView = GrVkImageView::Create(gpu, info->fImage, in fo->fFormat, 89 const GrVkImageView* imageView = GrVkImageView::Create(gpu, info->fImage, in fo->fFormat,
90 GrVkImageView::kColor _Type, 90 GrVkImageView::kColor _Type,
91 info->fLevelCount); 91 info->fLevelCount);
92 if (!imageView) { 92 if (!imageView) {
93 return nullptr; 93 return nullptr;
94 } 94 }
95 95
96 GrVkImage::Wrapped wrapped = kBorrow_GrWrapOwnership == ownership ? GrVkImag e::kBorrowed_Wrapped 96 GrVkImage::Wrapped wrapped = kBorrow_GrWrapOwnership == ownership ? GrVkImag e::kBorrowed_Wrapped
97 : GrVkImag e::kAdopted_Wrapped; 97 : GrVkImag e::kAdopted_Wrapped;
98 98
99 return new GrVkTexture(gpu, kWrapped, desc, *info, imageView, wrapped); 99 return sk_sp<GrVkTexture>(new GrVkTexture(gpu, kWrapped, desc, *info, imageV iew, wrapped));
100 } 100 }
101 101
102 GrVkTexture::~GrVkTexture() { 102 GrVkTexture::~GrVkTexture() {
103 // either release or abandon should have been called by the owner of this ob ject. 103 // either release or abandon should have been called by the owner of this ob ject.
104 SkASSERT(!fTextureView); 104 SkASSERT(!fTextureView);
105 SkASSERT(!fLinearTextureView); 105 SkASSERT(!fLinearTextureView);
106 } 106 }
107 107
108 void GrVkTexture::onRelease() { 108 void GrVkTexture::onRelease() {
109 // we create this and don't hand it off, so we should always destroy it 109 // we create this and don't hand it off, so we should always destroy it
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 fLinearTextureView = nullptr; 224 fLinearTextureView = nullptr;
225 } 225 }
226 226
227 this->setNewResource(info.fImage, info.fAlloc, info.fImageTiling); 227 this->setNewResource(info.fImage, info.fAlloc, info.fImageTiling);
228 fTextureView = textureView; 228 fTextureView = textureView;
229 fInfo = info; 229 fInfo = info;
230 this->texturePriv().setMaxMipMapLevel(mipLevels); 230 this->texturePriv().setMaxMipMapLevel(mipLevels);
231 231
232 return true; 232 return true;
233 } 233 }
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkTexture.h ('k') | src/gpu/vk/GrVkTextureRenderTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698