summaryrefslogtreecommitdiffstats
path: root/libs/hwui/DamageAccumulator.cpp
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2014-08-14 13:34:01 -0700
committerChris Craik <ccraik@google.com>2014-08-15 00:59:44 +0000
commit69e5adffb19135d51bde8e458f4907d7265f3e23 (patch)
tree022fc23512ae5adfbe3f86351305bc9f4538a68a /libs/hwui/DamageAccumulator.cpp
parente222e359a0aab985488a711f6edb76820fe8c6df (diff)
downloadframeworks_base-69e5adffb19135d51bde8e458f4907d7265f3e23.zip
frameworks_base-69e5adffb19135d51bde8e458f4907d7265f3e23.tar.gz
frameworks_base-69e5adffb19135d51bde8e458f4907d7265f3e23.tar.bz2
Define shadow casting behavior within layers
bug:15860114 Savelayers and HW layers both now support shadow casting. For save layers, the light source should always be correct, for HW layers, the light source position is set when the layer is created, and updated when it is resized. Change-Id: Ie85567dd43c2bb0a0b08fd0bd4db41efa793ac2b
Diffstat (limited to 'libs/hwui/DamageAccumulator.cpp')
-rw-r--r--libs/hwui/DamageAccumulator.cpp32
1 files changed, 24 insertions, 8 deletions
diff --git a/libs/hwui/DamageAccumulator.cpp b/libs/hwui/DamageAccumulator.cpp
index 15bed58..054a164 100644
--- a/libs/hwui/DamageAccumulator.cpp
+++ b/libs/hwui/DamageAccumulator.cpp
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-#define LOG_TAG "DamageAccumulator"
-
#include "DamageAccumulator.h"
#include <cutils/log.h>
@@ -26,12 +24,6 @@
namespace android {
namespace uirenderer {
-NullDamageAccumulator NullDamageAccumulator::sInstance;
-
-NullDamageAccumulator* NullDamageAccumulator::instance() {
- return &sInstance;
-}
-
enum TransformType {
TransformInvalid = 0,
TransformRenderNode,
@@ -60,6 +52,30 @@ DamageAccumulator::DamageAccumulator() {
mHead->type = TransformNone;
}
+static void computeTransformImpl(const DirtyStack* currentFrame, Matrix4* outMatrix) {
+ if (currentFrame->prev != currentFrame) {
+ computeTransformImpl(currentFrame->prev, outMatrix);
+ }
+ switch (currentFrame->type) {
+ case TransformRenderNode:
+ currentFrame->renderNode->applyViewPropertyTransforms(*outMatrix);
+ break;
+ case TransformMatrix4:
+ outMatrix->multiply(*currentFrame->matrix4);
+ break;
+ case TransformNone:
+ // nothing to be done
+ break;
+ default:
+ LOG_ALWAYS_FATAL("Tried to compute transform with an invalid type: %d", currentFrame->type);
+ }
+}
+
+void DamageAccumulator::computeCurrentTransform(Matrix4* outMatrix) const {
+ outMatrix->loadIdentity();
+ computeTransformImpl(mHead, outMatrix);
+}
+
void DamageAccumulator::pushCommon() {
if (!mHead->next) {
DirtyStack* nextFrame = (DirtyStack*) mAllocator.alloc(sizeof(DirtyStack));