aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrImageIDTextureAdjuster.h
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2015-11-09 11:55:57 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-11-09 11:55:57 -0800
commitc55271f2551533b37043aa2e37f754832a43073c (patch)
tree5e9729a4c8fe05519805b97db38621efbc34956a /src/gpu/GrImageIDTextureAdjuster.h
parent3a210bfd403815bebbc7efabe7bbd373e5a3d8f8 (diff)
Separate out natively-texture image/bmp draws from cached-as-texture image/bmp draws
This makes texture-backed images and bitmaps down a new code path. It adds a pinch point via the texture adjuster that will be used to handle copied necessary for different texture targets. It also fixes bugs in the existing code exhibited by recent updates to the bleed GM. The plan is to move the the sw/generator-backed imgs/bmps on to this code path with future changes. Review URL: https://codereview.chromium.org/1424313010
Diffstat (limited to 'src/gpu/GrImageIDTextureAdjuster.h')
-rw-r--r--src/gpu/GrImageIDTextureAdjuster.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/gpu/GrImageIDTextureAdjuster.h b/src/gpu/GrImageIDTextureAdjuster.h
new file mode 100644
index 0000000000..6c0747a62c
--- /dev/null
+++ b/src/gpu/GrImageIDTextureAdjuster.h
@@ -0,0 +1,48 @@
+/*
+ * 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 GrImageIDTextureAdjuster_DEFINED
+#define GrImageIDTextureAdjuster_DEFINED
+
+#include "GrTextureParamsAdjuster.h"
+
+class SkBitmap;
+class SkImage_Base;
+
+/** Implementation for texture-backed SkBitmaps. The bitmap must stay in scope and unmodified
+ while this object exists. */
+class GrBitmapTextureAdjuster : public GrTextureAdjuster {
+public:
+ explicit GrBitmapTextureAdjuster(const SkBitmap* bmp);
+
+private:
+ void makeCopyKey(const CopyParams& params, GrUniqueKey* copyKey) override;
+
+ void didCacheCopy(const GrUniqueKey& copyKey) override;
+
+ const SkBitmap* fBmp;
+
+ typedef GrTextureAdjuster INHERITED;
+};
+
+/** Implementation for texture-backed SkImages. The image must stay in scope and unmodified while
+ this object exists. */
+class GrImageTextureAdjuster : public GrTextureAdjuster {
+public:
+ explicit GrImageTextureAdjuster(const SkImage_Base* img);
+
+private:
+ void makeCopyKey(const CopyParams& params, GrUniqueKey* copyKey) override;
+
+ void didCacheCopy(const GrUniqueKey& copyKey) override;
+
+ const SkImage_Base* fImageBase;
+
+ typedef GrTextureAdjuster INHERITED;
+};
+
+#endif