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

Unified Diff: src/image/SkImage_Gpu.h

Issue 872543002: Take budgeted param when snapping new image. (Closed) Base URL: https://skia.googlesource.com/skia.git@budgeted
Patch Set: Address comment and rebase Created 5 years, 11 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
new file mode 100644
index 0000000000000000000000000000000000000000..f20625a29e8ab8bc360388a8602ed01cb440918d
--- /dev/null
+++ b/src/image/SkImage_Gpu.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkImage_Gpu_DEFINED
+#define SkImage_Gpu_DEFINED
+
+#include "GrTexture.h"
+#include "GrGpuResourceCacheAccess.h"
+#include "SkBitmap.h"
+#include "SkImage_Base.h"
+#include "SkImagePriv.h"
+#include "SkSurface.h"
+
+class SkImage_Gpu : public SkImage_Base {
+public:
+ SK_DECLARE_INST_COUNT(SkImage_Gpu)
+
+ SkImage_Gpu(const SkBitmap&, int sampleCountForNewSurfaces, SkSurface::Budgeted);
+
+ void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const SK_OVERRIDE;
+ void onDrawRect(SkCanvas*, const SkRect* src, const SkRect& dst,
+ const SkPaint*) const SK_OVERRIDE;
+ SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) const SK_OVERRIDE;
+ GrTexture* onGetTexture() const SK_OVERRIDE;
+ bool getROPixels(SkBitmap*) const SK_OVERRIDE;
+
+ GrTexture* getTexture() const { return fBitmap.getTexture(); }
+
+ SkShader* onNewShader(SkShader::TileMode,
+ SkShader::TileMode,
+ const SkMatrix* localMatrix) const SK_OVERRIDE;
+
+ bool isOpaque() const SK_OVERRIDE;
+
+ void applyBudgetDecision() const {
+ if (fBudgeted) {
+ fBitmap.getTexture()->cacheAccess().makeBudgeted();
+ } else {
+ fBitmap.getTexture()->cacheAccess().makeUnbudgeted();
+ }
+ }
+
+private:
+ SkBitmap fBitmap;
+ const int fSampleCountForNewSurfaces; // 0 if we don't know
+ SkSurface::Budgeted fBudgeted;
+
+ typedef SkImage_Base INHERITED;
+};
+
+#endif
« 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