14aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy/*
24aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy * Copyright (C) 2010 The Android Open Source Project
34aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy *
44aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy * Licensed under the Apache License, Version 2.0 (the "License");
54aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy * you may not use this file except in compliance with the License.
64aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy * You may obtain a copy of the License at
74aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy *
84aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy *      http://www.apache.org/licenses/LICENSE-2.0
94aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy *
104aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy * Unless required by applicable law or agreed to in writing, software
114aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy * distributed under the License is distributed on an "AS IS" BASIS,
124aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
134aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy * See the License for the specific language governing permissions and
144aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy * limitations under the License.
154aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy */
164aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy
174aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy#define LOG_TAG "OpenGLRenderer"
184aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy
19d5a85fb63d91a9297e8d9a11016f3b3ed60dfbabRomain Guy#include <SkCamera.h>
209c1e23baf5bfbebd1aebbd6d9a18c225325567ceChet Haase
216554943a1dd6854c0f4976900956e556767b49e1Romain Guy#include <private/hwui/DrawGlInfo.h>
226554943a1dd6854c0f4976900956e556767b49e1Romain Guy
239c1e23baf5bfbebd1aebbd6d9a18c225325567ceChet Haase#include "DisplayListLogBuffer.h"
244aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy#include "DisplayListRenderer.h"
259c1e23baf5bfbebd1aebbd6d9a18c225325567ceChet Haase#include "Caches.h"
2613631f3da855f200a151e7837ed9f6b079622b58Romain Guy
274aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guynamespace android {
284aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guynamespace uirenderer {
294aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy
304aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy///////////////////////////////////////////////////////////////////////////////
31b051e895ccb696604349c6c5efe7c4747e1d1ab6Romain Guy// Display list
32b051e895ccb696604349c6c5efe7c4747e1d1ab6Romain Guy///////////////////////////////////////////////////////////////////////////////
33b051e895ccb696604349c6c5efe7c4747e1d1ab6Romain Guy
34ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guyconst char* DisplayList::OP_NAMES[] = {
35ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy    "Save",
36ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy    "Restore",
37ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy    "RestoreToCount",
38ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy    "SaveLayer",
39ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy    "SaveLayerAlpha",
40ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy    "Translate",
41ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy    "Rotate",
42ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy    "Scale",
434cf6e2f34994f160e1baba205a43c12784dd3e0dRomain Guy    "Skew",
44ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy    "SetMatrix",
45ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy    "ConcatMatrix",
46ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy    "ClipRect",
47ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy    "DrawDisplayList",
48ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy    "DrawLayer",
49ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy    "DrawBitmap",
50ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy    "DrawBitmapMatrix",
51ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy    "DrawBitmapRect",
52e651cc6239616a202f6e96ebc2ed93b4b8b3627cRomain Guy    "DrawBitmapData",
535a7b466a2b4b7ced739bd5c31e022de61650545aRomain Guy    "DrawBitmapMesh",
54ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy    "DrawPatch",
55ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy    "DrawColor",
56ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy    "DrawRect",
5701d58e43ede5ca98cbebdd166f9b0c545032c01bRomain Guy    "DrawRoundRect",
5801d58e43ede5ca98cbebdd166f9b0c545032c01bRomain Guy    "DrawCircle",
59c1cd9ba335b293f11e1082447ef08e474710a05fRomain Guy    "DrawOval",
608b2f5267f16c295f12faab810527cd6311997e34Romain Guy    "DrawArc",
61ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy    "DrawPath",
62ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy    "DrawLines",
63ed6fcb034b44d9a6ac2fc72fee6030417811f234Romain Guy    "DrawPoints",
64325740fb444af8fc7fb0119b2e30ce322c2ae134Romain Guy    "DrawTextOnPath",
65eb9a5367e8f0e970db8509ffb2584f5376bc62edRomain Guy    "DrawPosText",
66c25259519f1b74bb62a2b051b74537f073436b5cRomain Guy    "DrawText",
67ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy    "ResetShader",
68ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy    "SetupShader",
69ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy    "ResetColorFilter",
70ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy    "SetupColorFilter",
71ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy    "ResetShadow",
72daf98e941e140e8739458126640183b9f296a2abChet Haase    "SetupShadow",
735ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy    "ResetPaintFilter",
745ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy    "SetupPaintFilter",
75daf98e941e140e8739458126640183b9f296a2abChet Haase    "DrawGLFunction"
76ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy};
77ffac7fc5042296a459d0f5a450dbfe20917093dcRomain Guy
789c1e23baf5bfbebd1aebbd6d9a18c225325567ceChet Haasevoid DisplayList::outputLogBuffer(int fd) {
799c1e23baf5bfbebd1aebbd6d9a18c225325567ceChet Haase    DisplayListLogBuffer& logBuffer = DisplayListLogBuffer::getInstance();
809c1e23baf5bfbebd1aebbd6d9a18c225325567ceChet Haase    if (logBuffer.isEmpty()) {
819c1e23baf5bfbebd1aebbd6d9a18c225325567ceChet Haase        return;
829c1e23baf5bfbebd1aebbd6d9a18c225325567ceChet Haase    }
8365b345fa22b878e141b8fd8ece9c208df00fa40fRomain Guy
849c1e23baf5bfbebd1aebbd6d9a18c225325567ceChet Haase    FILE *file = fdopen(fd, "a");
8565b345fa22b878e141b8fd8ece9c208df00fa40fRomain Guy
869c1e23baf5bfbebd1aebbd6d9a18c225325567ceChet Haase    fprintf(file, "\nRecent DisplayList operations\n");
879c1e23baf5bfbebd1aebbd6d9a18c225325567ceChet Haase    logBuffer.outputCommands(file, OP_NAMES);
8865b345fa22b878e141b8fd8ece9c208df00fa40fRomain Guy
8965b345fa22b878e141b8fd8ece9c208df00fa40fRomain Guy    String8 cachesLog;
9065b345fa22b878e141b8fd8ece9c208df00fa40fRomain Guy    Caches::getInstance().dumpMemoryUsage(cachesLog);
9165b345fa22b878e141b8fd8ece9c208df00fa40fRomain Guy    fprintf(file, "\nCaches:\n%s", cachesLog.string());
9265b345fa22b878e141b8fd8ece9c208df00fa40fRomain Guy    fprintf(file, "\n");
9365b345fa22b878e141b8fd8ece9c208df00fa40fRomain Guy
949c1e23baf5bfbebd1aebbd6d9a18c225325567ceChet Haase    fflush(file);
959c1e23baf5bfbebd1aebbd6d9a18c225325567ceChet Haase}
969c1e23baf5bfbebd1aebbd6d9a18c225325567ceChet Haase
97491189f6bb81827a0c8e343f89420a9bcd2e62aeChet HaaseDisplayList::DisplayList(const DisplayListRenderer& recorder) :
989420abd56a2af7ddbeb70562b79d61b2dca8c5a1Chet Haase    mTransformMatrix(NULL), mTransformCamera(NULL), mTransformMatrix3D(NULL),
999420abd56a2af7ddbeb70562b79d61b2dca8c5a1Chet Haase    mStaticMatrix(NULL), mAnimationMatrix(NULL) {
100491189f6bb81827a0c8e343f89420a9bcd2e62aeChet Haase
1015977baa1fa24125c148a72699b53e62abaf08960Chet Haase    initFromDisplayListRenderer(recorder);
1025977baa1fa24125c148a72699b53e62abaf08960Chet Haase}
1035977baa1fa24125c148a72699b53e62abaf08960Chet Haase
1045977baa1fa24125c148a72699b53e62abaf08960Chet HaaseDisplayList::~DisplayList() {
105d63cbd10765e8f48e39b07b15f0a4b70bf853ec8Chet Haase    clearResources();
106d63cbd10765e8f48e39b07b15f0a4b70bf853ec8Chet Haase}
107d63cbd10765e8f48e39b07b15f0a4b70bf853ec8Chet Haase
108bb0acdf9e1d862a7cf0e2533321fc1105c29b5e3Romain Guyvoid DisplayList::destroyDisplayListDeferred(DisplayList* displayList) {
109bb0acdf9e1d862a7cf0e2533321fc1105c29b5e3Romain Guy    if (displayList) {
110bb0acdf9e1d862a7cf0e2533321fc1105c29b5e3Romain Guy        DISPLAY_LIST_LOGD("Deferring display list destruction");
111bb0acdf9e1d862a7cf0e2533321fc1105c29b5e3Romain Guy        Caches::getInstance().deleteDisplayListDeferred(displayList);
112bb0acdf9e1d862a7cf0e2533321fc1105c29b5e3Romain Guy    }
113bb0acdf9e1d862a7cf0e2533321fc1105c29b5e3Romain Guy}
114bb0acdf9e1d862a7cf0e2533321fc1105c29b5e3Romain Guy
115d63cbd10765e8f48e39b07b15f0a4b70bf853ec8Chet Haasevoid DisplayList::clearResources() {
1165977baa1fa24125c148a72699b53e62abaf08960Chet Haase    sk_free((void*) mReader.base());
117034de6b1ec561797a2422314e6ef03e3cd3e08e0Romain Guy    mReader.setMemory(NULL, 0);
1185977baa1fa24125c148a72699b53e62abaf08960Chet Haase
1191271e2cc80b01d577e9db339459ef0222bb9320dChet Haase    delete mTransformMatrix;
1201271e2cc80b01d577e9db339459ef0222bb9320dChet Haase    delete mTransformCamera;
1211271e2cc80b01d577e9db339459ef0222bb9320dChet Haase    delete mTransformMatrix3D;
1221271e2cc80b01d577e9db339459ef0222bb9320dChet Haase    delete mStaticMatrix;
1231271e2cc80b01d577e9db339459ef0222bb9320dChet Haase    delete mAnimationMatrix;
12458ecc204fbcacef34806290492384677a330d4d4Romain Guy
1251271e2cc80b01d577e9db339459ef0222bb9320dChet Haase    mTransformMatrix = NULL;
1261271e2cc80b01d577e9db339459ef0222bb9320dChet Haase    mTransformCamera = NULL;
1271271e2cc80b01d577e9db339459ef0222bb9320dChet Haase    mTransformMatrix3D = NULL;
1281271e2cc80b01d577e9db339459ef0222bb9320dChet Haase    mStaticMatrix = NULL;
1291271e2cc80b01d577e9db339459ef0222bb9320dChet Haase    mAnimationMatrix = NULL;
130a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase
1315977baa1fa24125c148a72699b53e62abaf08960Chet Haase    Caches& caches = Caches::getInstance();
13254c1a64d5441a964890b44280e4457e11f4f924aRomain Guy    caches.unregisterFunctors(mFunctorCount);
13358ecc204fbcacef34806290492384677a330d4d4Romain Guy    caches.resourceCache.lock();
1345977baa1fa24125c148a72699b53e62abaf08960Chet Haase
1355977baa1fa24125c148a72699b53e62abaf08960Chet Haase    for (size_t i = 0; i < mBitmapResources.size(); i++) {
13658ecc204fbcacef34806290492384677a330d4d4Romain Guy        caches.resourceCache.decrementRefcountLocked(mBitmapResources.itemAt(i));
1375977baa1fa24125c148a72699b53e62abaf08960Chet Haase    }
1385977baa1fa24125c148a72699b53e62abaf08960Chet Haase
13949c5fc0b9e850497233e189ff9dcc71a78ebe6e7Romain Guy    for (size_t i = 0; i < mOwnedBitmapResources.size(); i++) {
14049c5fc0b9e850497233e189ff9dcc71a78ebe6e7Romain Guy        SkBitmap* bitmap = mOwnedBitmapResources.itemAt(i);
14158ecc204fbcacef34806290492384677a330d4d4Romain Guy        caches.resourceCache.decrementRefcountLocked(bitmap);
14258ecc204fbcacef34806290492384677a330d4d4Romain Guy        caches.resourceCache.destructorLocked(bitmap);
14349c5fc0b9e850497233e189ff9dcc71a78ebe6e7Romain Guy    }
14449c5fc0b9e850497233e189ff9dcc71a78ebe6e7Romain Guy
145d586ad9c9fec80aa1d24d6b53cd2c8d5b47fe868Romain Guy    for (size_t i = 0; i < mFilterResources.size(); i++) {
14658ecc204fbcacef34806290492384677a330d4d4Romain Guy        caches.resourceCache.decrementRefcountLocked(mFilterResources.itemAt(i));
147d586ad9c9fec80aa1d24d6b53cd2c8d5b47fe868Romain Guy    }
148d586ad9c9fec80aa1d24d6b53cd2c8d5b47fe868Romain Guy
14924c00216687ac87fe531dc4d4168ac0c0ca04ea6Romain Guy    for (size_t i = 0; i < mShaders.size(); i++) {
15058ecc204fbcacef34806290492384677a330d4d4Romain Guy        caches.resourceCache.decrementRefcountLocked(mShaders.itemAt(i));
15158ecc204fbcacef34806290492384677a330d4d4Romain Guy        caches.resourceCache.destructorLocked(mShaders.itemAt(i));
1525977baa1fa24125c148a72699b53e62abaf08960Chet Haase    }
15358ecc204fbcacef34806290492384677a330d4d4Romain Guy
15458ecc204fbcacef34806290492384677a330d4d4Romain Guy    for (size_t i = 0; i < mSourcePaths.size(); i++) {
15558ecc204fbcacef34806290492384677a330d4d4Romain Guy        caches.resourceCache.decrementRefcountLocked(mSourcePaths.itemAt(i));
15658ecc204fbcacef34806290492384677a330d4d4Romain Guy    }
15758ecc204fbcacef34806290492384677a330d4d4Romain Guy
158603f6de35f21d74ae242d52d501f4f5c25ff4f4cChet Haase    for (size_t i = 0; i < mLayers.size(); i++) {
159603f6de35f21d74ae242d52d501f4f5c25ff4f4cChet Haase        caches.resourceCache.decrementRefcountLocked(mLayers.itemAt(i));
160603f6de35f21d74ae242d52d501f4f5c25ff4f4cChet Haase    }
161603f6de35f21d74ae242d52d501f4f5c25ff4f4cChet Haase
16258ecc204fbcacef34806290492384677a330d4d4Romain Guy    caches.resourceCache.unlock();
1635977baa1fa24125c148a72699b53e62abaf08960Chet Haase
1645977baa1fa24125c148a72699b53e62abaf08960Chet Haase    for (size_t i = 0; i < mPaints.size(); i++) {
1655977baa1fa24125c148a72699b53e62abaf08960Chet Haase        delete mPaints.itemAt(i);
1665977baa1fa24125c148a72699b53e62abaf08960Chet Haase    }
1675977baa1fa24125c148a72699b53e62abaf08960Chet Haase
1682fc941e4650d618ff6e122f28b616d9032ffa134Romain Guy    for (size_t i = 0; i < mPaths.size(); i++) {
1691af23a32d879db330eb5a08b21090ec60b604a32Romain Guy        SkPath* path = mPaths.itemAt(i);
1701af23a32d879db330eb5a08b21090ec60b604a32Romain Guy        caches.pathCache.remove(path);
1711af23a32d879db330eb5a08b21090ec60b604a32Romain Guy        delete path;
1722fc941e4650d618ff6e122f28b616d9032ffa134Romain Guy    }
173d34dd71800d9a1077e58c3b7f2511c46848da417Chet Haase
1745977baa1fa24125c148a72699b53e62abaf08960Chet Haase    for (size_t i = 0; i < mMatrices.size(); i++) {
1755977baa1fa24125c148a72699b53e62abaf08960Chet Haase        delete mMatrices.itemAt(i);
1765977baa1fa24125c148a72699b53e62abaf08960Chet Haase    }
17758ecc204fbcacef34806290492384677a330d4d4Romain Guy
17858ecc204fbcacef34806290492384677a330d4d4Romain Guy    mBitmapResources.clear();
17958ecc204fbcacef34806290492384677a330d4d4Romain Guy    mOwnedBitmapResources.clear();
18058ecc204fbcacef34806290492384677a330d4d4Romain Guy    mFilterResources.clear();
18158ecc204fbcacef34806290492384677a330d4d4Romain Guy    mShaders.clear();
18258ecc204fbcacef34806290492384677a330d4d4Romain Guy    mSourcePaths.clear();
18358ecc204fbcacef34806290492384677a330d4d4Romain Guy    mPaints.clear();
18458ecc204fbcacef34806290492384677a330d4d4Romain Guy    mPaths.clear();
1855977baa1fa24125c148a72699b53e62abaf08960Chet Haase    mMatrices.clear();
186603f6de35f21d74ae242d52d501f4f5c25ff4f4cChet Haase    mLayers.clear();
1875977baa1fa24125c148a72699b53e62abaf08960Chet Haase}
1885977baa1fa24125c148a72699b53e62abaf08960Chet Haase
1896a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haasevoid DisplayList::reset() {
1906a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    clearResources();
1916a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    init();
1926a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase}
1936a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase
194d63cbd10765e8f48e39b07b15f0a4b70bf853ec8Chet Haasevoid DisplayList::initFromDisplayListRenderer(const DisplayListRenderer& recorder, bool reusing) {
195b051e895ccb696604349c6c5efe7c4747e1d1ab6Romain Guy
196d63cbd10765e8f48e39b07b15f0a4b70bf853ec8Chet Haase    if (reusing) {
197d63cbd10765e8f48e39b07b15f0a4b70bf853ec8Chet Haase        // re-using display list - clear out previous allocations
198d63cbd10765e8f48e39b07b15f0a4b70bf853ec8Chet Haase        clearResources();
199d63cbd10765e8f48e39b07b15f0a4b70bf853ec8Chet Haase    }
200034de6b1ec561797a2422314e6ef03e3cd3e08e0Romain Guy
201034de6b1ec561797a2422314e6ef03e3cd3e08e0Romain Guy    init();
202d63cbd10765e8f48e39b07b15f0a4b70bf853ec8Chet Haase
2036a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    const SkWriter32& writer = recorder.writeStream();
204034de6b1ec561797a2422314e6ef03e3cd3e08e0Romain Guy    if (writer.size() == 0) {
205034de6b1ec561797a2422314e6ef03e3cd3e08e0Romain Guy        return;
206034de6b1ec561797a2422314e6ef03e3cd3e08e0Romain Guy    }
207034de6b1ec561797a2422314e6ef03e3cd3e08e0Romain Guy
20865b345fa22b878e141b8fd8ece9c208df00fa40fRomain Guy    mSize = writer.size();
20965b345fa22b878e141b8fd8ece9c208df00fa40fRomain Guy    void* buffer = sk_malloc_throw(mSize);
210b051e895ccb696604349c6c5efe7c4747e1d1ab6Romain Guy    writer.flatten(buffer);
21165b345fa22b878e141b8fd8ece9c208df00fa40fRomain Guy    mReader.setMemory(buffer, mSize);
212b051e895ccb696604349c6c5efe7c4747e1d1ab6Romain Guy
21354c1a64d5441a964890b44280e4457e11f4f924aRomain Guy    mFunctorCount = recorder.getFunctorCount();
21454c1a64d5441a964890b44280e4457e11f4f924aRomain Guy
2155c13d89c1332fcc499379b9064b891187b75ca32Chet Haase    Caches& caches = Caches::getInstance();
21654c1a64d5441a964890b44280e4457e11f4f924aRomain Guy    caches.registerFunctors(mFunctorCount);
21758ecc204fbcacef34806290492384677a330d4d4Romain Guy    caches.resourceCache.lock();
218b051e895ccb696604349c6c5efe7c4747e1d1ab6Romain Guy
21949c5fc0b9e850497233e189ff9dcc71a78ebe6e7Romain Guy    const Vector<SkBitmap*>& bitmapResources = recorder.getBitmapResources();
2205c13d89c1332fcc499379b9064b891187b75ca32Chet Haase    for (size_t i = 0; i < bitmapResources.size(); i++) {
2215c13d89c1332fcc499379b9064b891187b75ca32Chet Haase        SkBitmap* resource = bitmapResources.itemAt(i);
2225c13d89c1332fcc499379b9064b891187b75ca32Chet Haase        mBitmapResources.add(resource);
22358ecc204fbcacef34806290492384677a330d4d4Romain Guy        caches.resourceCache.incrementRefcountLocked(resource);
224b051e895ccb696604349c6c5efe7c4747e1d1ab6Romain Guy    }
225d98aa2de9ab18e09c2be1997f41212740f51f6e6Chet Haase
22649c5fc0b9e850497233e189ff9dcc71a78ebe6e7Romain Guy    const Vector<SkBitmap*> &ownedBitmapResources = recorder.getOwnedBitmapResources();
22749c5fc0b9e850497233e189ff9dcc71a78ebe6e7Romain Guy    for (size_t i = 0; i < ownedBitmapResources.size(); i++) {
22849c5fc0b9e850497233e189ff9dcc71a78ebe6e7Romain Guy        SkBitmap* resource = ownedBitmapResources.itemAt(i);
22949c5fc0b9e850497233e189ff9dcc71a78ebe6e7Romain Guy        mOwnedBitmapResources.add(resource);
23058ecc204fbcacef34806290492384677a330d4d4Romain Guy        caches.resourceCache.incrementRefcountLocked(resource);
23149c5fc0b9e850497233e189ff9dcc71a78ebe6e7Romain Guy    }
23249c5fc0b9e850497233e189ff9dcc71a78ebe6e7Romain Guy
23349c5fc0b9e850497233e189ff9dcc71a78ebe6e7Romain Guy    const Vector<SkiaColorFilter*>& filterResources = recorder.getFilterResources();
234d586ad9c9fec80aa1d24d6b53cd2c8d5b47fe868Romain Guy    for (size_t i = 0; i < filterResources.size(); i++) {
235d586ad9c9fec80aa1d24d6b53cd2c8d5b47fe868Romain Guy        SkiaColorFilter* resource = filterResources.itemAt(i);
236d586ad9c9fec80aa1d24d6b53cd2c8d5b47fe868Romain Guy        mFilterResources.add(resource);
23758ecc204fbcacef34806290492384677a330d4d4Romain Guy        caches.resourceCache.incrementRefcountLocked(resource);
238d586ad9c9fec80aa1d24d6b53cd2c8d5b47fe868Romain Guy    }
239d586ad9c9fec80aa1d24d6b53cd2c8d5b47fe868Romain Guy
24049c5fc0b9e850497233e189ff9dcc71a78ebe6e7Romain Guy    const Vector<SkiaShader*>& shaders = recorder.getShaders();
24124c00216687ac87fe531dc4d4168ac0c0ca04ea6Romain Guy    for (size_t i = 0; i < shaders.size(); i++) {
242d586ad9c9fec80aa1d24d6b53cd2c8d5b47fe868Romain Guy        SkiaShader* resource = shaders.itemAt(i);
243d586ad9c9fec80aa1d24d6b53cd2c8d5b47fe868Romain Guy        mShaders.add(resource);
24458ecc204fbcacef34806290492384677a330d4d4Romain Guy        caches.resourceCache.incrementRefcountLocked(resource);
24558ecc204fbcacef34806290492384677a330d4d4Romain Guy    }
24658ecc204fbcacef34806290492384677a330d4d4Romain Guy
24758ecc204fbcacef34806290492384677a330d4d4Romain Guy    const SortedVector<SkPath*>& sourcePaths = recorder.getSourcePaths();
24858ecc204fbcacef34806290492384677a330d4d4Romain Guy    for (size_t i = 0; i < sourcePaths.size(); i++) {
24958ecc204fbcacef34806290492384677a330d4d4Romain Guy        mSourcePaths.add(sourcePaths.itemAt(i));
25058ecc204fbcacef34806290492384677a330d4d4Romain Guy        caches.resourceCache.incrementRefcountLocked(sourcePaths.itemAt(i));
251b051e895ccb696604349c6c5efe7c4747e1d1ab6Romain Guy    }
252b051e895ccb696604349c6c5efe7c4747e1d1ab6Romain Guy
253603f6de35f21d74ae242d52d501f4f5c25ff4f4cChet Haase    const Vector<Layer*>& layers = recorder.getLayers();
254603f6de35f21d74ae242d52d501f4f5c25ff4f4cChet Haase    for (size_t i = 0; i < layers.size(); i++) {
255603f6de35f21d74ae242d52d501f4f5c25ff4f4cChet Haase        mLayers.add(layers.itemAt(i));
256603f6de35f21d74ae242d52d501f4f5c25ff4f4cChet Haase        caches.resourceCache.incrementRefcountLocked(layers.itemAt(i));
257603f6de35f21d74ae242d52d501f4f5c25ff4f4cChet Haase    }
258603f6de35f21d74ae242d52d501f4f5c25ff4f4cChet Haase
25958ecc204fbcacef34806290492384677a330d4d4Romain Guy    caches.resourceCache.unlock();
26058ecc204fbcacef34806290492384677a330d4d4Romain Guy
26149c5fc0b9e850497233e189ff9dcc71a78ebe6e7Romain Guy    const Vector<SkPaint*>& paints = recorder.getPaints();
262d98aa2de9ab18e09c2be1997f41212740f51f6e6Chet Haase    for (size_t i = 0; i < paints.size(); i++) {
263d98aa2de9ab18e09c2be1997f41212740f51f6e6Chet Haase        mPaints.add(paints.itemAt(i));
264d98aa2de9ab18e09c2be1997f41212740f51f6e6Chet Haase    }
265d98aa2de9ab18e09c2be1997f41212740f51f6e6Chet Haase
26649c5fc0b9e850497233e189ff9dcc71a78ebe6e7Romain Guy    const Vector<SkPath*>& paths = recorder.getPaths();
2672fc941e4650d618ff6e122f28b616d9032ffa134Romain Guy    for (size_t i = 0; i < paths.size(); i++) {
2682fc941e4650d618ff6e122f28b616d9032ffa134Romain Guy        mPaths.add(paths.itemAt(i));
2692fc941e4650d618ff6e122f28b616d9032ffa134Romain Guy    }
2702fc941e4650d618ff6e122f28b616d9032ffa134Romain Guy
27149c5fc0b9e850497233e189ff9dcc71a78ebe6e7Romain Guy    const Vector<SkMatrix*>& matrices = recorder.getMatrices();
272d98aa2de9ab18e09c2be1997f41212740f51f6e6Chet Haase    for (size_t i = 0; i < matrices.size(); i++) {
273d98aa2de9ab18e09c2be1997f41212740f51f6e6Chet Haase        mMatrices.add(matrices.itemAt(i));
274d98aa2de9ab18e09c2be1997f41212740f51f6e6Chet Haase    }
275b051e895ccb696604349c6c5efe7c4747e1d1ab6Romain Guy}
276b051e895ccb696604349c6c5efe7c4747e1d1ab6Romain Guy
277b051e895ccb696604349c6c5efe7c4747e1d1ab6Romain Guyvoid DisplayList::init() {
27865b345fa22b878e141b8fd8ece9c208df00fa40fRomain Guy    mSize = 0;
27904c9d8c2ffd028c35c750bac0a4a7b79e48059b5Romain Guy    mIsRenderable = true;
280034de6b1ec561797a2422314e6ef03e3cd3e08e0Romain Guy    mFunctorCount = 0;
2816a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    mLeft = 0;
2826a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    mTop = 0;
2836a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    mRight = 0;
2846a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    mBottom = 0;
2856a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    mClipChildren = true;
2866a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    mAlpha = 1;
2876a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    mMultipliedAlpha = 255;
2886a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    mHasOverlappingRendering = true;
2896a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    mTranslationX = 0;
2906a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    mTranslationY = 0;
2916a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    mRotation = 0;
2926a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    mRotationX = 0;
2936a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    mRotationY= 0;
2946a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    mScaleX = 1;
2956a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    mScaleY = 1;
2966a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    mPivotX = 0;
2976a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    mPivotY = 0;
2986a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    mCameraDistance = 0;
2996a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    mMatrixDirty = false;
3006a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    mMatrixFlags = 0;
3016a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    mPrevWidth = -1;
3026a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    mPrevHeight = -1;
3036a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    mWidth = 0;
3046a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    mHeight = 0;
3056a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    mPivotExplicitlySet = false;
3066a2d17f71342f981c9df1dc5beff33e30eb3ae2bChet Haase    mCaching = false;
30765b345fa22b878e141b8fd8ece9c208df00fa40fRomain Guy}
30865b345fa22b878e141b8fd8ece9c208df00fa40fRomain Guy
30965b345fa22b878e141b8fd8ece9c208df00fa40fRomain Guysize_t DisplayList::getSize() {
31065b345fa22b878e141b8fd8ece9c208df00fa40fRomain Guy    return mSize;
311b051e895ccb696604349c6c5efe7c4747e1d1ab6Romain Guy}
312b051e895ccb696604349c6c5efe7c4747e1d1ab6Romain Guy
313ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase/**
314ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase * This function is a simplified version of replay(), where we simply retrieve and log the
315ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase * display list. This function should remain in sync with the replay() function.
316ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase */
317ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haasevoid DisplayList::output(OpenGLRenderer& renderer, uint32_t level) {
318ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase    TextContainer text;
319ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase
320ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase    uint32_t count = (level + 1) * 2;
321ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase    char indent[count + 1];
322ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase    for (uint32_t i = 0; i < count; i++) {
323ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase        indent[i] = ' ';
324ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase    }
325ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase    indent[count] = '\0';
326ddf74373616c89e0880a28a2185fd7ce3db91de6Romain Guy    ALOGD("%sStart display list (%p, %s, render=%d)", (char*) indent + 2, this,
327ddf74373616c89e0880a28a2185fd7ce3db91de6Romain Guy            mName.string(), isRenderable());
328ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase
3291271e2cc80b01d577e9db339459ef0222bb9320dChet Haase    ALOGD("%s%s %d", indent, "Save", SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag);
330ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase    int saveCount = renderer.getSaveCount() - 1;
331ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase
332a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase    outputViewProperties(renderer, (char*) indent);
333ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase    mReader.rewind();
334ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase
335ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase    while (!mReader.eof()) {
336ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase        int op = mReader.readInt();
33733f6beb10f98e8ba96250e284876d607055d278dRomain Guy        if (op & OP_MAY_BE_SKIPPED_MASK) {
33833f6beb10f98e8ba96250e284876d607055d278dRomain Guy            int skip = mReader.readInt();
33933f6beb10f98e8ba96250e284876d607055d278dRomain Guy            ALOGD("%sSkip %d", (char*) indent, skip);
34033f6beb10f98e8ba96250e284876d607055d278dRomain Guy            op &= ~OP_MAY_BE_SKIPPED_MASK;
341a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase        }
342ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase
343ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase        switch (op) {
344ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case DrawGLFunction: {
345ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                Functor *functor = (Functor *) getInt();
3465baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s %p", (char*) indent, OP_NAMES[op], functor);
347ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
348ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
349ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case Save: {
350ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                int rendererNum = getInt();
3515baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s %d", (char*) indent, OP_NAMES[op], rendererNum);
352ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
353ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
354ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case Restore: {
3555baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s", (char*) indent, OP_NAMES[op]);
356ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
357ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
358ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case RestoreToCount: {
359ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                int restoreCount = saveCount + getInt();
3605baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s %d", (char*) indent, OP_NAMES[op], restoreCount);
361ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
362ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
363ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case SaveLayer: {
364ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f1 = getFloat();
365ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f2 = getFloat();
366ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f3 = getFloat();
367ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f4 = getFloat();
3685ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy                SkPaint* paint = getPaint(renderer);
369ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                int flags = getInt();
3705baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %p, 0x%x", (char*) indent,
371a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                        OP_NAMES[op], f1, f2, f3, f4, paint, flags);
372ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
373ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
374ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case SaveLayerAlpha: {
375ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f1 = getFloat();
376ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f2 = getFloat();
377ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f3 = getFloat();
378ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f4 = getFloat();
379ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                int alpha = getInt();
380ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                int flags = getInt();
3815baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %d, 0x%x", (char*) indent,
382a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                        OP_NAMES[op], f1, f2, f3, f4, alpha, flags);
383ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
384ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
385ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case Translate: {
386ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f1 = getFloat();
387ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f2 = getFloat();
3885baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s %.2f, %.2f", (char*) indent, OP_NAMES[op], f1, f2);
389ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
390ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
391ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case Rotate: {
392ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float rotation = getFloat();
3935baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s %.2f", (char*) indent, OP_NAMES[op], rotation);
394ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
395ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
396ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case Scale: {
397ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float sx = getFloat();
398ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float sy = getFloat();
3995baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s %.2f, %.2f", (char*) indent, OP_NAMES[op], sx, sy);
400ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
401ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
402ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case Skew: {
403ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float sx = getFloat();
404ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float sy = getFloat();
4055baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s %.2f, %.2f", (char*) indent, OP_NAMES[op], sx, sy);
406ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
407ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
408ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case SetMatrix: {
409ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                SkMatrix* matrix = getMatrix();
4105baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s %p", (char*) indent, OP_NAMES[op], matrix);
411ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
412ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
413ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case ConcatMatrix: {
414ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                SkMatrix* matrix = getMatrix();
415a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                ALOGD("%s%s new concat %p: [%f, %f, %f]   [%f, %f, %f]   [%f, %f, %f]",
416a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                        (char*) indent, OP_NAMES[op], matrix, matrix->get(0), matrix->get(1),
417a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                        matrix->get(2), matrix->get(3), matrix->get(4), matrix->get(5),
418a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                        matrix->get(6), matrix->get(7), matrix->get(8));
419ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
420ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
421ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case ClipRect: {
422ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f1 = getFloat();
423ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f2 = getFloat();
424ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f3 = getFloat();
425ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f4 = getFloat();
426ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                int regionOp = getInt();
4275baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %d", (char*) indent, OP_NAMES[op],
428a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                        f1, f2, f3, f4, regionOp);
429ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
430ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
431ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case DrawDisplayList: {
432ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                DisplayList* displayList = getDisplayList();
43333f6beb10f98e8ba96250e284876d607055d278dRomain Guy                int32_t flags = getInt();
43433f6beb10f98e8ba96250e284876d607055d278dRomain Guy                ALOGD("%s%s %p, %dx%d, 0x%x %d", (char*) indent, OP_NAMES[op],
4351271e2cc80b01d577e9db339459ef0222bb9320dChet Haase                        displayList, mWidth, mHeight, flags, level + 1);
436ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                renderer.outputDisplayList(displayList, level + 1);
437ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
438ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
439ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case DrawLayer: {
440ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                Layer* layer = (Layer*) getInt();
441ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float x = getFloat();
442ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float y = getFloat();
4435ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy                SkPaint* paint = getPaint(renderer);
4445baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s %p, %.2f, %.2f, %p", (char*) indent, OP_NAMES[op],
445a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                        layer, x, y, paint);
446ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
447ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
448ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case DrawBitmap: {
449ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                SkBitmap* bitmap = getBitmap();
450ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float x = getFloat();
451ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float y = getFloat();
4525ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy                SkPaint* paint = getPaint(renderer);
4535baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s %p, %.2f, %.2f, %p", (char*) indent, OP_NAMES[op],
454a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                        bitmap, x, y, paint);
455ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
456ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
457ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case DrawBitmapMatrix: {
458ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                SkBitmap* bitmap = getBitmap();
459ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                SkMatrix* matrix = getMatrix();
4605ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy                SkPaint* paint = getPaint(renderer);
4615baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s %p, %p, %p", (char*) indent, OP_NAMES[op],
462a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                        bitmap, matrix, paint);
463ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
464ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
465ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case DrawBitmapRect: {
466ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                SkBitmap* bitmap = getBitmap();
467ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f1 = getFloat();
468ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f2 = getFloat();
469ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f3 = getFloat();
470ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f4 = getFloat();
471ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f5 = getFloat();
472ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f6 = getFloat();
473ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f7 = getFloat();
474ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f8 = getFloat();
4755ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy                SkPaint* paint = getPaint(renderer);
4765baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s %p, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %p",
477a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                        (char*) indent, OP_NAMES[op], bitmap, f1, f2, f3, f4, f5, f6, f7, f8, paint);
478ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
479ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
480e651cc6239616a202f6e96ebc2ed93b4b8b3627cRomain Guy            case DrawBitmapData: {
481e651cc6239616a202f6e96ebc2ed93b4b8b3627cRomain Guy                SkBitmap* bitmap = getBitmapData();
482e651cc6239616a202f6e96ebc2ed93b4b8b3627cRomain Guy                float x = getFloat();
483e651cc6239616a202f6e96ebc2ed93b4b8b3627cRomain Guy                float y = getFloat();
484e651cc6239616a202f6e96ebc2ed93b4b8b3627cRomain Guy                SkPaint* paint = getPaint(renderer);
485e651cc6239616a202f6e96ebc2ed93b4b8b3627cRomain Guy                ALOGD("%s%s %.2f, %.2f, %p", (char*) indent, OP_NAMES[op], x, y, paint);
486e651cc6239616a202f6e96ebc2ed93b4b8b3627cRomain Guy            }
487e651cc6239616a202f6e96ebc2ed93b4b8b3627cRomain Guy            break;
488ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case DrawBitmapMesh: {
489ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                int verticesCount = 0;
490ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                uint32_t colorsCount = 0;
491ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                SkBitmap* bitmap = getBitmap();
492ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                uint32_t meshWidth = getInt();
493ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                uint32_t meshHeight = getInt();
494ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float* vertices = getFloats(verticesCount);
495ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                bool hasColors = getInt();
496ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                int* colors = hasColors ? getInts(colorsCount) : NULL;
4975ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy                SkPaint* paint = getPaint(renderer);
4985baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s", (char*) indent, OP_NAMES[op]);
499ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
500ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
501ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case DrawPatch: {
502ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                int32_t* xDivs = NULL;
503ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                int32_t* yDivs = NULL;
504ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                uint32_t* colors = NULL;
505ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                uint32_t xDivsCount = 0;
506ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                uint32_t yDivsCount = 0;
507ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                int8_t numColors = 0;
508ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                SkBitmap* bitmap = getBitmap();
509ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                xDivs = getInts(xDivsCount);
510ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                yDivs = getInts(yDivsCount);
511ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                colors = getUInts(numColors);
512a62f172215727a1e00af0cb934904e00926a86c9Romain Guy                float left = getFloat();
513a62f172215727a1e00af0cb934904e00926a86c9Romain Guy                float top = getFloat();
514a62f172215727a1e00af0cb934904e00926a86c9Romain Guy                float right = getFloat();
515a62f172215727a1e00af0cb934904e00926a86c9Romain Guy                float bottom = getFloat();
516be6f9dc1e71b425b7ac1c40c0a2c72d03eb9fbeeRomain Guy                int alpha = getInt();
517be6f9dc1e71b425b7ac1c40c0a2c72d03eb9fbeeRomain Guy                SkXfermode::Mode mode = (SkXfermode::Mode) getInt();
5185baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s %.2f, %.2f, %.2f, %.2f", (char*) indent, OP_NAMES[op],
519a62f172215727a1e00af0cb934904e00926a86c9Romain Guy                        left, top, right, bottom);
520ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
521ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
522ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case DrawColor: {
523ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                int color = getInt();
524ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                int xferMode = getInt();
5255baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s 0x%x %d", (char*) indent, OP_NAMES[op], color, xferMode);
526ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
527ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
528ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case DrawRect: {
529ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f1 = getFloat();
530ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f2 = getFloat();
531ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f3 = getFloat();
532ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f4 = getFloat();
5335ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy                SkPaint* paint = getPaint(renderer);
5345baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %p", (char*) indent, OP_NAMES[op],
535a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                        f1, f2, f3, f4, paint);
536ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
537ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
538ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case DrawRoundRect: {
539ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f1 = getFloat();
540ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f2 = getFloat();
541ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f3 = getFloat();
542ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f4 = getFloat();
543ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f5 = getFloat();
544ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f6 = getFloat();
5455ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy                SkPaint* paint = getPaint(renderer);
5465baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %p",
547a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                        (char*) indent, OP_NAMES[op], f1, f2, f3, f4, f5, f6, paint);
548ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
549ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
550ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case DrawCircle: {
551ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f1 = getFloat();
552ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f2 = getFloat();
553ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f3 = getFloat();
5545ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy                SkPaint* paint = getPaint(renderer);
5555baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s %.2f, %.2f, %.2f, %p",
556a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                        (char*) indent, OP_NAMES[op], f1, f2, f3, paint);
557ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
558ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
559ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case DrawOval: {
560ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f1 = getFloat();
561ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f2 = getFloat();
562ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f3 = getFloat();
563ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f4 = getFloat();
5645ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy                SkPaint* paint = getPaint(renderer);
5655baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %p",
566a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                        (char*) indent, OP_NAMES[op], f1, f2, f3, f4, paint);
567ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
568ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
569ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case DrawArc: {
570ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f1 = getFloat();
571ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f2 = getFloat();
572ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f3 = getFloat();
573ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f4 = getFloat();
574ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f5 = getFloat();
575ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float f6 = getFloat();
576ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                int i1 = getInt();
5775ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy                SkPaint* paint = getPaint(renderer);
5785baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %d, %p",
579a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                        (char*) indent, OP_NAMES[op], f1, f2, f3, f4, f5, f6, i1, paint);
580ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
581ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
582ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case DrawPath: {
583ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                SkPath* path = getPath();
5845ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy                SkPaint* paint = getPaint(renderer);
5855baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s %p, %p", (char*) indent, OP_NAMES[op], path, paint);
586ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
587ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
588ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case DrawLines: {
589ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                int count = 0;
590ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float* points = getFloats(count);
5915ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy                SkPaint* paint = getPaint(renderer);
5925baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s", (char*) indent, OP_NAMES[op]);
593ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
594ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
595ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case DrawPoints: {
596ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                int count = 0;
597ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float* points = getFloats(count);
5985ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy                SkPaint* paint = getPaint(renderer);
5995baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s", (char*) indent, OP_NAMES[op]);
600ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
601ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
602325740fb444af8fc7fb0119b2e30ce322c2ae134Romain Guy            case DrawTextOnPath: {
603325740fb444af8fc7fb0119b2e30ce322c2ae134Romain Guy                getText(&text);
604325740fb444af8fc7fb0119b2e30ce322c2ae134Romain Guy                int32_t count = getInt();
605325740fb444af8fc7fb0119b2e30ce322c2ae134Romain Guy                SkPath* path = getPath();
606325740fb444af8fc7fb0119b2e30ce322c2ae134Romain Guy                float hOffset = getFloat();
607325740fb444af8fc7fb0119b2e30ce322c2ae134Romain Guy                float vOffset = getFloat();
608325740fb444af8fc7fb0119b2e30ce322c2ae134Romain Guy                SkPaint* paint = getPaint(renderer);
609325740fb444af8fc7fb0119b2e30ce322c2ae134Romain Guy                ALOGD("%s%s %s, %d, %d, %p", (char*) indent, OP_NAMES[op],
610325740fb444af8fc7fb0119b2e30ce322c2ae134Romain Guy                    text.text(), text.length(), count, paint);
611325740fb444af8fc7fb0119b2e30ce322c2ae134Romain Guy            }
612325740fb444af8fc7fb0119b2e30ce322c2ae134Romain Guy            break;
613eb9a5367e8f0e970db8509ffb2584f5376bc62edRomain Guy            case DrawPosText: {
614eb9a5367e8f0e970db8509ffb2584f5376bc62edRomain Guy                getText(&text);
615eb9a5367e8f0e970db8509ffb2584f5376bc62edRomain Guy                int count = getInt();
616eb9a5367e8f0e970db8509ffb2584f5376bc62edRomain Guy                int positionsCount = 0;
617eb9a5367e8f0e970db8509ffb2584f5376bc62edRomain Guy                float* positions = getFloats(positionsCount);
6185ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy                SkPaint* paint = getPaint(renderer);
619eb9a5367e8f0e970db8509ffb2584f5376bc62edRomain Guy                ALOGD("%s%s %s, %d, %d, %p", (char*) indent, OP_NAMES[op],
620a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                        text.text(), text.length(), count, paint);
621eb9a5367e8f0e970db8509ffb2584f5376bc62edRomain Guy            }
622996e57c84368058be793897ebc355b917a59abc2Raph Levien            break;
623c25259519f1b74bb62a2b051b74537f073436b5cRomain Guy            case DrawText: {
624996e57c84368058be793897ebc355b917a59abc2Raph Levien                getText(&text);
62518edb81172daa9b98b53d226d94fc03249b1adedRomain Guy                int32_t count = getInt();
62618edb81172daa9b98b53d226d94fc03249b1adedRomain Guy                float x = getFloat();
62718edb81172daa9b98b53d226d94fc03249b1adedRomain Guy                float y = getFloat();
62818edb81172daa9b98b53d226d94fc03249b1adedRomain Guy                int32_t positionsCount = 0;
629996e57c84368058be793897ebc355b917a59abc2Raph Levien                float* positions = getFloats(positionsCount);
630996e57c84368058be793897ebc355b917a59abc2Raph Levien                SkPaint* paint = getPaint(renderer);
63118edb81172daa9b98b53d226d94fc03249b1adedRomain Guy                float length = getFloat();
632996e57c84368058be793897ebc355b917a59abc2Raph Levien                ALOGD("%s%s %s, %d, %d, %p", (char*) indent, OP_NAMES[op],
633996e57c84368058be793897ebc355b917a59abc2Raph Levien                        text.text(), text.length(), count, paint);
634996e57c84368058be793897ebc355b917a59abc2Raph Levien            }
635996e57c84368058be793897ebc355b917a59abc2Raph Levien            break;
636ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case ResetShader: {
6375baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s", (char*) indent, OP_NAMES[op]);
638ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
639ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
640ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case SetupShader: {
641ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                SkiaShader* shader = getShader();
6425baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s %p", (char*) indent, OP_NAMES[op], shader);
643ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
644ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
645ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case ResetColorFilter: {
6465baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s", (char*) indent, OP_NAMES[op]);
647ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
648ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
649ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case SetupColorFilter: {
650ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                SkiaColorFilter *colorFilter = getColorFilter();
6515baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s %p", (char*) indent, OP_NAMES[op], colorFilter);
652ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
653ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
654ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case ResetShadow: {
6555baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s", (char*) indent, OP_NAMES[op]);
656ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
657ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
658ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            case SetupShadow: {
659ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float radius = getFloat();
660ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float dx = getFloat();
661ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                float dy = getFloat();
662ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                int color = getInt();
6635baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("%s%s %.2f, %.2f, %.2f, 0x%x", (char*) indent, OP_NAMES[op],
664a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                        radius, dx, dy, color);
665ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            }
666ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            break;
6675ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy            case ResetPaintFilter: {
6685ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy                ALOGD("%s%s", (char*) indent, OP_NAMES[op]);
6695ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy            }
6705ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy            break;
6715ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy            case SetupPaintFilter: {
6725ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy                int clearBits = getInt();
6735ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy                int setBits = getInt();
6745ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy                ALOGD("%s%s 0x%x, 0x%x", (char*) indent, OP_NAMES[op], clearBits, setBits);
6755ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy            }
6765ff9df658230d49e42c43586997a02d8e4dd417eRomain Guy            break;
677ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase            default:
6785baa3a62a97544669fba6d65a11c07f252e654ddSteve Block                ALOGD("Display List error: op not handled: %s%s",
679a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                        (char*) indent, OP_NAMES[op]);
680ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase                break;
681ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase        }
682ed30fd8e9a2d65ee5c8520de55b0089c219f390cChet Haase    }
683a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase    ALOGD("%sDone (%p, %s)", (char*) indent + 2, this, mName.string());
684a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase}
685a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase
686a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haasevoid DisplayList::updateMatrix() {
687a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase    if (mMatrixDirty) {
688a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase        if (!mTransformMatrix) {
689a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase            mTransformMatrix = new SkMatrix();
690a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase        }
691a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase        if (mMatrixFlags == 0 || mMatrixFlags == TRANSLATION) {
692a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase            mTransformMatrix->reset();
693a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase        } else {
694a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase            if (!mPivotExplicitlySet) {
695a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                if (mWidth != mPrevWidth || mHeight != mPrevHeight) {
696a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                    mPrevWidth = mWidth;
697a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                    mPrevHeight = mHeight;
698a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                    mPivotX = mPrevWidth / 2;
699a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                    mPivotY = mPrevHeight / 2;
700a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                }
701a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase            }
702a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase            if ((mMatrixFlags & ROTATION_3D) == 0) {
703a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                mTransformMatrix->setTranslate(mTranslationX, mTranslationY);
704a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                mTransformMatrix->preRotate(mRotation, mPivotX, mPivotY);
705a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                mTransformMatrix->preScale(mScaleX, mScaleY, mPivotX, mPivotY);
706a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase            } else {
707a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                if (!mTransformCamera) {
708a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                    mTransformCamera = new Sk3DView();
709a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                    mTransformMatrix3D = new SkMatrix();
710a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                }
711a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                mTransformMatrix->reset();
712a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                mTransformCamera->save();
713a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                mTransformMatrix->preScale(mScaleX, mScaleY, mPivotX, mPivotY);
714a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                mTransformCamera->rotateX(mRotationX);
715a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                mTransformCamera->rotateY(mRotationY);
716a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                mTransformCamera->rotateZ(-mRotation);
717a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                mTransformCamera->getMatrix(mTransformMatrix3D);
718a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                mTransformMatrix3D->preTranslate(-mPivotX, -mPivotY);
719a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                mTransformMatrix3D->postTranslate(mPivotX + mTranslationX,
720a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                        mPivotY + mTranslationY);
721a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                mTransformMatrix->postConcat(*mTransformMatrix3D);
722a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase                mTransformCamera->restore();
723a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase            }
724a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase        }
725a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase        mMatrixDirty = false;
726a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase    }
727a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase}
728a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haase
729a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3Chet Haasevoid DisplayList::outputViewProperties(OpenGLRenderer& renderer, char* indent) {
7301271e2cc80b01d577e9db339459ef0222bb9320dChet Haase    updateMatrix();
7311271e2cc80b01d577e9db339459ef0222bb9320dChet Haase    if (mLeft != 0 || mTop != 0) {
7321271e2cc80b01d577e9db339459ef0222bb9320dChet Haase        ALOGD("%s%s %d, %d", indent, "Translate (left, top)", mLeft, mTop);
7331271e2cc80b01d577e9db339459ef0222bb9320dChet Haase    }
7341271e2cc80b01d577e9db339459ef0222bb9320dChet Haase    if (mStaticMatrix) {
7351271e2cc80b01d577e9db339459ef0222bb9320dChet Haase        ALOGD("%s%s %p: [%.2f, %.2f, %.2f] [%.