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

Unified 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: set samplecount to 0 (for now) 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/image/SkImagePriv.h ('k') | src/image/SkImage_Gpu.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkImage_Gpu.h
diff --git a/src/image/SkImage_Gpu.h b/src/image/SkImage_Gpu.h
index 7b38e60ea348056e4208de9b1603ad775d2d0204..972cd3c2c224e8eaada1d24df6e6090661126400 100644
--- a/src/image/SkImage_Gpu.h
+++ b/src/image/SkImage_Gpu.h
@@ -19,32 +19,38 @@ class SkImage_Gpu : public SkImage_Base {
public:
SK_DECLARE_INST_COUNT(SkImage_Gpu)
- SkImage_Gpu(const SkBitmap&, int sampleCountForNewSurfaces, SkSurface::Budgeted);
-
- SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) const override;
- GrTexture* onGetTexture() const override;
- bool getROPixels(SkBitmap*) const override;
-
- GrTexture* getTexture() const { return fBitmap.getTexture(); }
-
- SkShader* onNewShader(SkShader::TileMode,
- SkShader::TileMode,
- const SkMatrix* localMatrix) const override;
-
- bool isOpaque() const override;
+ /**
+ * An "image" can be a subset/window into a larger texture, so we explicit take the
+ * width and height.
+ */
+ SkImage_Gpu(int w, int h, SkAlphaType, GrTexture*, int sampleCountForNewSurfaces,
+ SkSurface::Budgeted);
void applyBudgetDecision() const {
+ GrTexture* tex = this->getTexture();
+ SkASSERT(tex);
if (fBudgeted) {
- fBitmap.getTexture()->resourcePriv().makeBudgeted();
+ tex->resourcePriv().makeBudgeted();
} else {
- fBitmap.getTexture()->resourcePriv().makeUnbudgeted();
+ tex->resourcePriv().makeUnbudgeted();
}
}
+ bool getROPixels(SkBitmap*) const override;
+ GrTexture* onGetTexture() const override { return fTexture; }
+ SkShader* onNewShader(SkShader::TileMode,
+ SkShader::TileMode,
+ const SkMatrix* localMatrix) const override;
+ bool isOpaque() const override;
+ SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) const override;
+ bool onReadPixels(const SkImageInfo&, void* dstPixels, size_t dstRowBytes,
+ int srcX, int srcY) const override;
+
private:
- SkBitmap fBitmap;
- const int fSampleCountForNewSurfaces; // 0 if we don't know
- SkSurface::Budgeted fBudgeted;
+ SkAutoTUnref<GrTexture> fTexture;
+ const int fSampleCountForNewSurfaces; // 0 if we don't know
+ const SkAlphaType fAlphaType;
+ SkSurface::Budgeted fBudgeted;
typedef SkImage_Base INHERITED;
};
« 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