summaryrefslogtreecommitdiff
path: root/libs/hwui/RenderProperties.cpp
diff options
context:
space:
mode:
author Chris Craik <ccraik@google.com> 2014-03-31 12:34:11 -0700
committer Chris Craik <ccraik@google.com> 2014-04-02 18:38:25 -0700
commit49e6c73913e9bee58ea5e3984be151ee8e033163 (patch)
treedb10cba6a686b5a2435eee07b18dfb285b2cb972 /libs/hwui/RenderProperties.cpp
parent8754b73bf81aa0164f3e2a1a429ba0fda39202de (diff)
Move most TransformationInfo properties to RenderNode
This change dedupes the various properties that were represented both in TransformationInfo, and RenderProperties on the native side. RenderNode (and its associated properties) are now permanently attached to a View in SW or HW. The native copy of these properties are their sole representation. Alpha to come in a later CL. Also fixed issue with copying RenderNode's transform, and added support of deleting RenderNodes in software rendering. Change-Id: Ideb6e7f32b780e87aa1c32637c368356b3eee3a1
Diffstat (limited to 'libs/hwui/RenderProperties.cpp')
-rw-r--r--libs/hwui/RenderProperties.cpp59
1 files changed, 28 insertions, 31 deletions
diff --git a/libs/hwui/RenderProperties.cpp b/libs/hwui/RenderProperties.cpp
index 3975a766a8e5..e7e7768ffe91 100644
--- a/libs/hwui/RenderProperties.cpp
+++ b/libs/hwui/RenderProperties.cpp
@@ -45,28 +45,24 @@ RenderProperties::PrimitiveFields::PrimitiveFields()
, mPrevWidth(-1), mPrevHeight(-1)
, mPivotExplicitlySet(false)
, mMatrixDirty(false)
- , mMatrixIsIdentity(true)
, mMatrixFlags(0)
, mCaching(false) {
}
RenderProperties::ComputedFields::ComputedFields()
: mTransformMatrix(NULL)
- , mTransformCamera(NULL)
, mTransformMatrix3D(NULL)
, mClipPath(NULL) {
}
RenderProperties::ComputedFields::~ComputedFields() {
delete mTransformMatrix;
- delete mTransformCamera;
delete mTransformMatrix3D;
delete mClipPath;
}
RenderProperties::RenderProperties()
- : mCameraDistance(0)
- , mStaticMatrix(NULL)
+ : mStaticMatrix(NULL)
, mAnimationMatrix(NULL) {
}
@@ -82,9 +78,12 @@ RenderProperties& RenderProperties::operator=(const RenderProperties& other) {
setAnimationMatrix(other.getAnimationMatrix());
setCameraDistance(other.getCameraDistance());
- // Update the computed fields
- updateMatrix();
+ // Update the computed clip path
updateClipPath();
+
+ // Force recalculation of the matrix, since other's dirty bit may be clear
+ mPrimitiveFields.mMatrixDirty = true;
+ updateMatrix();
}
return *this;
}
@@ -106,8 +105,8 @@ void RenderProperties::debugOutputProperties(const int level) const {
ALOGD("%*sTranslate %.2f, %.2f, %.2f",
level * 2, "", mPrimitiveFields.mTranslationX, mPrimitiveFields.mTranslationY, mPrimitiveFields.mTranslationZ);
} else {
- ALOGD("%*sConcatMatrix %p: " MATRIX_4_STRING,
- level * 2, "", mComputedFields.mTransformMatrix, MATRIX_4_ARGS(mComputedFields.mTransformMatrix));
+ ALOGD("%*sConcatMatrix %p: " SK_MATRIX_STRING,
+ level * 2, "", mComputedFields.mTransformMatrix, SK_MATRIX_ARGS(mComputedFields.mTransformMatrix));
}
}
@@ -141,7 +140,7 @@ void RenderProperties::updateMatrix() {
if (mPrimitiveFields.mMatrixFlags && mPrimitiveFields.mMatrixFlags != TRANSLATION) {
if (!mComputedFields.mTransformMatrix) {
// only allocate a mPrimitiveFields.matrix if we have a complex transform
- mComputedFields.mTransformMatrix = new Matrix4();
+ mComputedFields.mTransformMatrix = new SkMatrix();
}
if (!mPrimitiveFields.mPivotExplicitlySet) {
if (mPrimitiveFields.mWidth != mPrimitiveFields.mPrevWidth || mPrimitiveFields.mHeight != mPrimitiveFields.mPrevHeight) {
@@ -153,33 +152,31 @@ void RenderProperties::updateMatrix() {
}
if ((mPrimitiveFields.mMatrixFlags & ROTATION_3D) == 0) {
- mComputedFields.mTransformMatrix->loadTranslate(
- mPrimitiveFields.mPivotX + mPrimitiveFields.mTranslationX,
- mPrimitiveFields.mPivotY + mPrimitiveFields.mTranslationY,
- 0);
- mComputedFields.mTransformMatrix->rotate(mPrimitiveFields.mRotation, 0, 0, 1);
- mComputedFields.mTransformMatrix->scale(mPrimitiveFields.mScaleX, mPrimitiveFields.mScaleY, 1);
- mComputedFields.mTransformMatrix->translate(-mPrimitiveFields.mPivotX, -mPrimitiveFields.mPivotY);
+ mComputedFields.mTransformMatrix->setTranslate(
+ mPrimitiveFields.mTranslationX, mPrimitiveFields.mTranslationY);
+ mComputedFields.mTransformMatrix->preRotate(mPrimitiveFields.mRotation,
+ mPrimitiveFields.mPivotX, mPrimitiveFields.mPivotY);
+ mComputedFields.mTransformMatrix->preScale(
+ mPrimitiveFields.mScaleX, mPrimitiveFields.mScaleY,
+ mPrimitiveFields.mPivotX, mPrimitiveFields.mPivotY);
} else {
- if (!mComputedFields.mTransformCamera) {
- mComputedFields.mTransformCamera = new Sk3DView();
+ if (!mComputedFields.mTransformMatrix3D) {
mComputedFields.mTransformMatrix3D = new SkMatrix();
}
- SkMatrix transformMatrix;
- transformMatrix.reset();
- mComputedFields.mTransformCamera->save();
- transformMatrix.preScale(mPrimitiveFields.mScaleX, mPrimitiveFields.mScaleY, mPrimitiveFields.mPivotX, mPrimitiveFields.mPivotY);
- mComputedFields.mTransformCamera->rotateX(mPrimitiveFields.mRotationX);
- mComputedFields.mTransformCamera->rotateY(mPrimitiveFields.mRotationY);
- mComputedFields.mTransformCamera->rotateZ(-mPrimitiveFields.mRotation);
- mComputedFields.mTransformCamera->getMatrix(mComputedFields.mTransformMatrix3D);
+ mComputedFields.mTransformMatrix->reset();
+ mComputedFields.mTransformCamera.save();
+ mComputedFields.mTransformMatrix->preScale(
+ mPrimitiveFields.mScaleX, mPrimitiveFields.mScaleY,
+ mPrimitiveFields.mPivotX, mPrimitiveFields.mPivotY);
+ mComputedFields.mTransformCamera.rotateX(mPrimitiveFields.mRotationX);
+ mComputedFields.mTransformCamera.rotateY(mPrimitiveFields.mRotationY);
+ mComputedFields.mTransformCamera.rotateZ(-mPrimitiveFields.mRotation);
+ mComputedFields.mTransformCamera.getMatrix(mComputedFields.mTransformMatrix3D);
mComputedFields.mTransformMatrix3D->preTranslate(-mPrimitiveFields.mPivotX, -mPrimitiveFields.mPivotY);
mComputedFields.mTransformMatrix3D->postTranslate(mPrimitiveFields.mPivotX + mPrimitiveFields.mTranslationX,
mPrimitiveFields.mPivotY + mPrimitiveFields.mTranslationY);
- transformMatrix.postConcat(*mComputedFields.mTransformMatrix3D);
- mComputedFields.mTransformCamera->restore();
-
- mComputedFields.mTransformMatrix->load(transformMatrix);
+ mComputedFields.mTransformMatrix->postConcat(*mComputedFields.mTransformMatrix3D);
+ mComputedFields.mTransformCamera.restore();
}
}
mPrimitiveFields.mMatrixDirty = false;