RenderNode.h revision 25fbb3fa1138675379102a44405852555cefccbd
1113e0824d6bddf4376240681f9cf6a2deded9498John Reck/*
2113e0824d6bddf4376240681f9cf6a2deded9498John Reck * Copyright (C) 2014 The Android Open Source Project
3113e0824d6bddf4376240681f9cf6a2deded9498John Reck *
4113e0824d6bddf4376240681f9cf6a2deded9498John Reck * Licensed under the Apache License, Version 2.0 (the "License");
5113e0824d6bddf4376240681f9cf6a2deded9498John Reck * you may not use this file except in compliance with the License.
6113e0824d6bddf4376240681f9cf6a2deded9498John Reck * You may obtain a copy of the License at
7113e0824d6bddf4376240681f9cf6a2deded9498John Reck *
8113e0824d6bddf4376240681f9cf6a2deded9498John Reck *      http://www.apache.org/licenses/LICENSE-2.0
9113e0824d6bddf4376240681f9cf6a2deded9498John Reck *
10113e0824d6bddf4376240681f9cf6a2deded9498John Reck * Unless required by applicable law or agreed to in writing, software
11113e0824d6bddf4376240681f9cf6a2deded9498John Reck * distributed under the License is distributed on an "AS IS" BASIS,
12113e0824d6bddf4376240681f9cf6a2deded9498John Reck * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13113e0824d6bddf4376240681f9cf6a2deded9498John Reck * See the License for the specific language governing permissions and
14113e0824d6bddf4376240681f9cf6a2deded9498John Reck * limitations under the License.
15113e0824d6bddf4376240681f9cf6a2deded9498John Reck */
16113e0824d6bddf4376240681f9cf6a2deded9498John Reck#ifndef RENDERNODE_H
17113e0824d6bddf4376240681f9cf6a2deded9498John Reck#define RENDERNODE_H
18113e0824d6bddf4376240681f9cf6a2deded9498John Reck
19113e0824d6bddf4376240681f9cf6a2deded9498John Reck#ifndef LOG_TAG
20113e0824d6bddf4376240681f9cf6a2deded9498John Reck    #define LOG_TAG "OpenGLRenderer"
21113e0824d6bddf4376240681f9cf6a2deded9498John Reck#endif
22113e0824d6bddf4376240681f9cf6a2deded9498John Reck
23e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck#include <set>
24e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck#include <vector>
25e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck
26113e0824d6bddf4376240681f9cf6a2deded9498John Reck#include <SkCamera.h>
27113e0824d6bddf4376240681f9cf6a2deded9498John Reck#include <SkMatrix.h>
28113e0824d6bddf4376240681f9cf6a2deded9498John Reck
29113e0824d6bddf4376240681f9cf6a2deded9498John Reck#include <private/hwui/DrawGlInfo.h>
30113e0824d6bddf4376240681f9cf6a2deded9498John Reck
31113e0824d6bddf4376240681f9cf6a2deded9498John Reck#include <utils/KeyedVector.h>
32113e0824d6bddf4376240681f9cf6a2deded9498John Reck#include <utils/LinearAllocator.h>
33113e0824d6bddf4376240681f9cf6a2deded9498John Reck#include <utils/RefBase.h>
34113e0824d6bddf4376240681f9cf6a2deded9498John Reck#include <utils/SortedVector.h>
35113e0824d6bddf4376240681f9cf6a2deded9498John Reck#include <utils/String8.h>
36113e0824d6bddf4376240681f9cf6a2deded9498John Reck#include <utils/Vector.h>
37113e0824d6bddf4376240681f9cf6a2deded9498John Reck
38113e0824d6bddf4376240681f9cf6a2deded9498John Reck#include <cutils/compiler.h>
39113e0824d6bddf4376240681f9cf6a2deded9498John Reck
40113e0824d6bddf4376240681f9cf6a2deded9498John Reck#include <androidfw/ResourceTypes.h>
41113e0824d6bddf4376240681f9cf6a2deded9498John Reck
42a447d29c65fb811cd184775a3476101a1cede929John Reck#include "DamageAccumulator.h"
43113e0824d6bddf4376240681f9cf6a2deded9498John Reck#include "Debug.h"
44113e0824d6bddf4376240681f9cf6a2deded9498John Reck#include "Matrix.h"
45113e0824d6bddf4376240681f9cf6a2deded9498John Reck#include "DeferredDisplayList.h"
46113e0824d6bddf4376240681f9cf6a2deded9498John Reck#include "DisplayList.h"
47113e0824d6bddf4376240681f9cf6a2deded9498John Reck#include "RenderProperties.h"
48e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck#include "TreeInfo.h"
49113e0824d6bddf4376240681f9cf6a2deded9498John Reck
50113e0824d6bddf4376240681f9cf6a2deded9498John Reckclass SkBitmap;
51113e0824d6bddf4376240681f9cf6a2deded9498John Reckclass SkPaint;
52113e0824d6bddf4376240681f9cf6a2deded9498John Reckclass SkPath;
53113e0824d6bddf4376240681f9cf6a2deded9498John Reckclass SkRegion;
54113e0824d6bddf4376240681f9cf6a2deded9498John Reck
55113e0824d6bddf4376240681f9cf6a2deded9498John Recknamespace android {
56113e0824d6bddf4376240681f9cf6a2deded9498John Recknamespace uirenderer {
57113e0824d6bddf4376240681f9cf6a2deded9498John Reck
58113e0824d6bddf4376240681f9cf6a2deded9498John Reckclass DeferredDisplayList;
59113e0824d6bddf4376240681f9cf6a2deded9498John Reckclass DisplayListOp;
60113e0824d6bddf4376240681f9cf6a2deded9498John Reckclass DisplayListRenderer;
61113e0824d6bddf4376240681f9cf6a2deded9498John Reckclass OpenGLRenderer;
62113e0824d6bddf4376240681f9cf6a2deded9498John Reckclass Rect;
63113e0824d6bddf4376240681f9cf6a2deded9498John Reckclass Layer;
64113e0824d6bddf4376240681f9cf6a2deded9498John Reckclass SkiaShader;
65113e0824d6bddf4376240681f9cf6a2deded9498John Reck
66113e0824d6bddf4376240681f9cf6a2deded9498John Reckclass ClipRectOp;
67113e0824d6bddf4376240681f9cf6a2deded9498John Reckclass SaveLayerOp;
68113e0824d6bddf4376240681f9cf6a2deded9498John Reckclass SaveOp;
69113e0824d6bddf4376240681f9cf6a2deded9498John Reckclass RestoreToCountOp;
70113e0824d6bddf4376240681f9cf6a2deded9498John Reckclass DrawDisplayListOp;
71113e0824d6bddf4376240681f9cf6a2deded9498John Reck
72113e0824d6bddf4376240681f9cf6a2deded9498John Reck/**
73113e0824d6bddf4376240681f9cf6a2deded9498John Reck * Primary class for storing recorded canvas commands, as well as per-View/ViewGroup display properties.
74113e0824d6bddf4376240681f9cf6a2deded9498John Reck *
75113e0824d6bddf4376240681f9cf6a2deded9498John Reck * Recording of canvas commands is somewhat similar to SkPicture, except the canvas-recording
76113e0824d6bddf4376240681f9cf6a2deded9498John Reck * functionality is split between DisplayListRenderer (which manages the recording), DisplayListData
77113e0824d6bddf4376240681f9cf6a2deded9498John Reck * (which holds the actual data), and DisplayList (which holds properties and performs playback onto
78113e0824d6bddf4376240681f9cf6a2deded9498John Reck * a renderer).
79113e0824d6bddf4376240681f9cf6a2deded9498John Reck *
80113e0824d6bddf4376240681f9cf6a2deded9498John Reck * Note that DisplayListData is swapped out from beneath an individual DisplayList when a view's
81113e0824d6bddf4376240681f9cf6a2deded9498John Reck * recorded stream of canvas operations is refreshed. The DisplayList (and its properties) stay
82113e0824d6bddf4376240681f9cf6a2deded9498John Reck * attached.
83113e0824d6bddf4376240681f9cf6a2deded9498John Reck */
84087bc0c14bdccf7c258dce0cdef46a69a839b427John Reckclass RenderNode : public VirtualLightRefBase {
85113e0824d6bddf4376240681f9cf6a2deded9498John Reckpublic:
86ff941dcd815021bb20d6504eb486acb1e50592c3John Reck    enum DirtyPropertyMask {
87ff941dcd815021bb20d6504eb486acb1e50592c3John Reck        GENERIC         = 1 << 1,
88ff941dcd815021bb20d6504eb486acb1e50592c3John Reck        TRANSLATION_X   = 1 << 2,
89ff941dcd815021bb20d6504eb486acb1e50592c3John Reck        TRANSLATION_Y   = 1 << 3,
90ff941dcd815021bb20d6504eb486acb1e50592c3John Reck        TRANSLATION_Z   = 1 << 4,
91ff941dcd815021bb20d6504eb486acb1e50592c3John Reck        SCALE_X         = 1 << 5,
92ff941dcd815021bb20d6504eb486acb1e50592c3John Reck        SCALE_Y         = 1 << 6,
93ff941dcd815021bb20d6504eb486acb1e50592c3John Reck        ROTATION        = 1 << 7,
94ff941dcd815021bb20d6504eb486acb1e50592c3John Reck        ROTATION_X      = 1 << 8,
95ff941dcd815021bb20d6504eb486acb1e50592c3John Reck        ROTATION_Y      = 1 << 9,
96ff941dcd815021bb20d6504eb486acb1e50592c3John Reck        X               = 1 << 10,
97ff941dcd815021bb20d6504eb486acb1e50592c3John Reck        Y               = 1 << 11,
98ff941dcd815021bb20d6504eb486acb1e50592c3John Reck        Z               = 1 << 12,
99ff941dcd815021bb20d6504eb486acb1e50592c3John Reck        ALPHA           = 1 << 13,
100ff941dcd815021bb20d6504eb486acb1e50592c3John Reck    };
101ff941dcd815021bb20d6504eb486acb1e50592c3John Reck
102113e0824d6bddf4376240681f9cf6a2deded9498John Reck    ANDROID_API RenderNode();
103e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    ANDROID_API virtual ~RenderNode();
104113e0824d6bddf4376240681f9cf6a2deded9498John Reck
105113e0824d6bddf4376240681f9cf6a2deded9498John Reck    // See flags defined in DisplayList.java
106113e0824d6bddf4376240681f9cf6a2deded9498John Reck    enum ReplayFlag {
107113e0824d6bddf4376240681f9cf6a2deded9498John Reck        kReplayFlag_ClipChildren = 0x1
108113e0824d6bddf4376240681f9cf6a2deded9498John Reck    };
109113e0824d6bddf4376240681f9cf6a2deded9498John Reck
110113e0824d6bddf4376240681f9cf6a2deded9498John Reck    ANDROID_API static void outputLogBuffer(int fd);
111113e0824d6bddf4376240681f9cf6a2deded9498John Reck
1128de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck    ANDROID_API void setStagingDisplayList(DisplayListData* newData);
113113e0824d6bddf4376240681f9cf6a2deded9498John Reck
114113e0824d6bddf4376240681f9cf6a2deded9498John Reck    void computeOrdering();
115b265e2ca50b6ceb2fd2987ef1f7d063b1bde19aeChris Craik
116b265e2ca50b6ceb2fd2987ef1f7d063b1bde19aeChris Craik    void deferNodeTree(DeferStateStruct& deferStruct);
117b265e2ca50b6ceb2fd2987ef1f7d063b1bde19aeChris Craik    void deferNodeInParent(DeferStateStruct& deferStruct, const int level);
118b265e2ca50b6ceb2fd2987ef1f7d063b1bde19aeChris Craik
119b265e2ca50b6ceb2fd2987ef1f7d063b1bde19aeChris Craik    void replayNodeTree(ReplayStateStruct& replayStruct);
120b265e2ca50b6ceb2fd2987ef1f7d063b1bde19aeChris Craik    void replayNodeInParent(ReplayStateStruct& replayStruct, const int level);
121113e0824d6bddf4376240681f9cf6a2deded9498John Reck
122113e0824d6bddf4376240681f9cf6a2deded9498John Reck    ANDROID_API void output(uint32_t level = 1);
123fe5e7b7346a54537b980796ceeca66bfdbd05561John Reck    ANDROID_API int getDebugSize();
124113e0824d6bddf4376240681f9cf6a2deded9498John Reck
125113e0824d6bddf4376240681f9cf6a2deded9498John Reck    bool isRenderable() const {
126113e0824d6bddf4376240681f9cf6a2deded9498John Reck        return mDisplayListData && mDisplayListData->hasDrawOps;
127113e0824d6bddf4376240681f9cf6a2deded9498John Reck    }
128113e0824d6bddf4376240681f9cf6a2deded9498John Reck
129a447d29c65fb811cd184775a3476101a1cede929John Reck    bool hasProjectionReceiver() const {
130a447d29c65fb811cd184775a3476101a1cede929John Reck        return mDisplayListData && mDisplayListData->projectionReceiveIndex >= 0;
131a447d29c65fb811cd184775a3476101a1cede929John Reck    }
132a447d29c65fb811cd184775a3476101a1cede929John Reck
133defb7f37fe67ef2389666f7adc5da1260df87017Chris Craik    const char* getName() const {
134defb7f37fe67ef2389666f7adc5da1260df87017Chris Craik        return mName.string();
135defb7f37fe67ef2389666f7adc5da1260df87017Chris Craik    }
136defb7f37fe67ef2389666f7adc5da1260df87017Chris Craik
137113e0824d6bddf4376240681f9cf6a2deded9498John Reck    void setName(const char* name) {
138113e0824d6bddf4376240681f9cf6a2deded9498John Reck        if (name) {
139113e0824d6bddf4376240681f9cf6a2deded9498John Reck            char* lastPeriod = strrchr(name, '.');
140113e0824d6bddf4376240681f9cf6a2deded9498John Reck            if (lastPeriod) {
141113e0824d6bddf4376240681f9cf6a2deded9498John Reck                mName.setTo(lastPeriod + 1);
142113e0824d6bddf4376240681f9cf6a2deded9498John Reck            } else {
143113e0824d6bddf4376240681f9cf6a2deded9498John Reck                mName.setTo(name);
144113e0824d6bddf4376240681f9cf6a2deded9498John Reck            }
145113e0824d6bddf4376240681f9cf6a2deded9498John Reck        }
146113e0824d6bddf4376240681f9cf6a2deded9498John Reck    }
147113e0824d6bddf4376240681f9cf6a2deded9498John Reck
148ff941dcd815021bb20d6504eb486acb1e50592c3John Reck    bool isPropertyFieldDirty(DirtyPropertyMask field) const {
149ff941dcd815021bb20d6504eb486acb1e50592c3John Reck        return mDirtyPropertyFields & field;
150ff941dcd815021bb20d6504eb486acb1e50592c3John Reck    }
151ff941dcd815021bb20d6504eb486acb1e50592c3John Reck
152ff941dcd815021bb20d6504eb486acb1e50592c3John Reck    void setPropertyFieldsDirty(uint32_t fields) {
153ff941dcd815021bb20d6504eb486acb1e50592c3John Reck        mDirtyPropertyFields |= fields;
154ff941dcd815021bb20d6504eb486acb1e50592c3John Reck    }
155ff941dcd815021bb20d6504eb486acb1e50592c3John Reck
156e4267ea4f20740c37c01bfb6aefcf61fddc4566aJohn Reck    const RenderProperties& properties() const {
157113e0824d6bddf4376240681f9cf6a2deded9498John Reck        return mProperties;
158113e0824d6bddf4376240681f9cf6a2deded9498John Reck    }
159113e0824d6bddf4376240681f9cf6a2deded9498John Reck
16052244fff29042926e21fa897ef5ab11148e35299John Reck    RenderProperties& animatorProperties() {
16152244fff29042926e21fa897ef5ab11148e35299John Reck        return mProperties;
16252244fff29042926e21fa897ef5ab11148e35299John Reck    }
16352244fff29042926e21fa897ef5ab11148e35299John Reck
164d0a0b2a3140bfb1819a116413ce9d81886697a07John Reck    const RenderProperties& stagingProperties() {
165d0a0b2a3140bfb1819a116413ce9d81886697a07John Reck        return mStagingProperties;
166d0a0b2a3140bfb1819a116413ce9d81886697a07John Reck    }
167d0a0b2a3140bfb1819a116413ce9d81886697a07John Reck
168d0a0b2a3140bfb1819a116413ce9d81886697a07John Reck    RenderProperties& mutateStagingProperties() {
169d0a0b2a3140bfb1819a116413ce9d81886697a07John Reck        return mStagingProperties;
170d0a0b2a3140bfb1819a116413ce9d81886697a07John Reck    }
171d0a0b2a3140bfb1819a116413ce9d81886697a07John Reck
172113e0824d6bddf4376240681f9cf6a2deded9498John Reck    int getWidth() {
173113e0824d6bddf4376240681f9cf6a2deded9498John Reck        return properties().getWidth();
174113e0824d6bddf4376240681f9cf6a2deded9498John Reck    }
175113e0824d6bddf4376240681f9cf6a2deded9498John Reck
176113e0824d6bddf4376240681f9cf6a2deded9498John Reck    int getHeight() {
177113e0824d6bddf4376240681f9cf6a2deded9498John Reck        return properties().getHeight();
178113e0824d6bddf4376240681f9cf6a2deded9498John Reck    }
179113e0824d6bddf4376240681f9cf6a2deded9498John Reck
180e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    ANDROID_API virtual void prepareTree(TreeInfo& info);
181e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck
182e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    // UI thread only!
18352244fff29042926e21fa897ef5ab11148e35299John Reck    ANDROID_API void addAnimator(const sp<BaseRenderNodeAnimator>& animator) {
184ff941dcd815021bb20d6504eb486acb1e50592c3John Reck        animator->onAttached(this);
185e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck        mStagingAnimators.insert(animator);
186e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck        mNeedsAnimatorsSync = true;
187e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    }
188e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck
189e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    // UI thread only!
19052244fff29042926e21fa897ef5ab11148e35299John Reck    ANDROID_API void removeAnimator(const sp<BaseRenderNodeAnimator>& animator) {
191e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck        mStagingAnimators.erase(animator);
192e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck        mNeedsAnimatorsSync = true;
193e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    }
194668f0e38ef0277d55d3118af37e17b8c435df85cJohn Reck
195e4267ea4f20740c37c01bfb6aefcf61fddc4566aJohn Reckprotected:
196e4267ea4f20740c37c01bfb6aefcf61fddc4566aJohn Reck    virtual void damageSelf(TreeInfo& info);
197e4267ea4f20740c37c01bfb6aefcf61fddc4566aJohn Reck
198113e0824d6bddf4376240681f9cf6a2deded9498John Reckprivate:
199113e0824d6bddf4376240681f9cf6a2deded9498John Reck    typedef key_value_pair_t<float, DrawDisplayListOp*> ZDrawDisplayListOpPair;
200113e0824d6bddf4376240681f9cf6a2deded9498John Reck
201113e0824d6bddf4376240681f9cf6a2deded9498John Reck    static size_t findNonNegativeIndex(const Vector<ZDrawDisplayListOpPair>& nodes) {
202113e0824d6bddf4376240681f9cf6a2deded9498John Reck        for (size_t i = 0; i < nodes.size(); i++) {
203113e0824d6bddf4376240681f9cf6a2deded9498John Reck            if (nodes[i].key >= 0.0f) return i;
204113e0824d6bddf4376240681f9cf6a2deded9498John Reck        }
205113e0824d6bddf4376240681f9cf6a2deded9498John Reck        return nodes.size();
206113e0824d6bddf4376240681f9cf6a2deded9498John Reck    }
207113e0824d6bddf4376240681f9cf6a2deded9498John Reck
208113e0824d6bddf4376240681f9cf6a2deded9498John Reck    enum ChildrenSelectMode {
209113e0824d6bddf4376240681f9cf6a2deded9498John Reck        kNegativeZChildren,
210113e0824d6bddf4376240681f9cf6a2deded9498John Reck        kPositiveZChildren
211113e0824d6bddf4376240681f9cf6a2deded9498John Reck    };
212113e0824d6bddf4376240681f9cf6a2deded9498John Reck
213113e0824d6bddf4376240681f9cf6a2deded9498John Reck    void applyViewPropertyTransforms(mat4& matrix, bool true3dTransform = false);
214113e0824d6bddf4376240681f9cf6a2deded9498John Reck
215113e0824d6bddf4376240681f9cf6a2deded9498John Reck    void computeOrderingImpl(DrawDisplayListOp* opState,
2163f085429fd47ebd32ac2463b3eae2a5a6c17be25Chris Craik            const SkPath* outlineOfProjectionSurface,
217113e0824d6bddf4376240681f9cf6a2deded9498John Reck            Vector<DrawDisplayListOp*>* compositedChildrenOfProjectionSurface,
218113e0824d6bddf4376240681f9cf6a2deded9498John Reck            const mat4* transformFromProjectionSurface);
219113e0824d6bddf4376240681f9cf6a2deded9498John Reck
220113e0824d6bddf4376240681f9cf6a2deded9498John Reck    template <class T>
221b265e2ca50b6ceb2fd2987ef1f7d063b1bde19aeChris Craik    inline void setViewProperties(OpenGLRenderer& renderer, T& handler);
222113e0824d6bddf4376240681f9cf6a2deded9498John Reck
223113e0824d6bddf4376240681f9cf6a2deded9498John Reck    void buildZSortedChildList(Vector<ZDrawDisplayListOpPair>& zTranslatedNodes);
224113e0824d6bddf4376240681f9cf6a2deded9498John Reck
225b265e2ca50b6ceb2fd2987ef1f7d063b1bde19aeChris Craik    template<class T>
226b265e2ca50b6ceb2fd2987ef1f7d063b1bde19aeChris Craik    inline void issueDrawShadowOperation(const Matrix4& transformFromParent, T& handler);
227b265e2ca50b6ceb2fd2987ef1f7d063b1bde19aeChris Craik
228113e0824d6bddf4376240681f9cf6a2deded9498John Reck    template <class T>
229b265e2ca50b6ceb2fd2987ef1f7d063b1bde19aeChris Craik    inline void issueOperationsOf3dChildren(const Vector<ZDrawDisplayListOpPair>& zTranslatedNodes,
230113e0824d6bddf4376240681f9cf6a2deded9498John Reck            ChildrenSelectMode mode, OpenGLRenderer& renderer, T& handler);
231113e0824d6bddf4376240681f9cf6a2deded9498John Reck
232113e0824d6bddf4376240681f9cf6a2deded9498John Reck    template <class T>
233b265e2ca50b6ceb2fd2987ef1f7d063b1bde19aeChris Craik    inline void issueOperationsOfProjectedChildren(OpenGLRenderer& renderer, T& handler);
234113e0824d6bddf4376240681f9cf6a2deded9498John Reck
235b265e2ca50b6ceb2fd2987ef1f7d063b1bde19aeChris Craik    /**
236b265e2ca50b6ceb2fd2987ef1f7d063b1bde19aeChris Craik     * Issue the RenderNode's operations into a handler, recursing for subtrees through
237b265e2ca50b6ceb2fd2987ef1f7d063b1bde19aeChris Craik     * DrawDisplayListOp's defer() or replay() methods
238b265e2ca50b6ceb2fd2987ef1f7d063b1bde19aeChris Craik     */
239113e0824d6bddf4376240681f9cf6a2deded9498John Reck    template <class T>
240b265e2ca50b6ceb2fd2987ef1f7d063b1bde19aeChris Craik    inline void issueOperations(OpenGLRenderer& renderer, T& handler);
241113e0824d6bddf4376240681f9cf6a2deded9498John Reck
242113e0824d6bddf4376240681f9cf6a2deded9498John Reck    class TextContainer {
243113e0824d6bddf4376240681f9cf6a2deded9498John Reck    public:
244113e0824d6bddf4376240681f9cf6a2deded9498John Reck        size_t length() const {
245113e0824d6bddf4376240681f9cf6a2deded9498John Reck            return mByteLength;
246113e0824d6bddf4376240681f9cf6a2deded9498John Reck        }
247113e0824d6bddf4376240681f9cf6a2deded9498John Reck
248113e0824d6bddf4376240681f9cf6a2deded9498John Reck        const char* text() const {
249113e0824d6bddf4376240681f9cf6a2deded9498John Reck            return (const char*) mText;
250113e0824d6bddf4376240681f9cf6a2deded9498John Reck        }
251113e0824d6bddf4376240681f9cf6a2deded9498John Reck
252113e0824d6bddf4376240681f9cf6a2deded9498John Reck        size_t mByteLength;
253113e0824d6bddf4376240681f9cf6a2deded9498John Reck        const char* mText;
254113e0824d6bddf4376240681f9cf6a2deded9498John Reck    };
255113e0824d6bddf4376240681f9cf6a2deded9498John Reck
256f4198b713e43c0c0f9adac74203cf24c2a49b802John Reck    void prepareTreeImpl(TreeInfo& info);
25725fbb3fa1138675379102a44405852555cefccbdJohn Reck    void pushStagingPropertiesChanges(TreeInfo& info);
25825fbb3fa1138675379102a44405852555cefccbdJohn Reck    void pushStagingDisplayListChanges(TreeInfo& info);
259e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    void evaluateAnimations(TreeInfo& info);
260f4198b713e43c0c0f9adac74203cf24c2a49b802John Reck    void prepareSubTree(TreeInfo& info, DisplayListData* subtree);
26125fbb3fa1138675379102a44405852555cefccbdJohn Reck    void applyLayerPropertiesToLayer(TreeInfo& info);
26225fbb3fa1138675379102a44405852555cefccbdJohn Reck    void prepareLayer(TreeInfo& info);
26325fbb3fa1138675379102a44405852555cefccbdJohn Reck    void pushLayerUpdate(TreeInfo& info);
2648de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck
265113e0824d6bddf4376240681f9cf6a2deded9498John Reck    String8 mName;
266113e0824d6bddf4376240681f9cf6a2deded9498John Reck
267ff941dcd815021bb20d6504eb486acb1e50592c3John Reck    uint32_t mDirtyPropertyFields;
268113e0824d6bddf4376240681f9cf6a2deded9498John Reck    RenderProperties mProperties;
269d0a0b2a3140bfb1819a116413ce9d81886697a07John Reck    RenderProperties mStagingProperties;
270d0a0b2a3140bfb1819a116413ce9d81886697a07John Reck
2718de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck    bool mNeedsDisplayListDataSync;
272113e0824d6bddf4376240681f9cf6a2deded9498John Reck    DisplayListData* mDisplayListData;
2738de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck    DisplayListData* mStagingDisplayListData;
274113e0824d6bddf4376240681f9cf6a2deded9498John Reck
275e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    bool mNeedsAnimatorsSync;
27652244fff29042926e21fa897ef5ab11148e35299John Reck    std::set< sp<BaseRenderNodeAnimator> > mStagingAnimators;
27752244fff29042926e21fa897ef5ab11148e35299John Reck    std::vector< sp<BaseRenderNodeAnimator> > mAnimators;
278e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck
27925fbb3fa1138675379102a44405852555cefccbdJohn Reck    // Owned by RT. Lifecycle is managed by prepareTree(), with the exception
28025fbb3fa1138675379102a44405852555cefccbdJohn Reck    // being in ~RenderNode() which may happen on any thread.
28125fbb3fa1138675379102a44405852555cefccbdJohn Reck    Layer* mLayer;
28225fbb3fa1138675379102a44405852555cefccbdJohn Reck
283113e0824d6bddf4376240681f9cf6a2deded9498John Reck    /**
284113e0824d6bddf4376240681f9cf6a2deded9498John Reck     * Draw time state - these properties are only set and used during rendering
285113e0824d6bddf4376240681f9cf6a2deded9498John Reck     */
286113e0824d6bddf4376240681f9cf6a2deded9498John Reck
287113e0824d6bddf4376240681f9cf6a2deded9498John Reck    // for projection surfaces, contains a list of all children items
288113e0824d6bddf4376240681f9cf6a2deded9498John Reck    Vector<DrawDisplayListOp*> mProjectedNodes;
289113e0824d6bddf4376240681f9cf6a2deded9498John Reck}; // class RenderNode
290113e0824d6bddf4376240681f9cf6a2deded9498John Reck
291113e0824d6bddf4376240681f9cf6a2deded9498John Reck} /* namespace uirenderer */
292113e0824d6bddf4376240681f9cf6a2deded9498John Reck} /* namespace android */
293113e0824d6bddf4376240681f9cf6a2deded9498John Reck
294113e0824d6bddf4376240681f9cf6a2deded9498John Reck#endif /* RENDERNODE_H */
295