summaryrefslogtreecommitdiff
path: root/libs/hwui/Layer.h
diff options
context:
space:
mode:
authorStan Iliev <stani@google.com>2018-08-31 18:35:06 +0000
committerStan Iliev <stani@google.com>2018-08-31 22:13:15 +0000
commit85f9096b5272c9a39e592e2e97cbbe6cb0e767ab (patch)
tree6d63c7fd5f5d8bea10a540d556f44769520b3057 /libs/hwui/Layer.h
parentf5121c964b5cc7ca4c71313b7a25abdd81377e36 (diff)
Revert "Revert "TextureView Vulkan support and optimized OpenGL draw""
This reverts commit 867c43de0544217d26c3ee18f4d6603bb2ea97ce. Reason for revert: Fixed issue with unsupported hardware buffer formats by landing https://skia-review.googlesource.com/c/skia/+/150470 "Support more hardware buffer formats" Bug: 113673613 Change-Id: I1f7c528f138e290160e75833c8d989d9535002ee
Diffstat (limited to 'libs/hwui/Layer.h')
-rw-r--r--libs/hwui/Layer.h57
1 files changed, 37 insertions, 20 deletions
diff --git a/libs/hwui/Layer.h b/libs/hwui/Layer.h
index 31878ac23642..c4e4c1c96ba6 100644
--- a/libs/hwui/Layer.h
+++ b/libs/hwui/Layer.h
@@ -23,8 +23,9 @@
#include <SkColorFilter.h>
#include <SkColorSpace.h>
#include <SkPaint.h>
-
-#include "Matrix.h"
+#include <SkImage.h>
+#include <SkMatrix.h>
+#include <system/graphics.h>
namespace android {
namespace uirenderer {
@@ -40,24 +41,19 @@ class RenderState;
*/
class Layer : public VirtualLightRefBase, GpuMemoryTracker {
public:
- enum class Api {
- OpenGL = 0,
- Vulkan = 1,
- };
-
- Api getApi() const { return mApi; }
+ Layer(RenderState& renderState, sk_sp<SkColorFilter>, int alpha, SkBlendMode mode);
~Layer();
- virtual uint32_t getWidth() const = 0;
+ virtual uint32_t getWidth() const { return mWidth; }
- virtual uint32_t getHeight() const = 0;
+ virtual uint32_t getHeight() const { return mHeight; }
- virtual void setSize(uint32_t width, uint32_t height) = 0;
+ virtual void setSize(uint32_t width, uint32_t height) { mWidth = width; mHeight = height; }
- virtual void setBlend(bool blend) = 0;
+ virtual void setBlend(bool blend) { mBlend = blend; }
- virtual bool isBlend() const = 0;
+ virtual bool isBlend() const { return mBlend; }
inline void setForceFilter(bool forceFilter) { this->forceFilter = forceFilter; }
@@ -84,9 +80,9 @@ public:
inline sk_sp<SkColorFilter> getColorSpaceWithFilter() const { return mColorSpaceWithFilter; }
- inline mat4& getTexTransform() { return texTransform; }
+ inline SkMatrix& getTexTransform() { return texTransform; }
- inline mat4& getTransform() { return transform; }
+ inline SkMatrix& getTransform() { return transform; }
/**
* Posts a decStrong call to the appropriate thread.
@@ -94,16 +90,17 @@ public:
*/
void postDecStrong();
+ inline void setImage(const sk_sp<SkImage>& image) { this->layerImage = image; }
+
+ inline sk_sp<SkImage> getImage() const { return this->layerImage; }
+
protected:
- Layer(RenderState& renderState, Api api, sk_sp<SkColorFilter>, int alpha, SkBlendMode mode);
RenderState& mRenderState;
private:
void buildColorSpaceWithFilter();
- Api mApi;
-
/**
* Color filter used to draw this layer. Optional.
*/
@@ -137,12 +134,32 @@ private:
/**
* Optional texture coordinates transform.
*/
- mat4 texTransform;
+ SkMatrix texTransform;
/**
* Optional transform.
*/
- mat4 transform;
+ SkMatrix transform;
+
+ /**
+ * An image backing the layer.
+ */
+ sk_sp<SkImage> layerImage;
+
+ /**
+ * layer width.
+ */
+ uint32_t mWidth = 0;
+
+ /**
+ * layer height.
+ */
+ uint32_t mHeight = 0;
+
+ /**
+ * enable blending
+ */
+ bool mBlend = false;
}; // struct Layer