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

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

Issue 1734043002: Revert of Move Budgeted enum out of SkSurface, use in GrTextureProvider (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « src/image/SkImagePriv.h ('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 "SkImage_Base.h" 15 #include "SkImage_Base.h"
16 #include "SkImagePriv.h" 16 #include "SkImagePriv.h"
17 #include "SkSurface.h" 17 #include "SkSurface.h"
18 18
19 class SkImage_Gpu : public SkImage_Base { 19 class SkImage_Gpu : public SkImage_Base {
20 public: 20 public:
21 /** 21 /**
22 * An "image" can be a subset/window into a larger texture, so we explicit take the 22 * An "image" can be a subset/window into a larger texture, so we explicit take the
23 * width and height. 23 * width and height.
24 */ 24 */
25 SkImage_Gpu(int w, int h, uint32_t uniqueID, SkAlphaType, GrTexture*, SkBudg eted); 25 SkImage_Gpu(int w, int h, uint32_t uniqueID, SkAlphaType, GrTexture*, SkSurf ace::Budgeted);
26 ~SkImage_Gpu() override; 26 ~SkImage_Gpu() override;
27 27
28 void applyBudgetDecision() const { 28 void applyBudgetDecision() const {
29 GrTexture* tex = this->getTexture(); 29 GrTexture* tex = this->getTexture();
30 SkASSERT(tex); 30 SkASSERT(tex);
31 if (SkBudgeted::kYes == fBudgeted) { 31 if (fBudgeted) {
32 tex->resourcePriv().makeBudgeted(); 32 tex->resourcePriv().makeBudgeted();
33 } else { 33 } else {
34 tex->resourcePriv().makeUnbudgeted(); 34 tex->resourcePriv().makeUnbudgeted();
35 } 35 }
36 } 36 }
37 37
38 bool getROPixels(SkBitmap*, CachingHint) const override; 38 bool getROPixels(SkBitmap*, CachingHint) const override;
39 GrTexture* asTextureRef(GrContext* ctx, const GrTextureParams& params) const override; 39 GrTexture* asTextureRef(GrContext* ctx, const GrTextureParams& params) const override;
40 SkImage* onNewSubset(const SkIRect&) const override; 40 SkImage* onNewSubset(const SkIRect&) const override;
41 41
42 GrTexture* peekTexture() const override { return fTexture; } 42 GrTexture* peekTexture() const override { return fTexture; }
43 bool isOpaque() const override; 43 bool isOpaque() const override;
44 bool onReadPixels(const SkImageInfo&, void* dstPixels, size_t dstRowBytes, 44 bool onReadPixels(const SkImageInfo&, void* dstPixels, size_t dstRowBytes,
45 int srcX, int srcY, CachingHint) const override; 45 int srcX, int srcY, CachingHint) const override;
46 46
47 SkSurface* onNewSurface(const SkImageInfo& info) const override { 47 SkSurface* onNewSurface(const SkImageInfo& info) const override {
48 return SkSurface::NewRenderTarget(fTexture->getContext(), SkBudgeted::kN o, info); 48 return SkSurface::NewRenderTarget(fTexture->getContext(), SkSurface::kNo _Budgeted, info);
49 } 49 }
50 50
51 bool asBitmapForImageFilters(SkBitmap* bitmap) const override; 51 bool asBitmapForImageFilters(SkBitmap* bitmap) const override;
52 52
53 private: 53 private:
54 SkAutoTUnref<GrTexture> fTexture; 54 SkAutoTUnref<GrTexture> fTexture;
55 const SkAlphaType fAlphaType; 55 const SkAlphaType fAlphaType;
56 const SkBudgeted fBudgeted; 56 const SkSurface::Budgeted fBudgeted;
57 mutable SkAtomic<bool> fAddedRasterVersionToCache; 57 mutable SkAtomic<bool> fAddedRasterVersionToCache;
58 58
59 59
60 typedef SkImage_Base INHERITED; 60 typedef SkImage_Base INHERITED;
61 }; 61 };
62 62
63 #endif 63 #endif
OLDNEW
« no previous file with comments | « src/image/SkImagePriv.h ('k') | src/image/SkImage_Gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698