summaryrefslogtreecommitdiffstats
path: root/libs/hwui
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2011-12-09 13:08:06 -0800
committerRomain Guy <romainguy@google.com>2011-12-09 13:08:06 -0800
commit24edca8b526515979778e577191089a57f5277d7 (patch)
tree8974701bf7100ce56b1c13b47c3c4ada7af02181 /libs/hwui
parent05bbde70fd2a3af737656b9f8c5a25b56429632e (diff)
downloadframeworks_base-24edca8b526515979778e577191089a57f5277d7.zip
frameworks_base-24edca8b526515979778e577191089a57f5277d7.tar.gz
frameworks_base-24edca8b526515979778e577191089a57f5277d7.tar.bz2
Code cleanup
Change-Id: If92e3addfc4d8546a60edcdea60a1fc89c27b680
Diffstat (limited to 'libs/hwui')
-rw-r--r--libs/hwui/Program.cpp11
-rw-r--r--libs/hwui/ProgramCache.h3
-rw-r--r--libs/hwui/Properties.h5
3 files changed, 12 insertions, 7 deletions
diff --git a/libs/hwui/Program.cpp b/libs/hwui/Program.cpp
index 516546f..a9f13f7 100644
--- a/libs/hwui/Program.cpp
+++ b/libs/hwui/Program.cpp
@@ -29,6 +29,8 @@ Program::Program(const char* vertex, const char* fragment) {
mInitialized = false;
mHasColorUniform = false;
+ // No need to cache compiled shaders, rely instead on Android's
+ // persistent shaders cache
GLuint vertexShader = buildShader(vertex, GL_VERTEX_SHADER);
if (vertexShader) {
@@ -135,10 +137,11 @@ void Program::set(const mat4& projectionMatrix, const mat4& modelViewMatrix,
const mat4& transformMatrix, bool offset) {
mat4 t(projectionMatrix);
if (offset) {
- // offset screenspace xy by an amount that compensates for typical precision issues
- // in GPU hardware that tends to paint hor/vert lines in pixels shifted up and to the left.
- // This offset value is based on an assumption that some hardware may use as little
- // as 12.4 precision, so we offset by slightly more than 1/16.
+ // offset screenspace xy by an amount that compensates for typical precision
+ // issues in GPU hardware that tends to paint hor/vert lines in pixels shifted
+ // up and to the left.
+ // This offset value is based on an assumption that some hardware may use as
+ // little as 12.4 precision, so we offset by slightly more than 1/16.
t.translate(.375, .375, 0);
}
t.multiply(transformMatrix);
diff --git a/libs/hwui/ProgramCache.h b/libs/hwui/ProgramCache.h
index 5c7197b..441db8c 100644
--- a/libs/hwui/ProgramCache.h
+++ b/libs/hwui/ProgramCache.h
@@ -27,6 +27,7 @@
#include "Debug.h"
#include "Program.h"
+#include "Properties.h"
namespace android {
namespace uirenderer {
@@ -42,8 +43,6 @@ namespace uirenderer {
#define PROGRAM_LOGD(...)
#endif
-// TODO: This should be set in properties
-#define PANEL_BIT_DEPTH 20
#define COLOR_COMPONENT_THRESHOLD (1.0f - (0.5f / PANEL_BIT_DEPTH))
#define COLOR_COMPONENT_INV_THRESHOLD (0.5f / PANEL_BIT_DEPTH)
diff --git a/libs/hwui/Properties.h b/libs/hwui/Properties.h
index 47484d0..2eae0f1 100644
--- a/libs/hwui/Properties.h
+++ b/libs/hwui/Properties.h
@@ -73,8 +73,11 @@ enum DebugLevel {
#define PROPERTY_TEXT_BLACK_GAMMA_THRESHOLD "ro.text_gamma.black_threshold"
#define PROPERTY_TEXT_WHITE_GAMMA_THRESHOLD "ro.text_gamma.white_threshold"
+// TODO: This should be set by a system property
+#define PANEL_BIT_DEPTH 20
+
// Converts a number of mega-bytes into bytes
-#define MB(s) (s * 1024 * 1024)
+#define MB(s) s * 1024 * 1024
#define DEFAULT_TEXTURE_CACHE_SIZE 24.0f
#define DEFAULT_LAYER_CACHE_SIZE 16.0f