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 #ifndef SkImage_Gpu_DEFINED | 8 #ifndef SkImage_Gpu_DEFINED |
9 #define SkImage_Gpu_DEFINED | 9 #define SkImage_Gpu_DEFINED |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
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, 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 | 32 |
32 void applyBudgetDecision() const { | 33 void applyBudgetDecision() const { |
33 if (SkBudgeted::kYes == fBudgeted) { | 34 if (SkBudgeted::kYes == fBudgeted) { |
34 fTexture->resourcePriv().makeBudgeted(); | 35 fTexture->resourcePriv().makeBudgeted(); |
35 } else { | 36 } else { |
36 fTexture->resourcePriv().makeUnbudgeted(); | 37 fTexture->resourcePriv().makeUnbudgeted(); |
37 } | 38 } |
38 } | 39 } |
39 | 40 |
40 bool getROPixels(SkBitmap*, CachingHint) const override; | 41 bool getROPixels(SkBitmap*, CachingHint) const override; |
41 GrTexture* asTextureRef(GrContext* ctx, const GrTextureParams& params, | 42 GrTexture* asTextureRef(GrContext* ctx, const GrTextureParams& params, |
42 SkSourceGammaTreatment) const override; | 43 SkSourceGammaTreatment) const override; |
43 sk_sp<SkImage> onMakeSubset(const SkIRect&) const override; | 44 sk_sp<SkImage> onMakeSubset(const SkIRect&) const override; |
44 | 45 |
45 GrTexture* peekTexture() const override { return fTexture; } | 46 GrTexture* peekTexture() const override { return fTexture; } |
46 sk_sp<GrTexture> refPinnedTexture(uint32_t* uniqueID) const override { | 47 sk_sp<GrTexture> refPinnedTexture(uint32_t* uniqueID) const override { |
47 *uniqueID = this->uniqueID(); | 48 *uniqueID = this->uniqueID(); |
48 return sk_ref_sp(fTexture.get()); | 49 return sk_ref_sp(fTexture.get()); |
49 } | 50 } |
50 bool isOpaque() const override; | |
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 sk_sp<SkSurface> onNewSurface(const SkImageInfo& info) const override { | 54 sk_sp<SkSurface> onNewSurface(const SkImageInfo& info) const override { |
55 return SkSurface::MakeRenderTarget(fTexture->getContext(), SkBudgeted::k
No, info); | 55 return SkSurface::MakeRenderTarget(fTexture->getContext(), SkBudgeted::k
No, info); |
56 } | 56 } |
57 | 57 |
58 private: | 58 private: |
59 SkAutoTUnref<GrTexture> fTexture; | 59 SkAutoTUnref<GrTexture> fTexture; |
60 const SkAlphaType fAlphaType; | 60 const SkAlphaType fAlphaType; |
61 const SkBudgeted fBudgeted; | 61 const SkBudgeted fBudgeted; |
62 sk_sp<SkColorSpace> fColorSpace; | 62 sk_sp<SkColorSpace> fColorSpace; |
63 mutable SkAtomic<bool> fAddedRasterVersionToCache; | 63 mutable SkAtomic<bool> fAddedRasterVersionToCache; |
64 | 64 |
65 | 65 |
66 typedef SkImage_Base INHERITED; | 66 typedef SkImage_Base INHERITED; |
67 }; | 67 }; |
68 | 68 |
69 #endif | 69 #endif |
OLD | NEW |