blob: 3c14212449969f1cf70cb8eac7a3e57cb0aef703 [file] [log] [blame]
Romain Guy4aa90572010-09-26 18:40:37 -07001/*
2 * Copyright (C) 2010 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 */
16
Romain Guy5b3b3522010-10-27 18:57:51 -070017#ifndef ANDROID_HWUI_DISPLAY_LIST_RENDERER_H
18#define ANDROID_HWUI_DISPLAY_LIST_RENDERER_H
Romain Guy4aa90572010-09-26 18:40:37 -070019
Romain Guy4aa90572010-09-26 18:40:37 -070020#include <SkMatrix.h>
21#include <SkPaint.h>
22#include <SkPath.h>
Romain Guy79537452011-10-12 13:48:51 -070023#include <cutils/compiler.h>
24
Chris Craik0776a602013-02-14 15:36:01 -080025#include "DisplayList.h"
Chet Haase9c1e23b2011-03-24 10:51:31 -070026#include "DisplayListLogBuffer.h"
Romain Guy4aa90572010-09-26 18:40:37 -070027#include "OpenGLRenderer.h"
28
29namespace android {
30namespace uirenderer {
31
32///////////////////////////////////////////////////////////////////////////////
33// Defines
34///////////////////////////////////////////////////////////////////////////////
35
Romain Guy6d7475d2011-07-27 16:28:21 -070036#define MIN_WRITER_SIZE 4096
Romain Guy33f6beb2012-02-16 19:24:51 -080037#define OP_MAY_BE_SKIPPED_MASK 0xff000000
Romain Guy4aa90572010-09-26 18:40:37 -070038
Romain Guyffac7fc2011-01-13 17:21:49 -080039// Debug
40#if DEBUG_DISPLAY_LIST
Steve Block5baa3a62011-12-20 16:23:08 +000041 #define DISPLAY_LIST_LOGD(...) ALOGD(__VA_ARGS__)
Romain Guyffac7fc2011-01-13 17:21:49 -080042#else
43 #define DISPLAY_LIST_LOGD(...)
44#endif
45
Romain Guy4aa90572010-09-26 18:40:37 -070046///////////////////////////////////////////////////////////////////////////////
Romain Guyb051e892010-09-28 19:09:36 -070047// Display list
Romain Guy4aa90572010-09-26 18:40:37 -070048///////////////////////////////////////////////////////////////////////////////
49
Chris Craikc3566d02013-02-04 16:16:33 -080050class DeferredDisplayList;
Romain Guyb051e892010-09-28 19:09:36 -070051class DisplayListRenderer;
Chris Craik2af46352012-11-26 18:30:17 -080052class DisplayListOp;
53class DrawOp;
54class StateOp;
55
Romain Guyb051e892010-09-28 19:09:36 -070056/**
Chris Craikd6b65f62014-01-01 14:45:21 -080057 * Records drawing commands in a display list for later playback into an OpenGLRenderer.
Romain Guyb051e892010-09-28 19:09:36 -070058 */
59class DisplayListRenderer: public OpenGLRenderer {
60public:
Romain Guy79537452011-10-12 13:48:51 -070061 ANDROID_API DisplayListRenderer();
62 virtual ~DisplayListRenderer();
Romain Guyb051e892010-09-28 19:09:36 -070063
Romain Guy79537452011-10-12 13:48:51 -070064 ANDROID_API DisplayList* getDisplayList(DisplayList* displayList);
Chet Haase5977baa2011-01-05 18:01:22 -080065
Chris Craik406af022014-01-02 14:56:40 -080066 virtual bool isRecording() const { return true; }
Romain Guy49c5fc02012-05-15 11:10:01 -070067
Chris Craik14e51302013-12-30 15:32:54 -080068// ----------------------------------------------------------------------------
69// Frame state operations
70// ----------------------------------------------------------------------------
Romain Guy79537452011-10-12 13:48:51 -070071 virtual void setViewport(int width, int height);
Romain Guy7c25aab2012-10-18 15:05:02 -070072 virtual status_t prepareDirty(float left, float top, float right, float bottom, bool opaque);
Romain Guy79537452011-10-12 13:48:51 -070073 virtual void finish();
Romain Guy79537452011-10-12 13:48:51 -070074 virtual void interrupt();
75 virtual void resume();
Chet Haasedaf98e92011-01-10 14:10:36 -080076
Chris Craik14e51302013-12-30 15:32:54 -080077// ----------------------------------------------------------------------------
78// Canvas state operations
79// ----------------------------------------------------------------------------
80 // Save (layer)
Romain Guy79537452011-10-12 13:48:51 -070081 virtual int save(int flags);
82 virtual void restore();
83 virtual void restoreToCount(int saveCount);
Romain Guy79537452011-10-12 13:48:51 -070084 virtual int saveLayer(float left, float top, float right, float bottom,
Derek Sollenbergerd44fbe52014-02-05 16:47:00 -050085 const SkPaint* paint, int flags);
Romain Guy4aa90572010-09-26 18:40:37 -070086
Chris Craik14e51302013-12-30 15:32:54 -080087 // Matrix
Chris Craikb4589422013-12-26 15:13:13 -080088 virtual void translate(float dx, float dy, float dz);
Romain Guy79537452011-10-12 13:48:51 -070089 virtual void rotate(float degrees);
90 virtual void scale(float sx, float sy);
91 virtual void skew(float sx, float sy);
Romain Guy4aa90572010-09-26 18:40:37 -070092
Chris Craikd218a922014-01-02 17:13:34 -080093 virtual void setMatrix(const SkMatrix* matrix);
94 virtual void concatMatrix(const SkMatrix* matrix);
Romain Guy4aa90572010-09-26 18:40:37 -070095
Chris Craik14e51302013-12-30 15:32:54 -080096 // Clip
Romain Guy79537452011-10-12 13:48:51 -070097 virtual bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op);
Chris Craikd218a922014-01-02 17:13:34 -080098 virtual bool clipPath(const SkPath* path, SkRegion::Op op);
99 virtual bool clipRegion(const SkRegion* region, SkRegion::Op op);
Romain Guy4aa90572010-09-26 18:40:37 -0700100
Chris Craik14e51302013-12-30 15:32:54 -0800101 // Misc - should be implemented with SkPaint inspection
Romain Guy79537452011-10-12 13:48:51 -0700102 virtual void resetShader();
103 virtual void setupShader(SkiaShader* shader);
Romain Guy4aa90572010-09-26 18:40:37 -0700104
Romain Guy79537452011-10-12 13:48:51 -0700105 virtual void resetColorFilter();
106 virtual void setupColorFilter(SkiaColorFilter* filter);
Romain Guy4aa90572010-09-26 18:40:37 -0700107
Romain Guy79537452011-10-12 13:48:51 -0700108 virtual void resetShadow();
109 virtual void setupShadow(float radius, float dx, float dy, int color);
Romain Guy4aa90572010-09-26 18:40:37 -0700110
Romain Guy5ff9df62012-01-23 17:09:05 -0800111 virtual void resetPaintFilter();
112 virtual void setupPaintFilter(int clearBits, int setBits);
113
Chris Craik14e51302013-12-30 15:32:54 -0800114// ----------------------------------------------------------------------------
115// Canvas draw operations
116// ----------------------------------------------------------------------------
117 virtual status_t drawColor(int color, SkXfermode::Mode mode);
118
119 // Bitmap-based
Chris Craikd218a922014-01-02 17:13:34 -0800120 virtual status_t drawBitmap(const SkBitmap* bitmap, float left, float top,
121 const SkPaint* paint);
122 virtual status_t drawBitmap(const SkBitmap* bitmap, const SkMatrix* matrix,
123 const SkPaint* paint);
124 virtual status_t drawBitmap(const SkBitmap* bitmap, float srcLeft, float srcTop,
Chris Craik14e51302013-12-30 15:32:54 -0800125 float srcRight, float srcBottom, float dstLeft, float dstTop,
Chris Craikd218a922014-01-02 17:13:34 -0800126 float dstRight, float dstBottom, const SkPaint* paint);
127 virtual status_t drawBitmapData(const SkBitmap* bitmap, float left, float top,
128 const SkPaint* paint);
129 virtual status_t drawBitmapMesh(const SkBitmap* bitmap, int meshWidth, int meshHeight,
130 const float* vertices, const int* colors, const SkPaint* paint);
131 virtual status_t drawPatch(const SkBitmap* bitmap, const Res_png_9patch* patch,
132 float left, float top, float right, float bottom, const SkPaint* paint);
Chris Craik14e51302013-12-30 15:32:54 -0800133
134 // Shapes
Chris Craikd218a922014-01-02 17:13:34 -0800135 virtual status_t drawRect(float left, float top, float right, float bottom,
136 const SkPaint* paint);
137 virtual status_t drawRects(const float* rects, int count, const SkPaint* paint);
Chris Craik14e51302013-12-30 15:32:54 -0800138 virtual status_t drawRoundRect(float left, float top, float right, float bottom,
Chris Craikd218a922014-01-02 17:13:34 -0800139 float rx, float ry, const SkPaint* paint);
140 virtual status_t drawCircle(float x, float y, float radius, const SkPaint* paint);
141 virtual status_t drawOval(float left, float top, float right, float bottom,
142 const SkPaint* paint);
Chris Craik14e51302013-12-30 15:32:54 -0800143 virtual status_t drawArc(float left, float top, float right, float bottom,
Chris Craikd218a922014-01-02 17:13:34 -0800144 float startAngle, float sweepAngle, bool useCenter, const SkPaint* paint);
145 virtual status_t drawPath(const SkPath* path, const SkPaint* paint);
146 virtual status_t drawLines(const float* points, int count, const SkPaint* paint);
147 virtual status_t drawPoints(const float* points, int count, const SkPaint* paint);
Chris Craik14e51302013-12-30 15:32:54 -0800148
149 // Text
150 virtual status_t drawText(const char* text, int bytesCount, int count, float x, float y,
Chris Craikd218a922014-01-02 17:13:34 -0800151 const float* positions, const SkPaint* paint, float totalAdvance, const Rect& bounds,
Chris Craik14e51302013-12-30 15:32:54 -0800152 DrawOpMode drawOpMode = kDrawOpMode_Immediate);
Chris Craikd218a922014-01-02 17:13:34 -0800153 virtual status_t drawTextOnPath(const char* text, int bytesCount, int count, const SkPath* path,
154 float hOffset, float vOffset, const SkPaint* paint);
Chris Craik14e51302013-12-30 15:32:54 -0800155 virtual status_t drawPosText(const char* text, int bytesCount, int count,
Chris Craikd218a922014-01-02 17:13:34 -0800156 const float* positions, const SkPaint* paint);
Chris Craik14e51302013-12-30 15:32:54 -0800157
158// ----------------------------------------------------------------------------
159// Canvas draw operations - special
160// ----------------------------------------------------------------------------
161 virtual status_t drawLayer(Layer* layer, float x, float y);
162 virtual status_t drawDisplayList(DisplayList* displayList, Rect& dirty,
163 int32_t replayFlags);
164
165 // TODO: rename for consistency
166 virtual status_t callDrawGLFunction(Functor* functor, Rect& dirty);
167
168// ----------------------------------------------------------------------------
169// DisplayList / resource management
170// ----------------------------------------------------------------------------
Romain Guy79537452011-10-12 13:48:51 -0700171 ANDROID_API void reset();
Romain Guy4aa90572010-09-26 18:40:37 -0700172
Chris Craik2af46352012-11-26 18:30:17 -0800173 sp<DisplayListData> getDisplayListData() const {
174 return mDisplayListData;
Romain Guyb051e892010-09-28 19:09:36 -0700175 }
176
Chris Craikd218a922014-01-02 17:13:34 -0800177 const Vector<const SkBitmap*>& getBitmapResources() const {
Chet Haase5c13d892010-10-08 08:37:55 -0700178 return mBitmapResources;
Romain Guyb051e892010-09-28 19:09:36 -0700179 }
180
Chris Craikd218a922014-01-02 17:13:34 -0800181 const Vector<const SkBitmap*>& getOwnedBitmapResources() const {
Romain Guy49c5fc02012-05-15 11:10:01 -0700182 return mOwnedBitmapResources;
183 }
184
Romain Guyd586ad92011-06-22 16:14:36 -0700185 const Vector<SkiaColorFilter*>& getFilterResources() const {
186 return mFilterResources;
187 }
188
Chris Craikd218a922014-01-02 17:13:34 -0800189 const Vector<const Res_png_9patch*>& getPatchResources() const {
Romain Guye3b0a012013-06-26 15:45:41 -0700190 return mPatchResources;
191 }
192
Romain Guy24c00212011-01-14 15:31:00 -0800193 const Vector<SkiaShader*>& getShaders() const {
194 return mShaders;
Romain Guyb051e892010-09-28 19:09:36 -0700195 }
196
Chris Craikd218a922014-01-02 17:13:34 -0800197 const Vector<const SkPaint*>& getPaints() const {
Chet Haased98aa2d2010-10-25 15:47:32 -0700198 return mPaints;
199 }
200
Chris Craikd218a922014-01-02 17:13:34 -0800201 const Vector<const SkPath*>& getPaths() const {
Romain Guy2fc941e2011-02-03 15:06:05 -0800202 return mPaths;
203 }
204
Chris Craikd218a922014-01-02 17:13:34 -0800205 const SortedVector<const SkPath*>& getSourcePaths() const {
Chet Haased34dd712012-05-02 18:50:34 -0700206 return mSourcePaths;
207 }
208
Chris Craikd218a922014-01-02 17:13:34 -0800209 const Vector<const SkRegion*>& getRegions() const {
Romain Guy735738c2012-12-03 12:34:51 -0800210 return mRegions;
211 }
212
Chet Haase603f6de2012-09-14 15:31:25 -0700213 const Vector<Layer*>& getLayers() const {
214 return mLayers;
215 }
216
Chris Craikd218a922014-01-02 17:13:34 -0800217 const Vector<const SkMatrix*>& getMatrices() const {
Chet Haased98aa2d2010-10-25 15:47:32 -0700218 return mMatrices;
219 }
220
Romain Guy54c1a642012-09-27 17:55:46 -0700221 uint32_t getFunctorCount() const {
222 return mFunctorCount;
223 }
224
Romain Guy4aa90572010-09-26 18:40:37 -0700225private:
Chris Craik2af46352012-11-26 18:30:17 -0800226 void insertRestoreToCount();
227 void insertTranslate();
Romain Guy27454a42011-01-23 12:01:41 -0800228
Chris Craik2af46352012-11-26 18:30:17 -0800229 LinearAllocator& alloc() { return mDisplayListData->allocator; }
230 void addStateOp(StateOp* op);
Romain Guy0f667532013-03-01 14:31:04 -0800231 void addDrawOp(DrawOp* op);
Chris Craik2af46352012-11-26 18:30:17 -0800232 void addOpInternal(DisplayListOp* op) {
Romain Guy27454a42011-01-23 12:01:41 -0800233 insertRestoreToCount();
Chris Craik2af46352012-11-26 18:30:17 -0800234 insertTranslate();
235 mDisplayListData->displayListOps.add(op);
Romain Guy4aa90572010-09-26 18:40:37 -0700236 }
237
Chris Craik2af46352012-11-26 18:30:17 -0800238 template<class T>
Chris Craikd218a922014-01-02 17:13:34 -0800239 inline const T* refBuffer(const T* srcBuffer, int32_t count) {
240 if (!srcBuffer) return NULL;
241
Chris Craik2af46352012-11-26 18:30:17 -0800242 T* dstBuffer = (T*) mDisplayListData->allocator.alloc(count * sizeof(T));
243 memcpy(dstBuffer, srcBuffer, count * sizeof(T));
244 return dstBuffer;
Romain Guy33f6beb2012-02-16 19:24:51 -0800245 }
246
Chris Craik2af46352012-11-26 18:30:17 -0800247 inline char* refText(const char* text, size_t byteLength) {
248 return (char*) refBuffer<uint8_t>((uint8_t*)text, byteLength);
Romain Guy33f6beb2012-02-16 19:24:51 -0800249 }
250
Chris Craikd218a922014-01-02 17:13:34 -0800251 inline const SkPath* refPath(const SkPath* path) {
Chris Craik2af46352012-11-26 18:30:17 -0800252 if (!path) return NULL;
Romain Guy2fc941e2011-02-03 15:06:05 -0800253
Chris Craikd218a922014-01-02 17:13:34 -0800254 const SkPath* pathCopy = mPathMap.valueFor(path);
Romain Guy2fc941e2011-02-03 15:06:05 -0800255 if (pathCopy == NULL || pathCopy->getGenerationID() != path->getGenerationID()) {
Chris Craikd218a922014-01-02 17:13:34 -0800256 SkPath* newPathCopy = new SkPath(*path);
257 newPathCopy->setSourcePath(path);
258
259 pathCopy = newPathCopy;
Romain Guy96ebc6b2012-02-21 18:32:32 -0800260 // replaceValueFor() performs an add if the entry doesn't exist
261 mPathMap.replaceValueFor(path, pathCopy);
Romain Guyb29cfbf2011-03-18 16:24:19 -0700262 mPaths.add(pathCopy);
Romain Guy2fc941e2011-02-03 15:06:05 -0800263 }
Chet Haased34dd712012-05-02 18:50:34 -0700264 if (mSourcePaths.indexOf(path) < 0) {
Romain Guy58ecc202012-09-07 11:58:36 -0700265 mCaches.resourceCache.incrementRefcount(path);
Chet Haased34dd712012-05-02 18:50:34 -0700266 mSourcePaths.add(path);
267 }
Chris Craik2af46352012-11-26 18:30:17 -0800268 return pathCopy;
Romain Guy4aa90572010-09-26 18:40:37 -0700269 }
270
Chris Craikd218a922014-01-02 17:13:34 -0800271 inline const SkPaint* refPaint(const SkPaint* paint) {
Romain Guy24c00212011-01-14 15:31:00 -0800272 if (!paint) {
Chet Haasee816bae2012-08-09 13:39:02 -0700273 return paint;
Chet Haased98aa2d2010-10-25 15:47:32 -0700274 }
Romain Guy0fe478e2010-11-08 12:08:41 -0800275
Chris Craikd218a922014-01-02 17:13:34 -0800276 const SkPaint* paintCopy = mPaintMap.valueFor(paint);
Chet Haased98aa2d2010-10-25 15:47:32 -0700277 if (paintCopy == NULL || paintCopy->getGenerationID() != paint->getGenerationID()) {
278 paintCopy = new SkPaint(*paint);
Romain Guy96ebc6b2012-02-21 18:32:32 -0800279 // replaceValueFor() performs an add if the entry doesn't exist
280 mPaintMap.replaceValueFor(paint, paintCopy);
Chet Haased98aa2d2010-10-25 15:47:32 -0700281 mPaints.add(paintCopy);
282 }
Romain Guy0fe478e2010-11-08 12:08:41 -0800283
Chet Haasee816bae2012-08-09 13:39:02 -0700284 return paintCopy;
Romain Guy0fe478e2010-11-08 12:08:41 -0800285 }
286
Chris Craikd218a922014-01-02 17:13:34 -0800287 inline const SkRegion* refRegion(const SkRegion* region) {
Romain Guy735738c2012-12-03 12:34:51 -0800288 if (!region) {
Romain Guy735738c2012-12-03 12:34:51 -0800289 return region;
290 }
291
Chris Craikd218a922014-01-02 17:13:34 -0800292 const SkRegion* regionCopy = mRegionMap.valueFor(region);
Romain Guy735738c2012-12-03 12:34:51 -0800293 // TODO: Add generation ID to SkRegion
294 if (regionCopy == NULL) {
295 regionCopy = new SkRegion(*region);
296 // replaceValueFor() performs an add if the entry doesn't exist
297 mRegionMap.replaceValueFor(region, regionCopy);
298 mRegions.add(regionCopy);
299 }
300
Romain Guy735738c2012-12-03 12:34:51 -0800301 return regionCopy;
302 }
303
Chris Craikd218a922014-01-02 17:13:34 -0800304 inline const SkMatrix* refMatrix(const SkMatrix* matrix) {
Romain Guy4e7b7722013-07-16 13:47:01 -0700305 if (matrix) {
306 // Copying the matrix is cheap and prevents against the user changing
307 // the original matrix before the operation that uses it
Chris Craikd218a922014-01-02 17:13:34 -0800308 const SkMatrix* copy = new SkMatrix(*matrix);
Romain Guy4e7b7722013-07-16 13:47:01 -0700309 mMatrices.add(copy);
310 return copy;
311 }
312 return matrix;
Romain Guy4aa90572010-09-26 18:40:37 -0700313 }
314
Romain Guyce4a7df2013-03-28 11:32:33 -0700315 inline Layer* refLayer(Layer* layer) {
316 mLayers.add(layer);
317 mCaches.resourceCache.incrementRefcount(layer);
318 return layer;
319 }
320
Chris Craikd218a922014-01-02 17:13:34 -0800321 inline const SkBitmap* refBitmap(const SkBitmap* bitmap) {
Chet Haased98aa2d2010-10-25 15:47:32 -0700322 // Note that this assumes the bitmap is immutable. There are cases this won't handle
323 // correctly, such as creating the bitmap from scratch, drawing with it, changing its
324 // contents, and drawing again. The only fix would be to always copy it the first time,
325 // which doesn't seem worth the extra cycles for this unlikely case.
Chet Haase5c13d892010-10-08 08:37:55 -0700326 mBitmapResources.add(bitmap);
Romain Guy58ecc202012-09-07 11:58:36 -0700327 mCaches.resourceCache.incrementRefcount(bitmap);
Chris Craik2af46352012-11-26 18:30:17 -0800328 return bitmap;
Chet Haase5c13d892010-10-08 08:37:55 -0700329 }
Romain Guy4aa90572010-09-26 18:40:37 -0700330
Chris Craikd218a922014-01-02 17:13:34 -0800331 inline const SkBitmap* refBitmapData(const SkBitmap* bitmap) {
Romain Guy49c5fc02012-05-15 11:10:01 -0700332 mOwnedBitmapResources.add(bitmap);
Romain Guy58ecc202012-09-07 11:58:36 -0700333 mCaches.resourceCache.incrementRefcount(bitmap);
Chris Craik2af46352012-11-26 18:30:17 -0800334 return bitmap;
Romain Guy49c5fc02012-05-15 11:10:01 -0700335 }
336
Chris Craik2af46352012-11-26 18:30:17 -0800337 inline SkiaShader* refShader(SkiaShader* shader) {
338 if (!shader) return NULL;
Romain Guy24c00212011-01-14 15:31:00 -0800339
340 SkiaShader* shaderCopy = mShaderMap.valueFor(shader);
341 // TODO: We also need to handle generation ID changes in compose shaders
Romain Guy1f1fcb72011-01-14 15:37:54 -0800342 if (shaderCopy == NULL || shaderCopy->getGenerationId() != shader->getGenerationId()) {
Romain Guy24c00212011-01-14 15:31:00 -0800343 shaderCopy = shader->copy();
Romain Guy96ebc6b2012-02-21 18:32:32 -0800344 // replaceValueFor() performs an add if the entry doesn't exist
345 mShaderMap.replaceValueFor(shader, shaderCopy);
Romain Guy1f1fcb72011-01-14 15:37:54 -0800346 mShaders.add(shaderCopy);
Romain Guy58ecc202012-09-07 11:58:36 -0700347 mCaches.resourceCache.incrementRefcount(shaderCopy);
Romain Guy24c00212011-01-14 15:31:00 -0800348 }
Chris Craik2af46352012-11-26 18:30:17 -0800349 return shaderCopy;
Romain Guy4aa90572010-09-26 18:40:37 -0700350 }
351
Chris Craik2af46352012-11-26 18:30:17 -0800352 inline SkiaColorFilter* refColorFilter(SkiaColorFilter* colorFilter) {
Chet Haasead93c2b2010-10-22 16:17:12 -0700353 mFilterResources.add(colorFilter);
Romain Guy58ecc202012-09-07 11:58:36 -0700354 mCaches.resourceCache.incrementRefcount(colorFilter);
Chris Craik2af46352012-11-26 18:30:17 -0800355 return colorFilter;
Chet Haasead93c2b2010-10-22 16:17:12 -0700356 }
357
Chris Craikd218a922014-01-02 17:13:34 -0800358 inline const Res_png_9patch* refPatch(const Res_png_9patch* patch) {
Romain Guye3b0a012013-06-26 15:45:41 -0700359 mPatchResources.add(patch);
360 mCaches.resourceCache.incrementRefcount(patch);
361 return patch;
362 }
363
Chris Craikf57776b2013-10-25 18:30:17 -0700364 // TODO: move these to DisplayListData
Chris Craikd218a922014-01-02 17:13:34 -0800365 Vector<const SkBitmap*> mBitmapResources;
366 Vector<const SkBitmap*> mOwnedBitmapResources;
Chet Haasead93c2b2010-10-22 16:17:12 -0700367 Vector<SkiaColorFilter*> mFilterResources;
Chris Craikd218a922014-01-02 17:13:34 -0800368 Vector<const Res_png_9patch*> mPatchResources;
Romain Guy4aa90572010-09-26 18:40:37 -0700369
Chris Craikd218a922014-01-02 17:13:34 -0800370 Vector<const SkPaint*> mPaints;
371 DefaultKeyedVector<const SkPaint*, const SkPaint*> mPaintMap;
Romain Guy24c00212011-01-14 15:31:00 -0800372
Chris Craikd218a922014-01-02 17:13:34 -0800373 Vector<const SkPath*> mPaths;
374 DefaultKeyedVector<const SkPath*, const SkPath*> mPathMap;
Romain Guy2fc941e2011-02-03 15:06:05 -0800375
Chris Craikd218a922014-01-02 17:13:34 -0800376 SortedVector<const SkPath*> mSourcePaths;
Chet Haased34dd712012-05-02 18:50:34 -0700377
Chris Craikd218a922014-01-02 17:13:34 -0800378 Vector<const SkRegion*> mRegions;
379 DefaultKeyedVector<const SkRegion*, const SkRegion*> mRegionMap;
Romain Guy735738c2012-12-03 12:34:51 -0800380
Romain Guy24c00212011-01-14 15:31:00 -0800381 Vector<SkiaShader*> mShaders;
382 DefaultKeyedVector<SkiaShader*, SkiaShader*> mShaderMap;
383
Chris Craikd218a922014-01-02 17:13:34 -0800384 Vector<const SkMatrix*> mMatrices;
Chet Haased98aa2d2010-10-25 15:47:32 -0700385
Chet Haase603f6de2012-09-14 15:31:25 -0700386 Vector<Layer*> mLayers;
387
Romain Guy27454a42011-01-23 12:01:41 -0800388 int mRestoreSaveCount;
Romain Guy33f6beb2012-02-16 19:24:51 -0800389
Romain Guy58ecc202012-09-07 11:58:36 -0700390 Caches& mCaches;
Chris Craik2af46352012-11-26 18:30:17 -0800391 sp<DisplayListData> mDisplayListData;
Romain Guy58ecc202012-09-07 11:58:36 -0700392
Romain Guy33f6beb2012-02-16 19:24:51 -0800393 float mTranslateX;
394 float mTranslateY;
395 bool mHasTranslate;
Romain Guy04c9d8c2011-08-25 14:01:48 -0700396 bool mHasDrawOps;
Romain Guy27454a42011-01-23 12:01:41 -0800397
Romain Guy54c1a642012-09-27 17:55:46 -0700398 uint32_t mFunctorCount;
399
Romain Guyb051e892010-09-28 19:09:36 -0700400 friend class DisplayList;
401
Romain Guy4aa90572010-09-26 18:40:37 -0700402}; // class DisplayListRenderer
403
404}; // namespace uirenderer
405}; // namespace android
406
Romain Guy5b3b3522010-10-27 18:57:51 -0700407#endif // ANDROID_HWUI_DISPLAY_LIST_RENDERER_H