summaryrefslogtreecommitdiffstats
path: root/libs/hwui/Dither.h
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2013-04-05 11:17:55 -0700
committerRomain Guy <romainguy@google.com>2013-04-05 14:17:17 -0700
commitb48800428906ae455c2b63acacd44e390e1fee49 (patch)
treebc0de8c6f51eb5c9cac2d5fe1d5a41fede6d727a /libs/hwui/Dither.h
parent80fdc9624e6d53a78031bf99d34e7c01d53ad66e (diff)
downloadframeworks_base-b48800428906ae455c2b63acacd44e390e1fee49.zip
frameworks_base-b48800428906ae455c2b63acacd44e390e1fee49.tar.gz
frameworks_base-b48800428906ae455c2b63acacd44e390e1fee49.tar.bz2
Use float textures to render gradients when possible
Float textures offer better precision for dithering. In addition this change removes two uniforms from gradient shaders. These uniforms were used to dither gradients but their value is a build time constant. Instead we hardcode the value directly in the shader source at compile time. Change-Id: I05e9fd3eef93771843bbd91b453274452dfaefee
Diffstat (limited to 'libs/hwui/Dither.h')
-rw-r--r--libs/hwui/Dither.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/libs/hwui/Dither.h b/libs/hwui/Dither.h
index 34cf9bf..4d1f921 100644
--- a/libs/hwui/Dither.h
+++ b/libs/hwui/Dither.h
@@ -17,13 +17,23 @@
#ifndef ANDROID_HWUI_DITHER_H
#define ANDROID_HWUI_DITHER_H
-#include <GLES2/gl2.h>
+#include <GLES3/gl3.h>
#include "Program.h"
namespace android {
namespace uirenderer {
+///////////////////////////////////////////////////////////////////////////////
+// Defines
+///////////////////////////////////////////////////////////////////////////////
+
+// Must be a power of two
+#define DITHER_KERNEL_SIZE 4
+// These must not use the .0f notation as they are used from GLSL
+#define DITHER_KERNEL_SIZE_INV (1.0 / 4.0)
+#define DITHER_KERNEL_SIZE_INV_SQUARE (1.0 / 16.0)
+
/**
* Handles dithering for programs.
*/