blob: dcf2cf2ddb39c4283c3a53e5f34d0819cef5aeca [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
20#include <SkChunkAlloc.h>
21#include <SkFlattenable.h>
22#include <SkMatrix.h>
23#include <SkPaint.h>
24#include <SkPath.h>
Romain Guy4aa90572010-09-26 18:40:37 -070025#include <SkRefCnt.h>
26#include <SkTDArray.h>
27#include <SkTSearch.h>
28
Chet Haase9c1e23b2011-03-24 10:51:31 -070029#include "DisplayListLogBuffer.h"
Romain Guy4aa90572010-09-26 18:40:37 -070030#include "OpenGLRenderer.h"
Romain Guy7d7b5492011-01-24 16:33:45 -080031#include "utils/Functor.h"
Romain Guy4aa90572010-09-26 18:40:37 -070032
33namespace android {
34namespace uirenderer {
35
36///////////////////////////////////////////////////////////////////////////////
37// Defines
38///////////////////////////////////////////////////////////////////////////////
39
40#define MIN_WRITER_SIZE 16384
Romain Guy4aa90572010-09-26 18:40:37 -070041
Romain Guyffac7fc2011-01-13 17:21:49 -080042// Debug
43#if DEBUG_DISPLAY_LIST
44 #define DISPLAY_LIST_LOGD(...) LOGD(__VA_ARGS__)
45#else
46 #define DISPLAY_LIST_LOGD(...)
47#endif
48
Romain Guy4aa90572010-09-26 18:40:37 -070049///////////////////////////////////////////////////////////////////////////////
Romain Guyb051e892010-09-28 19:09:36 -070050// Display list
Romain Guy4aa90572010-09-26 18:40:37 -070051///////////////////////////////////////////////////////////////////////////////
52
Romain Guyb051e892010-09-28 19:09:36 -070053class DisplayListRenderer;
54
Romain Guy4aa90572010-09-26 18:40:37 -070055/**
Romain Guyb051e892010-09-28 19:09:36 -070056 * Replays recorded drawing commands.
Romain Guy4aa90572010-09-26 18:40:37 -070057 */
Romain Guyb051e892010-09-28 19:09:36 -070058class DisplayList {
Romain Guy4aa90572010-09-26 18:40:37 -070059public:
Romain Guyb051e892010-09-28 19:09:36 -070060 DisplayList(const DisplayListRenderer& recorder);
61 ~DisplayList();
Romain Guy4aa90572010-09-26 18:40:37 -070062
Romain Guyffac7fc2011-01-13 17:21:49 -080063 // IMPORTANT: Update the intialization of OP_NAMES in the .cpp file
64 // when modifying this file
Romain Guy4aa90572010-09-26 18:40:37 -070065 enum Op {
Romain Guy2b1847e2011-01-26 13:43:01 -080066 Save = 0,
Romain Guy4aa90572010-09-26 18:40:37 -070067 Restore,
68 RestoreToCount,
69 SaveLayer,
Romain Guy5b3b3522010-10-27 18:57:51 -070070 SaveLayerAlpha,
Romain Guy4aa90572010-09-26 18:40:37 -070071 Translate,
72 Rotate,
73 Scale,
Romain Guy807daf72011-01-18 11:19:19 -080074 Skew,
Romain Guy4aa90572010-09-26 18:40:37 -070075 SetMatrix,
76 ConcatMatrix,
77 ClipRect,
Romain Guy0fe478e2010-11-08 12:08:41 -080078 DrawDisplayList,
Romain Guy6c319ca2011-01-11 14:29:25 -080079 DrawLayer,
Romain Guy4aa90572010-09-26 18:40:37 -070080 DrawBitmap,
81 DrawBitmapMatrix,
82 DrawBitmapRect,
Romain Guy5a7b4662011-01-20 19:09:30 -080083 DrawBitmapMesh,
Romain Guy4aa90572010-09-26 18:40:37 -070084 DrawPatch,
85 DrawColor,
86 DrawRect,
Romain Guy01d58e42011-01-19 21:54:02 -080087 DrawRoundRect,
88 DrawCircle,
Romain Guyc1cd9ba32011-01-23 14:18:41 -080089 DrawOval,
Romain Guy8b2f5262011-01-23 16:15:02 -080090 DrawArc,
Romain Guy4aa90572010-09-26 18:40:37 -070091 DrawPath,
92 DrawLines,
Romain Guyed6fcb02011-03-21 13:11:28 -070093 DrawPoints,
Romain Guy4aa90572010-09-26 18:40:37 -070094 DrawText,
95 ResetShader,
96 SetupShader,
97 ResetColorFilter,
98 SetupColorFilter,
99 ResetShadow,
Romain Guyffac7fc2011-01-13 17:21:49 -0800100 SetupShadow,
Chet Haasedaf98e92011-01-10 14:10:36 -0800101 DrawGLFunction,
Romain Guy4aa90572010-09-26 18:40:37 -0700102 };
103
Romain Guyffac7fc2011-01-13 17:21:49 -0800104 static const char* OP_NAMES[];
105
Chet Haased63cbd12011-02-03 16:32:46 -0800106 void initFromDisplayListRenderer(const DisplayListRenderer& recorder, bool reusing = false);
Chet Haase5977baa2011-01-05 18:01:22 -0800107
Romain Guycabfcc12011-03-07 18:06:46 -0800108 bool replay(OpenGLRenderer& renderer, Rect& dirty, uint32_t level = 0);
Romain Guyb051e892010-09-28 19:09:36 -0700109
Chet Haaseed30fd82011-04-22 16:18:45 -0700110 void output(OpenGLRenderer& renderer, uint32_t level = 0);
111
Chet Haase9c1e23b2011-03-24 10:51:31 -0700112 static void outputLogBuffer(int fd);
113
Romain Guyb051e892010-09-28 19:09:36 -0700114private:
115 void init();
116
Chet Haased63cbd12011-02-03 16:32:46 -0800117 void clearResources();
118
Romain Guyb051e892010-09-28 19:09:36 -0700119 class TextContainer {
120 public:
121 size_t length() const {
122 return mByteLength;
123 }
124
125 const char* text() const {
126 return (const char*) mText;
127 }
128
129 size_t mByteLength;
130 const char* mText;
131 };
132
133 SkBitmap* getBitmap() {
Chet Haase5c13d892010-10-08 08:37:55 -0700134 return (SkBitmap*) getInt();
135 }
136
137 SkiaShader* getShader() {
138 return (SkiaShader*) getInt();
Romain Guyb051e892010-09-28 19:09:36 -0700139 }
140
Chet Haasead93c2b2010-10-22 16:17:12 -0700141 SkiaColorFilter* getColorFilter() {
142 return (SkiaColorFilter*) getInt();
143 }
144
Romain Guyb051e892010-09-28 19:09:36 -0700145 inline int getIndex() {
146 return mReader.readInt();
147 }
148
149 inline int getInt() {
150 return mReader.readInt();
151 }
152
Romain Guy7b5b6ab2011-03-14 18:05:08 -0700153 inline uint32_t getUInt() {
154 return mReader.readU32();
155 }
156
Romain Guyb051e892010-09-28 19:09:36 -0700157 SkMatrix* getMatrix() {
Chet Haase5c13d892010-10-08 08:37:55 -0700158 return (SkMatrix*) getInt();
Romain Guyb051e892010-09-28 19:09:36 -0700159 }
160
161 SkPath* getPath() {
Romain Guy2fc941e2011-02-03 15:06:05 -0800162 return (SkPath*) getInt();
Romain Guyb051e892010-09-28 19:09:36 -0700163 }
164
165 SkPaint* getPaint() {
Chet Haase5c13d892010-10-08 08:37:55 -0700166 return (SkPaint*) getInt();
Romain Guyb051e892010-09-28 19:09:36 -0700167 }
168
Romain Guy0fe478e2010-11-08 12:08:41 -0800169 DisplayList* getDisplayList() {
170 return (DisplayList*) getInt();
171 }
172
Romain Guyb051e892010-09-28 19:09:36 -0700173 inline float getFloat() {
174 return mReader.readScalar();
175 }
176
177 int32_t* getInts(uint32_t& count) {
178 count = getInt();
179 return (int32_t*) mReader.skip(count * sizeof(int32_t));
180 }
181
Romain Guy4bb94202010-10-12 15:59:26 -0700182 uint32_t* getUInts(int8_t& count) {
183 count = getInt();
184 return (uint32_t*) mReader.skip(count * sizeof(uint32_t));
185 }
186
Romain Guyb051e892010-09-28 19:09:36 -0700187 float* getFloats(int& count) {
188 count = getInt();
189 return (float*) mReader.skip(count * sizeof(float));
190 }
191
192 void getText(TextContainer* text) {
193 size_t length = text->mByteLength = getInt();
194 text->mText = (const char*) mReader.skip(length);
195 }
196
Chet Haase5c13d892010-10-08 08:37:55 -0700197 Vector<SkBitmap*> mBitmapResources;
Chet Haasead93c2b2010-10-22 16:17:12 -0700198 Vector<SkiaColorFilter*> mFilterResources;
Romain Guyb051e892010-09-28 19:09:36 -0700199
Chet Haased98aa2d2010-10-25 15:47:32 -0700200 Vector<SkPaint*> mPaints;
Romain Guy2fc941e2011-02-03 15:06:05 -0800201 Vector<SkPath*> mPaths;
Chet Haased98aa2d2010-10-25 15:47:32 -0700202 Vector<SkMatrix*> mMatrices;
Romain Guy24c00212011-01-14 15:31:00 -0800203 Vector<SkiaShader*> mShaders;
Chet Haased98aa2d2010-10-25 15:47:32 -0700204
Romain Guyb051e892010-09-28 19:09:36 -0700205 mutable SkFlattenableReadBuffer mReader;
Romain Guyb051e892010-09-28 19:09:36 -0700206};
207
208///////////////////////////////////////////////////////////////////////////////
209// Renderer
210///////////////////////////////////////////////////////////////////////////////
211
212/**
213 * Records drawing commands in a display list for latter playback.
214 */
215class DisplayListRenderer: public OpenGLRenderer {
216public:
217 DisplayListRenderer();
218 ~DisplayListRenderer();
219
Chet Haase5977baa2011-01-05 18:01:22 -0800220 DisplayList* getDisplayList();
221
Romain Guyb051e892010-09-28 19:09:36 -0700222 void setViewport(int width, int height);
Romain Guy7d7b5492011-01-24 16:33:45 -0800223 void prepareDirty(float left, float top, float right, float bottom, bool opaque);
Romain Guy27454a42011-01-23 12:01:41 -0800224 void finish();
Romain Guyb051e892010-09-28 19:09:36 -0700225
Romain Guycabfcc12011-03-07 18:06:46 -0800226 bool callDrawGLFunction(Functor *functor, Rect& dirty);
Romain Guy4aa90572010-09-26 18:40:37 -0700227
Chet Haasedaf98e92011-01-10 14:10:36 -0800228 void interrupt();
229 void resume();
230
Romain Guy4aa90572010-09-26 18:40:37 -0700231 int save(int flags);
232 void restore();
233 void restoreToCount(int saveCount);
234
235 int saveLayer(float left, float top, float right, float bottom,
Chet Haase5c13d892010-10-08 08:37:55 -0700236 SkPaint* p, int flags);
Romain Guy5b3b3522010-10-27 18:57:51 -0700237 int saveLayerAlpha(float left, float top, float right, float bottom,
238 int alpha, int flags);
Romain Guy4aa90572010-09-26 18:40:37 -0700239
240 void translate(float dx, float dy);
241 void rotate(float degrees);
242 void scale(float sx, float sy);
Romain Guy807daf72011-01-18 11:19:19 -0800243 void skew(float sx, float sy);
Romain Guy4aa90572010-09-26 18:40:37 -0700244
245 void setMatrix(SkMatrix* matrix);
246 void concatMatrix(SkMatrix* matrix);
247
248 bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op);
249
Romain Guy7b5b6ab2011-03-14 18:05:08 -0700250 bool drawDisplayList(DisplayList* displayList, uint32_t width, uint32_t height,
251 Rect& dirty, uint32_t level = 0);
Romain Guyada830f2011-01-13 12:13:20 -0800252 void drawLayer(Layer* layer, float x, float y, SkPaint* paint);
Chet Haase5c13d892010-10-08 08:37:55 -0700253 void drawBitmap(SkBitmap* bitmap, float left, float top, SkPaint* paint);
254 void drawBitmap(SkBitmap* bitmap, SkMatrix* matrix, SkPaint* paint);
Romain Guy4aa90572010-09-26 18:40:37 -0700255 void drawBitmap(SkBitmap* bitmap, float srcLeft, float srcTop,
256 float srcRight, float srcBottom, float dstLeft, float dstTop,
Chet Haase5c13d892010-10-08 08:37:55 -0700257 float dstRight, float dstBottom, SkPaint* paint);
Romain Guy5a7b4662011-01-20 19:09:30 -0800258 void drawBitmapMesh(SkBitmap* bitmap, int meshWidth, int meshHeight,
259 float* vertices, int* colors, SkPaint* paint);
Romain Guy4aa90572010-09-26 18:40:37 -0700260 void drawPatch(SkBitmap* bitmap, const int32_t* xDivs, const int32_t* yDivs,
Romain Guy4bb94202010-10-12 15:59:26 -0700261 const uint32_t* colors, uint32_t width, uint32_t height, int8_t numColors,
Chet Haase5c13d892010-10-08 08:37:55 -0700262 float left, float top, float right, float bottom, SkPaint* paint);
Romain Guy4aa90572010-09-26 18:40:37 -0700263 void drawColor(int color, SkXfermode::Mode mode);
Chet Haase5c13d892010-10-08 08:37:55 -0700264 void drawRect(float left, float top, float right, float bottom, SkPaint* paint);
Romain Guy01d58e42011-01-19 21:54:02 -0800265 void drawRoundRect(float left, float top, float right, float bottom,
266 float rx, float ry, SkPaint* paint);
267 void drawCircle(float x, float y, float radius, SkPaint* paint);
Romain Guyc1cd9ba32011-01-23 14:18:41 -0800268 void drawOval(float left, float top, float right, float bottom, SkPaint* paint);
Romain Guy8b2f5262011-01-23 16:15:02 -0800269 void drawArc(float left, float top, float right, float bottom,
270 float startAngle, float sweepAngle, bool useCenter, SkPaint* paint);
Romain Guy4aa90572010-09-26 18:40:37 -0700271 void drawPath(SkPath* path, SkPaint* paint);
Chet Haase5c13d892010-10-08 08:37:55 -0700272 void drawLines(float* points, int count, SkPaint* paint);
Romain Guyed6fcb02011-03-21 13:11:28 -0700273 void drawPoints(float* points, int count, SkPaint* paint);
Romain Guy4aa90572010-09-26 18:40:37 -0700274 void drawText(const char* text, int bytesCount, int count, float x, float y, SkPaint* paint);
275
276 void resetShader();
277 void setupShader(SkiaShader* shader);
278
279 void resetColorFilter();
280 void setupColorFilter(SkiaColorFilter* filter);
281
282 void resetShadow();
283 void setupShadow(float radius, float dx, float dy, int color);
284
285 void reset();
286
Romain Guyb051e892010-09-28 19:09:36 -0700287 const SkWriter32& writeStream() const {
288 return mWriter;
289 }
290
Chet Haase5c13d892010-10-08 08:37:55 -0700291 const Vector<SkBitmap*>& getBitmapResources() const {
292 return mBitmapResources;
Romain Guyb051e892010-09-28 19:09:36 -0700293 }
294
Romain Guy24c00212011-01-14 15:31:00 -0800295 const Vector<SkiaShader*>& getShaders() const {
296 return mShaders;
Romain Guyb051e892010-09-28 19:09:36 -0700297 }
298
Chet Haased98aa2d2010-10-25 15:47:32 -0700299 const Vector<SkPaint*>& getPaints() const {
300 return mPaints;
301 }
302
Romain Guy2fc941e2011-02-03 15:06:05 -0800303 const Vector<SkPath*>& getPaths() const {
304 return mPaths;
305 }
306
Chet Haased98aa2d2010-10-25 15:47:32 -0700307 const Vector<SkMatrix*>& getMatrices() const {
308 return mMatrices;
309 }
310
Chet Haasead93c2b2010-10-22 16:17:12 -0700311 const Vector<SkiaColorFilter*>& getFilterResources() const {
312 return mFilterResources;
313 }
314
Romain Guy4aa90572010-09-26 18:40:37 -0700315private:
Romain Guy27454a42011-01-23 12:01:41 -0800316 void insertRestoreToCount() {
317 if (mRestoreSaveCount >= 0) {
318 mWriter.writeInt(DisplayList::RestoreToCount);
319 addInt(mRestoreSaveCount);
320 mRestoreSaveCount = -1;
321 }
322 }
323
Romain Guyb051e892010-09-28 19:09:36 -0700324 inline void addOp(DisplayList::Op drawOp) {
Romain Guy27454a42011-01-23 12:01:41 -0800325 insertRestoreToCount();
Romain Guy4aa90572010-09-26 18:40:37 -0700326 mWriter.writeInt(drawOp);
327 }
328
329 inline void addInt(int value) {
330 mWriter.writeInt(value);
331 }
332
Romain Guy7b5b6ab2011-03-14 18:05:08 -0700333 inline void addSize(uint32_t w, uint32_t h) {
334 mWriter.writeInt(w);
335 mWriter.writeInt(h);
336 }
337
Romain Guy4aa90572010-09-26 18:40:37 -0700338 void addInts(const int32_t* values, uint32_t count) {
Romain Guyb051e892010-09-28 19:09:36 -0700339 mWriter.writeInt(count);
Romain Guy4aa90572010-09-26 18:40:37 -0700340 for (uint32_t i = 0; i < count; i++) {
341 mWriter.writeInt(values[i]);
342 }
343 }
344
Romain Guy4bb94202010-10-12 15:59:26 -0700345 void addUInts(const uint32_t* values, int8_t count) {
346 mWriter.writeInt(count);
347 for (int8_t i = 0; i < count; i++) {
348 mWriter.writeInt(values[i]);
349 }
350 }
351
Romain Guy4aa90572010-09-26 18:40:37 -0700352 inline void addFloat(float value) {
353 mWriter.writeScalar(value);
354 }
355
356 void addFloats(const float* values, int count) {
Romain Guyb051e892010-09-28 19:09:36 -0700357 mWriter.writeInt(count);
Romain Guy4aa90572010-09-26 18:40:37 -0700358 for (int i = 0; i < count; i++) {
359 mWriter.writeScalar(values[i]);
360 }
361 }
362
363 inline void addPoint(float x, float y) {
364 mWriter.writeScalar(x);
365 mWriter.writeScalar(y);
366 }
367
368 inline void addBounds(float left, float top, float right, float bottom) {
369 mWriter.writeScalar(left);
370 mWriter.writeScalar(top);
371 mWriter.writeScalar(right);
372 mWriter.writeScalar(bottom);
373 }
374
375 inline void addText(const void* text, size_t byteLength) {
376 mWriter.writeInt(byteLength);
377 mWriter.writePad(text, byteLength);
378 }
379
Romain Guy2fc941e2011-02-03 15:06:05 -0800380 inline void addPath(SkPath* path) {
381 if (!path) {
382 addInt((int) NULL);
383 return;
Romain Guy4aa90572010-09-26 18:40:37 -0700384 }
Romain Guy2fc941e2011-02-03 15:06:05 -0800385
386 SkPath* pathCopy = mPathMap.valueFor(path);
387 if (pathCopy == NULL || pathCopy->getGenerationID() != path->getGenerationID()) {
Romain Guyb29cfbf2011-03-18 16:24:19 -0700388 pathCopy = new SkPath(*path);
Romain Guy2fc941e2011-02-03 15:06:05 -0800389 mPathMap.add(path, pathCopy);
Romain Guyb29cfbf2011-03-18 16:24:19 -0700390 mPaths.add(pathCopy);
Romain Guy2fc941e2011-02-03 15:06:05 -0800391 }
392
393 addInt((int) pathCopy);
Romain Guy4aa90572010-09-26 18:40:37 -0700394 }
395
Chet Haase5c13d892010-10-08 08:37:55 -0700396 inline void addPaint(SkPaint* paint) {
Romain Guy24c00212011-01-14 15:31:00 -0800397 if (!paint) {
Romain Guy0fe478e2010-11-08 12:08:41 -0800398 addInt((int) NULL);
Chet Haased98aa2d2010-10-25 15:47:32 -0700399 return;
400 }
Romain Guy0fe478e2010-11-08 12:08:41 -0800401
Romain Guy24c00212011-01-14 15:31:00 -0800402 SkPaint* paintCopy = mPaintMap.valueFor(paint);
Chet Haased98aa2d2010-10-25 15:47:32 -0700403 if (paintCopy == NULL || paintCopy->getGenerationID() != paint->getGenerationID()) {
404 paintCopy = new SkPaint(*paint);
405 mPaintMap.add(paint, paintCopy);
406 mPaints.add(paintCopy);
407 }
Romain Guy0fe478e2010-11-08 12:08:41 -0800408
409 addInt((int) paintCopy);
410 }
411
412 inline void addDisplayList(DisplayList* displayList) {
413 // TODO: To be safe, the display list should be ref-counted in the
414 // resources cache, but we rely on the caller (UI toolkit) to
415 // do the right thing for now
416 addInt((int) displayList);
Romain Guy4aa90572010-09-26 18:40:37 -0700417 }
418
Chet Haase5c13d892010-10-08 08:37:55 -0700419 inline void addMatrix(SkMatrix* matrix) {
Chet Haased98aa2d2010-10-25 15:47:32 -0700420 // Copying the matrix is cheap and prevents against the user changing the original
421 // matrix before the operation that uses it
422 addInt((int) new SkMatrix(*matrix));
Romain Guy4aa90572010-09-26 18:40:37 -0700423 }
424
Chet Haase5c13d892010-10-08 08:37:55 -0700425 inline void addBitmap(SkBitmap* bitmap) {
Chet Haased98aa2d2010-10-25 15:47:32 -0700426 // Note that this assumes the bitmap is immutable. There are cases this won't handle
427 // correctly, such as creating the bitmap from scratch, drawing with it, changing its
428 // contents, and drawing again. The only fix would be to always copy it the first time,
429 // which doesn't seem worth the extra cycles for this unlikely case.
Romain Guy0fe478e2010-11-08 12:08:41 -0800430 addInt((int) bitmap);
Chet Haase5c13d892010-10-08 08:37:55 -0700431 mBitmapResources.add(bitmap);
432 Caches& caches = Caches::getInstance();
433 caches.resourceCache.incrementRefcount(bitmap);
434 }
Romain Guy4aa90572010-09-26 18:40:37 -0700435
Chet Haase5c13d892010-10-08 08:37:55 -0700436 inline void addShader(SkiaShader* shader) {
Romain Guy24c00212011-01-14 15:31:00 -0800437 if (!shader) {
438 addInt((int) NULL);
439 return;
440 }
441
442 SkiaShader* shaderCopy = mShaderMap.valueFor(shader);
443 // TODO: We also need to handle generation ID changes in compose shaders
Romain Guy1f1fcb72011-01-14 15:37:54 -0800444 if (shaderCopy == NULL || shaderCopy->getGenerationId() != shader->getGenerationId()) {
Romain Guy24c00212011-01-14 15:31:00 -0800445 shaderCopy = shader->copy();
446 mShaderMap.add(shader, shaderCopy);
Romain Guy1f1fcb72011-01-14 15:37:54 -0800447 mShaders.add(shaderCopy);
Romain Guy43ccf462011-01-14 18:51:01 -0800448 Caches::getInstance().resourceCache.incrementRefcount(shaderCopy);
Romain Guy24c00212011-01-14 15:31:00 -0800449 }
450
451 addInt((int) shaderCopy);
Romain Guy4aa90572010-09-26 18:40:37 -0700452 }
453
Chet Haasead93c2b2010-10-22 16:17:12 -0700454 inline void addColorFilter(SkiaColorFilter* colorFilter) {
Romain Guy0fe478e2010-11-08 12:08:41 -0800455 addInt((int) colorFilter);
Chet Haasead93c2b2010-10-22 16:17:12 -0700456 mFilterResources.add(colorFilter);
457 Caches& caches = Caches::getInstance();
458 caches.resourceCache.incrementRefcount(colorFilter);
459 }
460
Chet Haase5c13d892010-10-08 08:37:55 -0700461 Vector<SkBitmap*> mBitmapResources;
Chet Haasead93c2b2010-10-22 16:17:12 -0700462 Vector<SkiaColorFilter*> mFilterResources;
Romain Guy4aa90572010-09-26 18:40:37 -0700463
Chet Haased98aa2d2010-10-25 15:47:32 -0700464 Vector<SkPaint*> mPaints;
Romain Guy0fe478e2010-11-08 12:08:41 -0800465 DefaultKeyedVector<SkPaint*, SkPaint*> mPaintMap;
Romain Guy24c00212011-01-14 15:31:00 -0800466
Romain Guy2fc941e2011-02-03 15:06:05 -0800467 Vector<SkPath*> mPaths;
468 DefaultKeyedVector<SkPath*, SkPath*> mPathMap;
469
Romain Guy24c00212011-01-14 15:31:00 -0800470 Vector<SkiaShader*> mShaders;
471 DefaultKeyedVector<SkiaShader*, SkiaShader*> mShaderMap;
472
Chet Haased98aa2d2010-10-25 15:47:32 -0700473 Vector<SkMatrix*> mMatrices;
474
Romain Guy4aa90572010-09-26 18:40:37 -0700475 SkWriter32 mWriter;
476
Chet Haase5977baa2011-01-05 18:01:22 -0800477 DisplayList *mDisplayList;
478
Romain Guy27454a42011-01-23 12:01:41 -0800479 int mRestoreSaveCount;
480
Romain Guyb051e892010-09-28 19:09:36 -0700481 friend class DisplayList;
482
Romain Guy4aa90572010-09-26 18:40:37 -0700483}; // class DisplayListRenderer
484
485}; // namespace uirenderer
486}; // namespace android
487
Romain Guy5b3b3522010-10-27 18:57:51 -0700488#endif // ANDROID_HWUI_DISPLAY_LIST_RENDERER_H