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

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

Issue 2173513002: Cleanup of code that converts from GPU-backed resources to SkImageInfo (Closed) Base URL: https://skia.googlesource.com/skia.git@fix-sync
Patch Set: Created 4 years, 5 months 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
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, 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 return GrMakeInfoFromTexture(fTexture, fTexture->width(), fTexture->heig ht(), isOpaque(),
32 fColorSpace);
33 }
34 31
35 void applyBudgetDecision() const { 32 void applyBudgetDecision() const {
36 if (SkBudgeted::kYes == fBudgeted) { 33 if (SkBudgeted::kYes == fBudgeted) {
37 fTexture->resourcePriv().makeBudgeted(); 34 fTexture->resourcePriv().makeBudgeted();
38 } else { 35 } else {
39 fTexture->resourcePriv().makeUnbudgeted(); 36 fTexture->resourcePriv().makeUnbudgeted();
40 } 37 }
41 } 38 }
42 39
43 bool getROPixels(SkBitmap*, CachingHint) const override; 40 bool getROPixels(SkBitmap*, CachingHint) const override;
(...skipping 15 matching lines...) Expand all
59 const SkAlphaType fAlphaType; 56 const SkAlphaType fAlphaType;
60 const SkBudgeted fBudgeted; 57 const SkBudgeted fBudgeted;
61 sk_sp<SkColorSpace> fColorSpace; 58 sk_sp<SkColorSpace> fColorSpace;
62 mutable SkAtomic<bool> fAddedRasterVersionToCache; 59 mutable SkAtomic<bool> fAddedRasterVersionToCache;
63 60
64 61
65 typedef SkImage_Base INHERITED; 62 typedef SkImage_Base INHERITED;
66 }; 63 };
67 64
68 #endif 65 #endif
OLDNEW
« no previous file with comments | « src/gpu/SkGrPriv.h ('k') | src/image/SkImage_Gpu.cpp » ('j') | src/image/SkImage_Gpu.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698