blob: 504196db6ff0ea04e74037dcc76451a04657c524 [file] [log] [blame]
John Reckacb6f072014-03-12 16:11:23 -07001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Chris Craikb49f4462014-03-20 12:44:20 -070016#ifndef RENDERNODEPROPERTIES_H
17#define RENDERNODEPROPERTIES_H
John Reckacb6f072014-03-12 16:11:23 -070018
19#include <stddef.h>
20#include <cutils/compiler.h>
21#include <androidfw/ResourceTypes.h>
22
23#include <SkCamera.h>
24#include <SkMatrix.h>
Chris Craikb49f4462014-03-20 12:44:20 -070025
26#include "Rect.h"
27#include "Outline.h"
John Reckacb6f072014-03-12 16:11:23 -070028
29#define TRANSLATION 0x0001
30#define ROTATION 0x0002
31#define ROTATION_3D 0x0004
32#define SCALE 0x0008
33#define PIVOT 0x0010
34
35class SkBitmap;
36class SkPaint;
37class SkRegion;
38
39namespace android {
40namespace uirenderer {
41
42class Matrix4;
43class RenderNode;
44
45/*
46 * Data structure that holds the properties for a RenderNode
47 */
48class RenderProperties {
49public:
50 RenderProperties();
51 virtual ~RenderProperties();
52
John Reckd0a0b2a2014-03-20 16:28:56 -070053 RenderProperties& operator=(const RenderProperties& other);
54
John Reckacb6f072014-03-12 16:11:23 -070055 void setClipToBounds(bool clipToBounds) {
John Reckd0a0b2a2014-03-20 16:28:56 -070056 mPrimitiveFields.mClipToBounds = clipToBounds;
John Reckacb6f072014-03-12 16:11:23 -070057 }
58
John Reckacb6f072014-03-12 16:11:23 -070059 void setProjectBackwards(bool shouldProject) {
John Reckd0a0b2a2014-03-20 16:28:56 -070060 mPrimitiveFields.mProjectBackwards = shouldProject;
John Reckacb6f072014-03-12 16:11:23 -070061 }
62
63 void setProjectionReceiver(bool shouldRecieve) {
John Reckd0a0b2a2014-03-20 16:28:56 -070064 mPrimitiveFields.mProjectionReceiver = shouldRecieve;
John Reckacb6f072014-03-12 16:11:23 -070065 }
66
John Reckd0a0b2a2014-03-20 16:28:56 -070067 bool isProjectionReceiver() const {
68 return mPrimitiveFields.mProjectionReceiver;
John Reckacb6f072014-03-12 16:11:23 -070069 }
70
John Reckd0a0b2a2014-03-20 16:28:56 -070071 void setStaticMatrix(const SkMatrix* matrix) {
John Reckacb6f072014-03-12 16:11:23 -070072 delete mStaticMatrix;
John Reckd0a0b2a2014-03-20 16:28:56 -070073 if (matrix) {
74 mStaticMatrix = new SkMatrix(*matrix);
75 } else {
76 mStaticMatrix = NULL;
77 }
John Reckacb6f072014-03-12 16:11:23 -070078 }
79
80 // Can return NULL
John Reckd0a0b2a2014-03-20 16:28:56 -070081 const SkMatrix* getStaticMatrix() const {
John Reckacb6f072014-03-12 16:11:23 -070082 return mStaticMatrix;
83 }
84
John Reckd0a0b2a2014-03-20 16:28:56 -070085 void setAnimationMatrix(const SkMatrix* matrix) {
John Reckacb6f072014-03-12 16:11:23 -070086 delete mAnimationMatrix;
87 if (matrix) {
88 mAnimationMatrix = new SkMatrix(*matrix);
89 } else {
90 mAnimationMatrix = NULL;
91 }
92 }
93
94 void setAlpha(float alpha) {
95 alpha = fminf(1.0f, fmaxf(0.0f, alpha));
John Reckd0a0b2a2014-03-20 16:28:56 -070096 if (alpha != mPrimitiveFields.mAlpha) {
97 mPrimitiveFields.mAlpha = alpha;
John Reckacb6f072014-03-12 16:11:23 -070098 }
99 }
100
101 float getAlpha() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700102 return mPrimitiveFields.mAlpha;
John Reckacb6f072014-03-12 16:11:23 -0700103 }
104
105 void setHasOverlappingRendering(bool hasOverlappingRendering) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700106 mPrimitiveFields.mHasOverlappingRendering = hasOverlappingRendering;
John Reckacb6f072014-03-12 16:11:23 -0700107 }
108
109 bool hasOverlappingRendering() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700110 return mPrimitiveFields.mHasOverlappingRendering;
John Reckacb6f072014-03-12 16:11:23 -0700111 }
112
113 void setTranslationX(float translationX) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700114 if (translationX != mPrimitiveFields.mTranslationX) {
115 mPrimitiveFields.mTranslationX = translationX;
John Reckacb6f072014-03-12 16:11:23 -0700116 onTranslationUpdate();
117 }
118 }
119
120 float getTranslationX() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700121 return mPrimitiveFields.mTranslationX;
John Reckacb6f072014-03-12 16:11:23 -0700122 }
123
124 void setTranslationY(float translationY) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700125 if (translationY != mPrimitiveFields.mTranslationY) {
126 mPrimitiveFields.mTranslationY = translationY;
John Reckacb6f072014-03-12 16:11:23 -0700127 onTranslationUpdate();
128 }
129 }
130
131 float getTranslationY() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700132 return mPrimitiveFields.mTranslationY;
John Reckacb6f072014-03-12 16:11:23 -0700133 }
134
135 void setTranslationZ(float translationZ) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700136 if (translationZ != mPrimitiveFields.mTranslationZ) {
137 mPrimitiveFields.mTranslationZ = translationZ;
John Reckacb6f072014-03-12 16:11:23 -0700138 onTranslationUpdate();
139 }
140 }
141
142 float getTranslationZ() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700143 return mPrimitiveFields.mTranslationZ;
John Reckacb6f072014-03-12 16:11:23 -0700144 }
145
146 void setRotation(float rotation) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700147 if (rotation != mPrimitiveFields.mRotation) {
148 mPrimitiveFields.mRotation = rotation;
149 mPrimitiveFields.mMatrixDirty = true;
150 if (mPrimitiveFields.mRotation == 0.0f) {
151 mPrimitiveFields.mMatrixFlags &= ~ROTATION;
John Reckacb6f072014-03-12 16:11:23 -0700152 } else {
John Reckd0a0b2a2014-03-20 16:28:56 -0700153 mPrimitiveFields.mMatrixFlags |= ROTATION;
John Reckacb6f072014-03-12 16:11:23 -0700154 }
155 }
156 }
157
158 float getRotation() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700159 return mPrimitiveFields.mRotation;
John Reckacb6f072014-03-12 16:11:23 -0700160 }
161
162 void setRotationX(float rotationX) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700163 if (rotationX != mPrimitiveFields.mRotationX) {
164 mPrimitiveFields.mRotationX = rotationX;
165 mPrimitiveFields.mMatrixDirty = true;
166 if (mPrimitiveFields.mRotationX == 0.0f && mPrimitiveFields.mRotationY == 0.0f) {
167 mPrimitiveFields.mMatrixFlags &= ~ROTATION_3D;
John Reckacb6f072014-03-12 16:11:23 -0700168 } else {
John Reckd0a0b2a2014-03-20 16:28:56 -0700169 mPrimitiveFields.mMatrixFlags |= ROTATION_3D;
John Reckacb6f072014-03-12 16:11:23 -0700170 }
171 }
172 }
173
174 float getRotationX() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700175 return mPrimitiveFields.mRotationX;
John Reckacb6f072014-03-12 16:11:23 -0700176 }
177
178 void setRotationY(float rotationY) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700179 if (rotationY != mPrimitiveFields.mRotationY) {
180 mPrimitiveFields.mRotationY = rotationY;
181 mPrimitiveFields.mMatrixDirty = true;
182 if (mPrimitiveFields.mRotationX == 0.0f && mPrimitiveFields.mRotationY == 0.0f) {
183 mPrimitiveFields.mMatrixFlags &= ~ROTATION_3D;
John Reckacb6f072014-03-12 16:11:23 -0700184 } else {
John Reckd0a0b2a2014-03-20 16:28:56 -0700185 mPrimitiveFields.mMatrixFlags |= ROTATION_3D;
John Reckacb6f072014-03-12 16:11:23 -0700186 }
187 }
188 }
189
190 float getRotationY() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700191 return mPrimitiveFields.mRotationY;
John Reckacb6f072014-03-12 16:11:23 -0700192 }
193
194 void setScaleX(float scaleX) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700195 if (scaleX != mPrimitiveFields.mScaleX) {
196 mPrimitiveFields.mScaleX = scaleX;
197 mPrimitiveFields.mMatrixDirty = true;
198 if (mPrimitiveFields.mScaleX == 1.0f && mPrimitiveFields.mScaleY == 1.0f) {
199 mPrimitiveFields.mMatrixFlags &= ~SCALE;
John Reckacb6f072014-03-12 16:11:23 -0700200 } else {
John Reckd0a0b2a2014-03-20 16:28:56 -0700201 mPrimitiveFields.mMatrixFlags |= SCALE;
John Reckacb6f072014-03-12 16:11:23 -0700202 }
203 }
204 }
205
206 float getScaleX() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700207 return mPrimitiveFields.mScaleX;
John Reckacb6f072014-03-12 16:11:23 -0700208 }
209
210 void setScaleY(float scaleY) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700211 if (scaleY != mPrimitiveFields.mScaleY) {
212 mPrimitiveFields.mScaleY = scaleY;
213 mPrimitiveFields.mMatrixDirty = true;
214 if (mPrimitiveFields.mScaleX == 1.0f && mPrimitiveFields.mScaleY == 1.0f) {
215 mPrimitiveFields.mMatrixFlags &= ~SCALE;
John Reckacb6f072014-03-12 16:11:23 -0700216 } else {
John Reckd0a0b2a2014-03-20 16:28:56 -0700217 mPrimitiveFields.mMatrixFlags |= SCALE;
John Reckacb6f072014-03-12 16:11:23 -0700218 }
219 }
220 }
221
222 float getScaleY() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700223 return mPrimitiveFields.mScaleY;
John Reckacb6f072014-03-12 16:11:23 -0700224 }
225
226 void setPivotX(float pivotX) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700227 mPrimitiveFields.mPivotX = pivotX;
228 mPrimitiveFields.mMatrixDirty = true;
229 if (mPrimitiveFields.mPivotX == 0.0f && mPrimitiveFields.mPivotY == 0.0f) {
230 mPrimitiveFields.mMatrixFlags &= ~PIVOT;
John Reckacb6f072014-03-12 16:11:23 -0700231 } else {
John Reckd0a0b2a2014-03-20 16:28:56 -0700232 mPrimitiveFields.mMatrixFlags |= PIVOT;
John Reckacb6f072014-03-12 16:11:23 -0700233 }
John Reckd0a0b2a2014-03-20 16:28:56 -0700234 mPrimitiveFields.mPivotExplicitlySet = true;
John Reckacb6f072014-03-12 16:11:23 -0700235 }
236
John Reckd0a0b2a2014-03-20 16:28:56 -0700237 /* Note that getPivotX and getPivotY are adjusted by updateMatrix(),
238 * so the value returned mPrimitiveFields.may be stale if the RenderProperties has been
239 * mPrimitiveFields.modified since the last call to updateMatrix()
240 */
241 float getPivotX() const {
242 return mPrimitiveFields.mPivotX;
243 }
John Reckacb6f072014-03-12 16:11:23 -0700244
245 void setPivotY(float pivotY) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700246 mPrimitiveFields.mPivotY = pivotY;
247 mPrimitiveFields.mMatrixDirty = true;
248 if (mPrimitiveFields.mPivotX == 0.0f && mPrimitiveFields.mPivotY == 0.0f) {
249 mPrimitiveFields.mMatrixFlags &= ~PIVOT;
John Reckacb6f072014-03-12 16:11:23 -0700250 } else {
John Reckd0a0b2a2014-03-20 16:28:56 -0700251 mPrimitiveFields.mMatrixFlags |= PIVOT;
John Reckacb6f072014-03-12 16:11:23 -0700252 }
John Reckd0a0b2a2014-03-20 16:28:56 -0700253 mPrimitiveFields.mPivotExplicitlySet = true;
John Reckacb6f072014-03-12 16:11:23 -0700254 }
255
John Reckd0a0b2a2014-03-20 16:28:56 -0700256 float getPivotY() const {
257 return mPrimitiveFields.mPivotY;
258 }
John Reckacb6f072014-03-12 16:11:23 -0700259
260 void setCameraDistance(float distance) {
261 if (distance != mCameraDistance) {
262 mCameraDistance = distance;
John Reckd0a0b2a2014-03-20 16:28:56 -0700263 mPrimitiveFields.mMatrixDirty = true;
264 if (!mComputedFields.mTransformCamera) {
265 mComputedFields.mTransformCamera = new Sk3DView();
266 mComputedFields.mTransformMatrix3D = new SkMatrix();
John Reckacb6f072014-03-12 16:11:23 -0700267 }
John Reckd0a0b2a2014-03-20 16:28:56 -0700268 mComputedFields.mTransformCamera->setCameraLocation(0, 0, distance);
John Reckacb6f072014-03-12 16:11:23 -0700269 }
270 }
271
272 float getCameraDistance() const {
273 return mCameraDistance;
274 }
275
276 void setLeft(int left) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700277 if (left != mPrimitiveFields.mLeft) {
278 mPrimitiveFields.mLeft = left;
279 mPrimitiveFields.mWidth = mPrimitiveFields.mRight - mPrimitiveFields.mLeft;
280 if (mPrimitiveFields.mMatrixFlags > TRANSLATION && !mPrimitiveFields.mPivotExplicitlySet) {
281 mPrimitiveFields.mMatrixDirty = true;
John Reckacb6f072014-03-12 16:11:23 -0700282 }
283 }
284 }
285
286 float getLeft() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700287 return mPrimitiveFields.mLeft;
John Reckacb6f072014-03-12 16:11:23 -0700288 }
289
290 void setTop(int top) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700291 if (top != mPrimitiveFields.mTop) {
292 mPrimitiveFields.mTop = top;
293 mPrimitiveFields.mHeight = mPrimitiveFields.mBottom - mPrimitiveFields.mTop;
294 if (mPrimitiveFields.mMatrixFlags > TRANSLATION && !mPrimitiveFields.mPivotExplicitlySet) {
295 mPrimitiveFields.mMatrixDirty = true;
John Reckacb6f072014-03-12 16:11:23 -0700296 }
297 }
298 }
299
300 float getTop() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700301 return mPrimitiveFields.mTop;
John Reckacb6f072014-03-12 16:11:23 -0700302 }
303
304 void setRight(int right) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700305 if (right != mPrimitiveFields.mRight) {
306 mPrimitiveFields.mRight = right;
307 mPrimitiveFields.mWidth = mPrimitiveFields.mRight - mPrimitiveFields.mLeft;
308 if (mPrimitiveFields.mMatrixFlags > TRANSLATION && !mPrimitiveFields.mPivotExplicitlySet) {
309 mPrimitiveFields.mMatrixDirty = true;
John Reckacb6f072014-03-12 16:11:23 -0700310 }
311 }
312 }
313
314 float getRight() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700315 return mPrimitiveFields.mRight;
John Reckacb6f072014-03-12 16:11:23 -0700316 }
317
318 void setBottom(int bottom) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700319 if (bottom != mPrimitiveFields.mBottom) {
320 mPrimitiveFields.mBottom = bottom;
321 mPrimitiveFields.mHeight = mPrimitiveFields.mBottom - mPrimitiveFields.mTop;
322 if (mPrimitiveFields.mMatrixFlags > TRANSLATION && !mPrimitiveFields.mPivotExplicitlySet) {
323 mPrimitiveFields.mMatrixDirty = true;
John Reckacb6f072014-03-12 16:11:23 -0700324 }
325 }
326 }
327
328 float getBottom() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700329 return mPrimitiveFields.mBottom;
John Reckacb6f072014-03-12 16:11:23 -0700330 }
331
332 void setLeftTop(int left, int top) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700333 if (left != mPrimitiveFields.mLeft || top != mPrimitiveFields.mTop) {
334 mPrimitiveFields.mLeft = left;
335 mPrimitiveFields.mTop = top;
336 mPrimitiveFields.mWidth = mPrimitiveFields.mRight - mPrimitiveFields.mLeft;
337 mPrimitiveFields.mHeight = mPrimitiveFields.mBottom - mPrimitiveFields.mTop;
338 if (mPrimitiveFields.mMatrixFlags > TRANSLATION && !mPrimitiveFields.mPivotExplicitlySet) {
339 mPrimitiveFields.mMatrixDirty = true;
John Reckacb6f072014-03-12 16:11:23 -0700340 }
341 }
342 }
343
344 void setLeftTopRightBottom(int left, int top, int right, int bottom) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700345 if (left != mPrimitiveFields.mLeft || top != mPrimitiveFields.mTop || right != mPrimitiveFields.mRight || bottom != mPrimitiveFields.mBottom) {
346 mPrimitiveFields.mLeft = left;
347 mPrimitiveFields.mTop = top;
348 mPrimitiveFields.mRight = right;
349 mPrimitiveFields.mBottom = bottom;
350 mPrimitiveFields.mWidth = mPrimitiveFields.mRight - mPrimitiveFields.mLeft;
351 mPrimitiveFields.mHeight = mPrimitiveFields.mBottom - mPrimitiveFields.mTop;
352 if (mPrimitiveFields.mMatrixFlags > TRANSLATION && !mPrimitiveFields.mPivotExplicitlySet) {
353 mPrimitiveFields.mMatrixDirty = true;
John Reckacb6f072014-03-12 16:11:23 -0700354 }
355 }
356 }
357
358 void offsetLeftRight(float offset) {
359 if (offset != 0) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700360 mPrimitiveFields.mLeft += offset;
361 mPrimitiveFields.mRight += offset;
362 if (mPrimitiveFields.mMatrixFlags > TRANSLATION && !mPrimitiveFields.mPivotExplicitlySet) {
363 mPrimitiveFields.mMatrixDirty = true;
John Reckacb6f072014-03-12 16:11:23 -0700364 }
365 }
366 }
367
368 void offsetTopBottom(float offset) {
369 if (offset != 0) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700370 mPrimitiveFields.mTop += offset;
371 mPrimitiveFields.mBottom += offset;
372 if (mPrimitiveFields.mMatrixFlags > TRANSLATION && !mPrimitiveFields.mPivotExplicitlySet) {
373 mPrimitiveFields.mMatrixDirty = true;
John Reckacb6f072014-03-12 16:11:23 -0700374 }
375 }
376 }
377
378 void setCaching(bool caching) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700379 mPrimitiveFields.mCaching = caching;
John Reckacb6f072014-03-12 16:11:23 -0700380 }
381
Chris Craikb49f4462014-03-20 12:44:20 -0700382 int getWidth() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700383 return mPrimitiveFields.mWidth;
John Reckacb6f072014-03-12 16:11:23 -0700384 }
385
Chris Craikb49f4462014-03-20 12:44:20 -0700386 int getHeight() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700387 return mPrimitiveFields.mHeight;
John Reckacb6f072014-03-12 16:11:23 -0700388 }
389
John Reckd0a0b2a2014-03-20 16:28:56 -0700390 const SkMatrix* getAnimationMatrix() const {
391 return mAnimationMatrix;
392 }
393
394 uint32_t getMatrixFlags() const {
395 return mPrimitiveFields.mMatrixFlags;
396 }
397
398 const Matrix4* getTransformMatrix() const {
399 return mComputedFields.mTransformMatrix;
400 }
401
402 bool getCaching() const {
403 return mPrimitiveFields.mCaching;
404 }
405
406 bool getClipToBounds() const {
407 return mPrimitiveFields.mClipToBounds;
408 }
409
410 bool getHasOverlappingRendering() const {
411 return mPrimitiveFields.mHasOverlappingRendering;
412 }
413
414 const Outline& getOutline() const {
415 return mPrimitiveFields.mOutline;
416 }
417
418 bool getProjectBackwards() const {
419 return mPrimitiveFields.mProjectBackwards;
420 }
421
422 void debugOutputProperties(const int level) const;
423
424 ANDROID_API void updateMatrix();
425
426 Outline& mutableOutline() {
427 return mPrimitiveFields.mOutline;
Chris Craikb49f4462014-03-20 12:44:20 -0700428 }
429
John Reckacb6f072014-03-12 16:11:23 -0700430private:
431 void onTranslationUpdate() {
John Reckd0a0b2a2014-03-20 16:28:56 -0700432 mPrimitiveFields.mMatrixDirty = true;
433 if (mPrimitiveFields.mTranslationX == 0.0f && mPrimitiveFields.mTranslationY == 0.0f && mPrimitiveFields.mTranslationZ == 0.0f) {
434 mPrimitiveFields.mMatrixFlags &= ~TRANSLATION;
John Reckacb6f072014-03-12 16:11:23 -0700435 } else {
John Reckd0a0b2a2014-03-20 16:28:56 -0700436 mPrimitiveFields.mMatrixFlags |= TRANSLATION;
John Reckacb6f072014-03-12 16:11:23 -0700437 }
438 }
439
John Reckacb6f072014-03-12 16:11:23 -0700440 // Rendering properties
John Reckd0a0b2a2014-03-20 16:28:56 -0700441 struct PrimitiveFields {
442 PrimitiveFields();
John Reckacb6f072014-03-12 16:11:23 -0700443
John Reckd0a0b2a2014-03-20 16:28:56 -0700444 Outline mOutline;
445 bool mClipToBounds;
446 bool mProjectBackwards;
447 bool mProjectionReceiver;
448 float mAlpha;
449 bool mHasOverlappingRendering;
450 float mTranslationX, mTranslationY, mTranslationZ;
451 float mRotation, mRotationX, mRotationY;
452 float mScaleX, mScaleY;
453 float mPivotX, mPivotY;
454 int mLeft, mTop, mRight, mBottom;
455 int mWidth, mHeight;
456 int mPrevWidth, mPrevHeight;
457 bool mPivotExplicitlySet;
458 bool mMatrixDirty;
459 bool mMatrixIsIdentity;
460 uint32_t mMatrixFlags;
461 bool mCaching;
462 } mPrimitiveFields;
463
464 // mCameraDistance isn't in mPrimitiveFields as it has a complex setter
465 float mCameraDistance;
John Reckacb6f072014-03-12 16:11:23 -0700466 SkMatrix* mStaticMatrix;
467 SkMatrix* mAnimationMatrix;
John Reckacb6f072014-03-12 16:11:23 -0700468
John Reckd0a0b2a2014-03-20 16:28:56 -0700469 /**
470 * These fields are all generated from other properties and are not set directly.
471 */
472 struct ComputedFields {
473 ComputedFields();
474 ~ComputedFields();
475
476 /**
477 * Stores the total transformation of the DisplayList based upon its scalar
478 * translate/rotate/scale properties.
479 *
480 * In the common translation-only case, the matrix isn't allocated and the mTranslation
481 * properties are used directly.
482 */
483 Matrix4* mTransformMatrix;
484 Sk3DView* mTransformCamera;
485 SkMatrix* mTransformMatrix3D;
486 } mComputedFields;
John Reckacb6f072014-03-12 16:11:23 -0700487};
488
489} /* namespace uirenderer */
490} /* namespace android */
491
Chris Craikb49f4462014-03-20 12:44:20 -0700492#endif /* RENDERNODEPROPERTIES_H */