From ba9b613437c34873fa95800a25fc51720638267c Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Sun, 15 Dec 2013 17:10:19 -0800 Subject: Create private properties on GLCanvas for experimentation with 3d Change-Id: I17772f61efce727cb4c1111f4d97f58c741786b8 --- libs/hwui/Caches.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'libs/hwui/Caches.cpp') diff --git a/libs/hwui/Caches.cpp b/libs/hwui/Caches.cpp index 5b751b91d384..2e7990edb78e 100644 --- a/libs/hwui/Caches.cpp +++ b/libs/hwui/Caches.cpp @@ -55,6 +55,7 @@ Caches::Caches(): Singleton(), initProperties(); initStaticProperties(); initExtensions(); + initTempProperties(); mDebugLevel = readDebugLevel(); ALOGD("Enabling debug mode %d", mDebugLevel); @@ -676,5 +677,36 @@ TextureVertex* Caches::getRegionMesh() { return mRegionMesh; } +/////////////////////////////////////////////////////////////////////////////// +// Temporary Properties +/////////////////////////////////////////////////////////////////////////////// + +void Caches::initTempProperties() { + propertyDirtyViewport = false; + propertyEnable3d = false; + propertyCameraDistance = 1.0f; + propertyShadowStrength = 0x3f; +} + +void Caches::setTempProperty(const char* name, const char* value) { + ALOGD("setting property %s to %s", name, value); + if (!strcmp(name, "enable3d")) { + propertyEnable3d = !strcmp(value, "true"); + propertyDirtyViewport = true; + ALOGD("enable3d = %d", propertyEnable3d); + return; + } else if (!strcmp(name, "cameraDistance")) { + propertyCameraDistance = fmin(fmax(atof(value), 0.001), 10); + propertyDirtyViewport = true; + ALOGD("camera dist multiplier = %.2f", propertyCameraDistance); + return; + } else if (!strcmp(name, "shadowStrength")) { + propertyShadowStrength = atoi(value); + ALOGD("shadow strength = 0x%x out of 0xff", propertyShadowStrength); + return; + } + ALOGD(" failed"); +} + }; // namespace uirenderer }; // namespace android -- cgit v1.2.3-59-g8ed1b