blob: 8fc2dd05135169b545b45338d8235e409a8e433d [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 Craik8c271ca2014-03-25 10:33:01 -070025#include <SkRegion.h>
Chris Craikb49f4462014-03-20 12:44:20 -070026
27#include "Rect.h"
Chris Craik8c271ca2014-03-25 10:33:01 -070028#include "RevealClip.h"
Chris Craikb49f4462014-03-20 12:44:20 -070029#include "Outline.h"
John Reckacb6f072014-03-12 16:11:23 -070030
John Reckacb6f072014-03-12 16:11:23 -070031class SkBitmap;
32class SkPaint;
John Reckacb6f072014-03-12 16:11:23 -070033
34namespace android {
35namespace uirenderer {
36
37class Matrix4;
38class RenderNode;
39
40/*
41 * Data structure that holds the properties for a RenderNode
42 */
43class RenderProperties {
44public:
45 RenderProperties();
46 virtual ~RenderProperties();
47
John Reckd0a0b2a2014-03-20 16:28:56 -070048 RenderProperties& operator=(const RenderProperties& other);
49
John Reckacb6f072014-03-12 16:11:23 -070050 void setClipToBounds(bool clipToBounds) {
John Reckd0a0b2a2014-03-20 16:28:56 -070051 mPrimitiveFields.mClipToBounds = clipToBounds;
John Reckacb6f072014-03-12 16:11:23 -070052 }
53
John Reckacb6f072014-03-12 16:11:23 -070054 void setProjectBackwards(bool shouldProject) {
John Reckd0a0b2a2014-03-20 16:28:56 -070055 mPrimitiveFields.mProjectBackwards = shouldProject;
John Reckacb6f072014-03-12 16:11:23 -070056 }
57
58 void setProjectionReceiver(bool shouldRecieve) {
John Reckd0a0b2a2014-03-20 16:28:56 -070059 mPrimitiveFields.mProjectionReceiver = shouldRecieve;
John Reckacb6f072014-03-12 16:11:23 -070060 }
61
John Reckd0a0b2a2014-03-20 16:28:56 -070062 bool isProjectionReceiver() const {
63 return mPrimitiveFields.mProjectionReceiver;
John Reckacb6f072014-03-12 16:11:23 -070064 }
65
John Reckd0a0b2a2014-03-20 16:28:56 -070066 void setStaticMatrix(const SkMatrix* matrix) {
John Reckacb6f072014-03-12 16:11:23 -070067 delete mStaticMatrix;
John Reckd0a0b2a2014-03-20 16:28:56 -070068 if (matrix) {
69 mStaticMatrix = new SkMatrix(*matrix);
70 } else {
71 mStaticMatrix = NULL;
72 }
John Reckacb6f072014-03-12 16:11:23 -070073 }
74
75 // Can return NULL
John Reckd0a0b2a2014-03-20 16:28:56 -070076 const SkMatrix* getStaticMatrix() const {
John Reckacb6f072014-03-12 16:11:23 -070077 return mStaticMatrix;
78 }
79
John Reckd0a0b2a2014-03-20 16:28:56 -070080 void setAnimationMatrix(const SkMatrix* matrix) {
John Reckacb6f072014-03-12 16:11:23 -070081 delete mAnimationMatrix;
82 if (matrix) {
83 mAnimationMatrix = new SkMatrix(*matrix);
84 } else {
85 mAnimationMatrix = NULL;
86 }
87 }
88
89 void setAlpha(float alpha) {
90 alpha = fminf(1.0f, fmaxf(0.0f, alpha));
John Reckd0a0b2a2014-03-20 16:28:56 -070091 if (alpha != mPrimitiveFields.mAlpha) {
92 mPrimitiveFields.mAlpha = alpha;
John Reckacb6f072014-03-12 16:11:23 -070093 }
94 }
95
96 float getAlpha() const {
John Reckd0a0b2a2014-03-20 16:28:56 -070097 return mPrimitiveFields.mAlpha;
John Reckacb6f072014-03-12 16:11:23 -070098 }
99
100 void setHasOverlappingRendering(bool hasOverlappingRendering) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700101 mPrimitiveFields.mHasOverlappingRendering = hasOverlappingRendering;
John Reckacb6f072014-03-12 16:11:23 -0700102 }
103
104 bool hasOverlappingRendering() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700105 return mPrimitiveFields.mHasOverlappingRendering;
John Reckacb6f072014-03-12 16:11:23 -0700106 }
107
Chris Craikcc39e162014-04-25 18:34:11 -0700108 void setElevation(float elevation) {
109 if (elevation != mPrimitiveFields.mElevation) {
110 mPrimitiveFields.mElevation = elevation;
111 // mMatrixOrPivotDirty not set, since matrix doesn't respect Z
112 }
113 }
114
115 float getElevation() const {
116 return mPrimitiveFields.mElevation;
117 }
118
John Reckacb6f072014-03-12 16:11:23 -0700119 void setTranslationX(float translationX) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700120 if (translationX != mPrimitiveFields.mTranslationX) {
121 mPrimitiveFields.mTranslationX = translationX;
John Reckf7483e32014-04-11 08:54:47 -0700122 mPrimitiveFields.mMatrixOrPivotDirty = true;
John Reckacb6f072014-03-12 16:11:23 -0700123 }
124 }
125
126 float getTranslationX() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700127 return mPrimitiveFields.mTranslationX;
John Reckacb6f072014-03-12 16:11:23 -0700128 }
129
130 void setTranslationY(float translationY) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700131 if (translationY != mPrimitiveFields.mTranslationY) {
132 mPrimitiveFields.mTranslationY = translationY;
John Reckf7483e32014-04-11 08:54:47 -0700133 mPrimitiveFields.mMatrixOrPivotDirty = true;
John Reckacb6f072014-03-12 16:11:23 -0700134 }
135 }
136
137 float getTranslationY() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700138 return mPrimitiveFields.mTranslationY;
John Reckacb6f072014-03-12 16:11:23 -0700139 }
140
141 void setTranslationZ(float translationZ) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700142 if (translationZ != mPrimitiveFields.mTranslationZ) {
143 mPrimitiveFields.mTranslationZ = translationZ;
Chris Craikcc39e162014-04-25 18:34:11 -0700144 // mMatrixOrPivotDirty not set, since matrix doesn't respect Z
John Reckacb6f072014-03-12 16:11:23 -0700145 }
146 }
147
148 float getTranslationZ() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700149 return mPrimitiveFields.mTranslationZ;
John Reckacb6f072014-03-12 16:11:23 -0700150 }
151
Chris Craikcc39e162014-04-25 18:34:11 -0700152 float getZ() const {
153 return getElevation() + getTranslationZ();
154 }
155
John Reckacb6f072014-03-12 16:11:23 -0700156 void setRotation(float rotation) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700157 if (rotation != mPrimitiveFields.mRotation) {
158 mPrimitiveFields.mRotation = rotation;
John Reckf7483e32014-04-11 08:54:47 -0700159 mPrimitiveFields.mMatrixOrPivotDirty = true;
John Reckacb6f072014-03-12 16:11:23 -0700160 }
161 }
162
163 float getRotation() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700164 return mPrimitiveFields.mRotation;
John Reckacb6f072014-03-12 16:11:23 -0700165 }
166
167 void setRotationX(float rotationX) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700168 if (rotationX != mPrimitiveFields.mRotationX) {
169 mPrimitiveFields.mRotationX = rotationX;
John Reckf7483e32014-04-11 08:54:47 -0700170 mPrimitiveFields.mMatrixOrPivotDirty = true;
John Reckacb6f072014-03-12 16:11:23 -0700171 }
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;
John Reckf7483e32014-04-11 08:54:47 -0700181 mPrimitiveFields.mMatrixOrPivotDirty = true;
John Reckacb6f072014-03-12 16:11:23 -0700182 }
183 }
184
185 float getRotationY() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700186 return mPrimitiveFields.mRotationY;
John Reckacb6f072014-03-12 16:11:23 -0700187 }
188
189 void setScaleX(float scaleX) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700190 if (scaleX != mPrimitiveFields.mScaleX) {
191 mPrimitiveFields.mScaleX = scaleX;
John Reckf7483e32014-04-11 08:54:47 -0700192 mPrimitiveFields.mMatrixOrPivotDirty = true;
John Reckacb6f072014-03-12 16:11:23 -0700193 }
194 }
195
196 float getScaleX() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700197 return mPrimitiveFields.mScaleX;
John Reckacb6f072014-03-12 16:11:23 -0700198 }
199
200 void setScaleY(float scaleY) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700201 if (scaleY != mPrimitiveFields.mScaleY) {
202 mPrimitiveFields.mScaleY = scaleY;
John Reckf7483e32014-04-11 08:54:47 -0700203 mPrimitiveFields.mMatrixOrPivotDirty = true;
John Reckacb6f072014-03-12 16:11:23 -0700204 }
205 }
206
207 float getScaleY() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700208 return mPrimitiveFields.mScaleY;
John Reckacb6f072014-03-12 16:11:23 -0700209 }
210
211 void setPivotX(float pivotX) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700212 mPrimitiveFields.mPivotX = pivotX;
John Reckf7483e32014-04-11 08:54:47 -0700213 mPrimitiveFields.mMatrixOrPivotDirty = true;
John Reckd0a0b2a2014-03-20 16:28:56 -0700214 mPrimitiveFields.mPivotExplicitlySet = true;
John Reckacb6f072014-03-12 16:11:23 -0700215 }
216
John Reckd0a0b2a2014-03-20 16:28:56 -0700217 /* Note that getPivotX and getPivotY are adjusted by updateMatrix(),
218 * so the value returned mPrimitiveFields.may be stale if the RenderProperties has been
219 * mPrimitiveFields.modified since the last call to updateMatrix()
220 */
221 float getPivotX() const {
222 return mPrimitiveFields.mPivotX;
223 }
John Reckacb6f072014-03-12 16:11:23 -0700224
225 void setPivotY(float pivotY) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700226 mPrimitiveFields.mPivotY = pivotY;
John Reckf7483e32014-04-11 08:54:47 -0700227 mPrimitiveFields.mMatrixOrPivotDirty = true;
John Reckd0a0b2a2014-03-20 16:28:56 -0700228 mPrimitiveFields.mPivotExplicitlySet = true;
John Reckacb6f072014-03-12 16:11:23 -0700229 }
230
John Reckd0a0b2a2014-03-20 16:28:56 -0700231 float getPivotY() const {
232 return mPrimitiveFields.mPivotY;
233 }
John Reckacb6f072014-03-12 16:11:23 -0700234
Chris Craik49e6c732014-03-31 12:34:11 -0700235 bool isPivotExplicitlySet() const {
236 return mPrimitiveFields.mPivotExplicitlySet;
237 }
238
John Reckacb6f072014-03-12 16:11:23 -0700239 void setCameraDistance(float distance) {
Chris Craik49e6c732014-03-31 12:34:11 -0700240 if (distance != getCameraDistance()) {
John Reckf7483e32014-04-11 08:54:47 -0700241 mPrimitiveFields.mMatrixOrPivotDirty = true;
Chris Craik49e6c732014-03-31 12:34:11 -0700242 mComputedFields.mTransformCamera.setCameraLocation(0, 0, distance);
John Reckacb6f072014-03-12 16:11:23 -0700243 }
244 }
245
246 float getCameraDistance() const {
Chris Craik49e6c732014-03-31 12:34:11 -0700247 // TODO: update getCameraLocationZ() to be const
248 return const_cast<Sk3DView*>(&mComputedFields.mTransformCamera)->getCameraLocationZ();
John Reckacb6f072014-03-12 16:11:23 -0700249 }
250
251 void setLeft(int left) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700252 if (left != mPrimitiveFields.mLeft) {
253 mPrimitiveFields.mLeft = left;
254 mPrimitiveFields.mWidth = mPrimitiveFields.mRight - mPrimitiveFields.mLeft;
John Reckf7483e32014-04-11 08:54:47 -0700255 if (!mPrimitiveFields.mPivotExplicitlySet) {
256 mPrimitiveFields.mMatrixOrPivotDirty = true;
John Reckacb6f072014-03-12 16:11:23 -0700257 }
258 }
259 }
260
261 float getLeft() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700262 return mPrimitiveFields.mLeft;
John Reckacb6f072014-03-12 16:11:23 -0700263 }
264
265 void setTop(int top) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700266 if (top != mPrimitiveFields.mTop) {
267 mPrimitiveFields.mTop = top;
268 mPrimitiveFields.mHeight = mPrimitiveFields.mBottom - mPrimitiveFields.mTop;
John Reckf7483e32014-04-11 08:54:47 -0700269 if (!mPrimitiveFields.mPivotExplicitlySet) {
270 mPrimitiveFields.mMatrixOrPivotDirty = true;
John Reckacb6f072014-03-12 16:11:23 -0700271 }
272 }
273 }
274
275 float getTop() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700276 return mPrimitiveFields.mTop;
John Reckacb6f072014-03-12 16:11:23 -0700277 }
278
279 void setRight(int right) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700280 if (right != mPrimitiveFields.mRight) {
281 mPrimitiveFields.mRight = right;
282 mPrimitiveFields.mWidth = mPrimitiveFields.mRight - mPrimitiveFields.mLeft;
John Reckf7483e32014-04-11 08:54:47 -0700283 if (!mPrimitiveFields.mPivotExplicitlySet) {
284 mPrimitiveFields.mMatrixOrPivotDirty = true;
John Reckacb6f072014-03-12 16:11:23 -0700285 }
286 }
287 }
288
289 float getRight() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700290 return mPrimitiveFields.mRight;
John Reckacb6f072014-03-12 16:11:23 -0700291 }
292
293 void setBottom(int bottom) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700294 if (bottom != mPrimitiveFields.mBottom) {
295 mPrimitiveFields.mBottom = bottom;
296 mPrimitiveFields.mHeight = mPrimitiveFields.mBottom - mPrimitiveFields.mTop;
John Reckf7483e32014-04-11 08:54:47 -0700297 if (!mPrimitiveFields.mPivotExplicitlySet) {
298 mPrimitiveFields.mMatrixOrPivotDirty = true;
John Reckacb6f072014-03-12 16:11:23 -0700299 }
300 }
301 }
302
303 float getBottom() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700304 return mPrimitiveFields.mBottom;
John Reckacb6f072014-03-12 16:11:23 -0700305 }
306
307 void setLeftTop(int left, int top) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700308 if (left != mPrimitiveFields.mLeft || top != mPrimitiveFields.mTop) {
309 mPrimitiveFields.mLeft = left;
310 mPrimitiveFields.mTop = top;
311 mPrimitiveFields.mWidth = mPrimitiveFields.mRight - mPrimitiveFields.mLeft;
312 mPrimitiveFields.mHeight = mPrimitiveFields.mBottom - mPrimitiveFields.mTop;
John Reckf7483e32014-04-11 08:54:47 -0700313 if (!mPrimitiveFields.mPivotExplicitlySet) {
314 mPrimitiveFields.mMatrixOrPivotDirty = true;
John Reckacb6f072014-03-12 16:11:23 -0700315 }
316 }
317 }
318
319 void setLeftTopRightBottom(int left, int top, int right, int bottom) {
Chris Craikcc39e162014-04-25 18:34:11 -0700320 if (left != mPrimitiveFields.mLeft || top != mPrimitiveFields.mTop
321 || right != mPrimitiveFields.mRight || bottom != mPrimitiveFields.mBottom) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700322 mPrimitiveFields.mLeft = left;
323 mPrimitiveFields.mTop = top;
324 mPrimitiveFields.mRight = right;
325 mPrimitiveFields.mBottom = bottom;
326 mPrimitiveFields.mWidth = mPrimitiveFields.mRight - mPrimitiveFields.mLeft;
327 mPrimitiveFields.mHeight = mPrimitiveFields.mBottom - mPrimitiveFields.mTop;
John Reckf7483e32014-04-11 08:54:47 -0700328 if (!mPrimitiveFields.mPivotExplicitlySet) {
329 mPrimitiveFields.mMatrixOrPivotDirty = true;
John Reckacb6f072014-03-12 16:11:23 -0700330 }
331 }
332 }
333
334 void offsetLeftRight(float offset) {
335 if (offset != 0) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700336 mPrimitiveFields.mLeft += offset;
337 mPrimitiveFields.mRight += offset;
John Reckf7483e32014-04-11 08:54:47 -0700338 if (!mPrimitiveFields.mPivotExplicitlySet) {
339 mPrimitiveFields.mMatrixOrPivotDirty = true;
John Reckacb6f072014-03-12 16:11:23 -0700340 }
341 }
342 }
343
344 void offsetTopBottom(float offset) {
345 if (offset != 0) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700346 mPrimitiveFields.mTop += offset;
347 mPrimitiveFields.mBottom += offset;
John Reckf7483e32014-04-11 08:54:47 -0700348 if (!mPrimitiveFields.mPivotExplicitlySet) {
349 mPrimitiveFields.mMatrixOrPivotDirty = true;
John Reckacb6f072014-03-12 16:11:23 -0700350 }
351 }
352 }
353
354 void setCaching(bool caching) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700355 mPrimitiveFields.mCaching = caching;
John Reckacb6f072014-03-12 16:11:23 -0700356 }
357
Chris Craikb49f4462014-03-20 12:44:20 -0700358 int getWidth() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700359 return mPrimitiveFields.mWidth;
John Reckacb6f072014-03-12 16:11:23 -0700360 }
361
Chris Craikb49f4462014-03-20 12:44:20 -0700362 int getHeight() const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700363 return mPrimitiveFields.mHeight;
John Reckacb6f072014-03-12 16:11:23 -0700364 }
365
John Reckd0a0b2a2014-03-20 16:28:56 -0700366 const SkMatrix* getAnimationMatrix() const {
367 return mAnimationMatrix;
368 }
369
John Reckf7483e32014-04-11 08:54:47 -0700370 bool hasTransformMatrix() const {
371 return getTransformMatrix() && !getTransformMatrix()->isIdentity();
372 }
373
374 // May only call this if hasTransformMatrix() is true
375 bool isTransformTranslateOnly() const {
376 return getTransformMatrix()->getType() == SkMatrix::kTranslate_Mask;
John Reckd0a0b2a2014-03-20 16:28:56 -0700377 }
378
Chris Craik49e6c732014-03-31 12:34:11 -0700379 const SkMatrix* getTransformMatrix() const {
John Reckf7483e32014-04-11 08:54:47 -0700380 LOG_ALWAYS_FATAL_IF(mPrimitiveFields.mMatrixOrPivotDirty, "Cannot get a dirty matrix!");
John Reckd0a0b2a2014-03-20 16:28:56 -0700381 return mComputedFields.mTransformMatrix;
382 }
383
384 bool getCaching() const {
385 return mPrimitiveFields.mCaching;
386 }
387
388 bool getClipToBounds() const {
389 return mPrimitiveFields.mClipToBounds;
390 }
391
392 bool getHasOverlappingRendering() const {
393 return mPrimitiveFields.mHasOverlappingRendering;
394 }
395
396 const Outline& getOutline() const {
397 return mPrimitiveFields.mOutline;
398 }
399
Chris Craik8c271ca2014-03-25 10:33:01 -0700400 const RevealClip& getRevealClip() const {
401 return mPrimitiveFields.mRevealClip;
402 }
403
John Reckd0a0b2a2014-03-20 16:28:56 -0700404 bool getProjectBackwards() const {
405 return mPrimitiveFields.mProjectBackwards;
406 }
407
408 void debugOutputProperties(const int level) const;
409
410 ANDROID_API void updateMatrix();
411
Chris Craik8c271ca2014-03-25 10:33:01 -0700412 ANDROID_API void updateClipPath();
413
414 // signals that mComputedFields.mClipPath is up to date, and should be used for clipping
415 bool hasClippingPath() const {
416 return mPrimitiveFields.mOutline.willClip() || mPrimitiveFields.mRevealClip.willClip();
417 }
418
419 const SkPath* getClippingPath() const {
420 return hasClippingPath() ? mComputedFields.mClipPath : NULL;
421 }
422
423 SkRegion::Op getClippingPathOp() const {
424 return mComputedFields.mClipPathOp;
425 }
426
John Reckd0a0b2a2014-03-20 16:28:56 -0700427 Outline& mutableOutline() {
428 return mPrimitiveFields.mOutline;
Chris Craikb49f4462014-03-20 12:44:20 -0700429 }
430
Chris Craik8c271ca2014-03-25 10:33:01 -0700431 RevealClip& mutableRevealClip() {
432 return mPrimitiveFields.mRevealClip;
433 }
434
John Reckacb6f072014-03-12 16:11:23 -0700435private:
John Reckacb6f072014-03-12 16:11:23 -0700436
John Reckacb6f072014-03-12 16:11:23 -0700437 // Rendering properties
John Reckd0a0b2a2014-03-20 16:28:56 -0700438 struct PrimitiveFields {
439 PrimitiveFields();
John Reckacb6f072014-03-12 16:11:23 -0700440
John Reckd0a0b2a2014-03-20 16:28:56 -0700441 Outline mOutline;
Chris Craik8c271ca2014-03-25 10:33:01 -0700442 RevealClip mRevealClip;
John Reckd0a0b2a2014-03-20 16:28:56 -0700443 bool mClipToBounds;
444 bool mProjectBackwards;
445 bool mProjectionReceiver;
446 float mAlpha;
447 bool mHasOverlappingRendering;
Chris Craikcc39e162014-04-25 18:34:11 -0700448 float mElevation;
John Reckd0a0b2a2014-03-20 16:28:56 -0700449 float mTranslationX, mTranslationY, mTranslationZ;
450 float mRotation, mRotationX, mRotationY;
451 float mScaleX, mScaleY;
452 float mPivotX, mPivotY;
453 int mLeft, mTop, mRight, mBottom;
454 int mWidth, mHeight;
John Reckd0a0b2a2014-03-20 16:28:56 -0700455 bool mPivotExplicitlySet;
John Reckf7483e32014-04-11 08:54:47 -0700456 bool mMatrixOrPivotDirty;
John Reckd0a0b2a2014-03-20 16:28:56 -0700457 bool mCaching;
458 } mPrimitiveFields;
459
460 // mCameraDistance isn't in mPrimitiveFields as it has a complex setter
John Reckacb6f072014-03-12 16:11:23 -0700461 SkMatrix* mStaticMatrix;
462 SkMatrix* mAnimationMatrix;
John Reckacb6f072014-03-12 16:11:23 -0700463
John Reckd0a0b2a2014-03-20 16:28:56 -0700464 /**
465 * These fields are all generated from other properties and are not set directly.
466 */
467 struct ComputedFields {
468 ComputedFields();
469 ~ComputedFields();
470
471 /**
472 * Stores the total transformation of the DisplayList based upon its scalar
473 * translate/rotate/scale properties.
474 *
Chris Craik49e6c732014-03-31 12:34:11 -0700475 * In the common translation-only case, the matrix isn't necessarily allocated,
476 * and the mTranslation properties are used directly.
John Reckd0a0b2a2014-03-20 16:28:56 -0700477 */
Chris Craik49e6c732014-03-31 12:34:11 -0700478 SkMatrix* mTransformMatrix;
479
480 Sk3DView mTransformCamera;
Chris Craik8c271ca2014-03-25 10:33:01 -0700481 SkPath* mClipPath; // TODO: remove this, create new ops for efficient/special case clipping
482 SkRegion::Op mClipPathOp;
John Reckd0a0b2a2014-03-20 16:28:56 -0700483 } mComputedFields;
John Reckacb6f072014-03-12 16:11:23 -0700484};
485
486} /* namespace uirenderer */
487} /* namespace android */
488
Chris Craikb49f4462014-03-20 12:44:20 -0700489#endif /* RENDERNODEPROPERTIES_H */