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

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

Issue 1121813002: new image from backend desc (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: reviewer comments Created 5 years, 7 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 "GrTexture.h" 11 #include "GrTexture.h"
12 #include "GrGpuResourcePriv.h" 12 #include "GrGpuResourcePriv.h"
13 #include "SkBitmap.h" 13 #include "SkBitmap.h"
14 #include "SkImage_Base.h" 14 #include "SkImage_Base.h"
15 #include "SkImagePriv.h" 15 #include "SkImagePriv.h"
16 #include "SkSurface.h" 16 #include "SkSurface.h"
17 17
18 class SkImage_Gpu : public SkImage_Base { 18 class SkImage_Gpu : public SkImage_Base {
19 public: 19 public:
20 SK_DECLARE_INST_COUNT(SkImage_Gpu) 20 SK_DECLARE_INST_COUNT(SkImage_Gpu)
21 21
22 SkImage_Gpu(const SkBitmap&, int sampleCountForNewSurfaces, SkSurface::Budge ted); 22 /**
23 23 * An "image" can be a subset/window into a larger texture, so we explicit take the
24 SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) const ove rride; 24 * width and height.
25 GrTexture* onGetTexture() const override; 25 */
26 bool getROPixels(SkBitmap*) const override; 26 SkImage_Gpu(int w, int h, GrTexture*, int sampleCountForNewSurfaces, SkSurfa ce::Budgeted);
27
28 GrTexture* getTexture() const { return fBitmap.getTexture(); }
29
30 SkShader* onNewShader(SkShader::TileMode,
31 SkShader::TileMode,
32 const SkMatrix* localMatrix) const override;
33
34 bool isOpaque() const override;
35 27
36 void applyBudgetDecision() const { 28 void applyBudgetDecision() const {
29 GrTexture* tex = this->getTexture();
30 SkASSERT(tex);
37 if (fBudgeted) { 31 if (fBudgeted) {
38 fBitmap.getTexture()->resourcePriv().makeBudgeted(); 32 tex->resourcePriv().makeBudgeted();
39 } else { 33 } else {
40 fBitmap.getTexture()->resourcePriv().makeUnbudgeted(); 34 tex->resourcePriv().makeUnbudgeted();
41 } 35 }
42 } 36 }
43 37
38 bool getROPixels(SkBitmap*) const override;
39 GrTexture* onGetTexture() const override { return fTexture; }
40 SkShader* onNewShader(SkShader::TileMode,
41 SkShader::TileMode,
42 const SkMatrix* localMatrix) const override;
43 bool isOpaque() const override;
44 SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) const ove rride;
45
44 private: 46 private:
45 SkBitmap fBitmap; 47 SkAutoTUnref<GrTexture> fTexture;
46 const int fSampleCountForNewSurfaces; // 0 if we don't know 48 const int fSampleCountForNewSurfaces; // 0 if we don't know
47 SkSurface::Budgeted fBudgeted; 49 SkSurface::Budgeted fBudgeted;
48 50
49 typedef SkImage_Base INHERITED; 51 typedef SkImage_Base INHERITED;
50 }; 52 };
51 53
52 #endif 54 #endif
OLDNEW
« no previous file with comments | « src/image/SkImagePriv.h ('k') | src/image/SkImage_Gpu.cpp » ('j') | src/image/SkImage_Gpu.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698