Don't blend transparent pixels when rendering layers.
With this change, the rendere keeps track of what regions are rendered into
and generates a mesh that matches these regions exactly. The mesh is used
to composite the layer on screen.
Change-Id: I1f342576b9134fb29caff7fb8f4c1da179fe956d
diff --git a/libs/hwui/Layer.h b/libs/hwui/Layer.h
index 7d54d3b..bb284379 100644
--- a/libs/hwui/Layer.h
+++ b/libs/hwui/Layer.h
@@ -27,6 +27,7 @@
#include "Rect.h"
#include "SkiaColorFilter.h"
+#include "Vertex.h"
namespace android {
namespace uirenderer {
@@ -41,6 +42,14 @@
struct Layer {
Layer(const uint32_t layerWidth, const uint32_t layerHeight):
width(layerWidth), height(layerHeight) {
+ mesh = NULL;
+ meshIndices = NULL;
+ meshElementCount = 0;
+ }
+
+ ~Layer() {
+ if (mesh) delete mesh;
+ if (meshIndices) delete meshIndices;
}
/**
@@ -99,6 +108,13 @@
* Color filter used to draw this layer. Optional.
*/
SkiaColorFilter* colorFilter;
+
+ /**
+ * If the layer can be rendered as a mesh, this is non-null.
+ */
+ TextureVertex* mesh;
+ uint16_t* meshIndices;
+ GLsizei meshElementCount;
}; // struct Layer
}; // namespace uirenderer