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

Side by Side Diff: src/image/SkImage_Gpu.h

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/GrVkTextureRenderTarget.cpp ('k') | src/image/SkImage_Gpu.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 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 #ifndef SkImage_Gpu_DEFINED 8 #ifndef SkImage_Gpu_DEFINED
9 #define SkImage_Gpu_DEFINED 9 #define SkImage_Gpu_DEFINED
10 10
11 #include "SkAtomics.h" 11 #include "SkAtomics.h"
12 #include "GrTexture.h" 12 #include "GrTexture.h"
13 #include "GrGpuResourcePriv.h" 13 #include "GrGpuResourcePriv.h"
14 #include "SkBitmap.h" 14 #include "SkBitmap.h"
15 #include "SkGr.h" 15 #include "SkGr.h"
16 #include "SkImage_Base.h" 16 #include "SkImage_Base.h"
17 #include "SkImagePriv.h" 17 #include "SkImagePriv.h"
18 #include "SkSurface.h" 18 #include "SkSurface.h"
19 19
20 class SkImage_Gpu : public SkImage_Base { 20 class SkImage_Gpu : public SkImage_Base {
21 public: 21 public:
22 /** 22 /**
23 * An "image" can be a subset/window into a larger texture, so we explicit take the 23 * An "image" can be a subset/window into a larger texture, so we explicit take the
24 * width and height. 24 * width and height.
25 */ 25 */
26 SkImage_Gpu(int w, int h, uint32_t uniqueID, SkAlphaType, GrTexture*, sk_sp< SkColorSpace>, 26 SkImage_Gpu(int w, int h, uint32_t uniqueID, SkAlphaType, sk_sp<GrTexture>, sk_sp<SkColorSpace>,
27 SkBudgeted); 27 SkBudgeted);
28 ~SkImage_Gpu() override; 28 ~SkImage_Gpu() override;
29 29
30 SkImageInfo onImageInfo() const override; 30 SkImageInfo onImageInfo() const override;
31 SkAlphaType onAlphaType() const override { return fAlphaType; } 31 SkAlphaType onAlphaType() const override { return fAlphaType; }
32 32
33 void applyBudgetDecision() const { 33 void applyBudgetDecision() const {
34 if (SkBudgeted::kYes == fBudgeted) { 34 if (SkBudgeted::kYes == fBudgeted) {
35 fTexture->resourcePriv().makeBudgeted(); 35 fTexture->resourcePriv().makeBudgeted();
36 } else { 36 } else {
37 fTexture->resourcePriv().makeUnbudgeted(); 37 fTexture->resourcePriv().makeUnbudgeted();
38 } 38 }
39 } 39 }
40 40
41 bool getROPixels(SkBitmap*, CachingHint) const override; 41 bool getROPixels(SkBitmap*, CachingHint) const override;
42 GrTexture* asTextureRef(GrContext* ctx, const GrTextureParams& params, 42 GrTexture* asTextureRef(GrContext* ctx, const GrTextureParams& params,
43 SkSourceGammaTreatment) const override; 43 SkSourceGammaTreatment) const override;
44 sk_sp<SkImage> onMakeSubset(const SkIRect&) const override; 44 sk_sp<SkImage> onMakeSubset(const SkIRect&) const override;
45 45
46 GrTexture* peekTexture() const override { return fTexture; } 46 GrTexture* peekTexture() const override { return fTexture.get(); }
47 sk_sp<GrTexture> refPinnedTexture(uint32_t* uniqueID) const override { 47 sk_sp<GrTexture> refPinnedTexture(uint32_t* uniqueID) const override {
48 *uniqueID = this->uniqueID(); 48 *uniqueID = this->uniqueID();
49 return sk_ref_sp(fTexture.get()); 49 return fTexture;
50 } 50 }
51 bool onReadPixels(const SkImageInfo&, void* dstPixels, size_t dstRowBytes, 51 bool onReadPixels(const SkImageInfo&, void* dstPixels, size_t dstRowBytes,
52 int srcX, int srcY, CachingHint) const override; 52 int srcX, int srcY, CachingHint) const override;
53 53
54 private: 54 private:
55 SkAutoTUnref<GrTexture> fTexture; 55 sk_sp<GrTexture> fTexture;
56 const SkAlphaType fAlphaType; 56 const SkAlphaType fAlphaType;
57 const SkBudgeted fBudgeted; 57 const SkBudgeted fBudgeted;
58 sk_sp<SkColorSpace> fColorSpace; 58 sk_sp<SkColorSpace> fColorSpace;
59 mutable SkAtomic<bool> fAddedRasterVersionToCache; 59 mutable SkAtomic<bool> fAddedRasterVersionToCache;
60 60
61 61
62 typedef SkImage_Base INHERITED; 62 typedef SkImage_Base INHERITED;
63 }; 63 };
64 64
65 #endif 65 #endif
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkTextureRenderTarget.cpp ('k') | src/image/SkImage_Gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698