Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 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 | |
Chris Craik | f57776b | 2013-10-25 18:30:17 -0700 | [diff] [blame^] | 17 | #define ATRACE_TAG ATRACE_TAG_VIEW |
| 18 | |
Romain Guy | c46d07a | 2013-03-15 19:06:39 -0700 | [diff] [blame] | 19 | #include <SkCanvas.h> |
| 20 | |
Chris Craik | f57776b | 2013-10-25 18:30:17 -0700 | [diff] [blame^] | 21 | #include <utils/Trace.h> |
| 22 | |
Chris Craik | c3566d0 | 2013-02-04 16:16:33 -0800 | [diff] [blame] | 23 | #include "Debug.h" |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 24 | #include "DisplayList.h" |
| 25 | #include "DisplayListOp.h" |
| 26 | #include "DisplayListLogBuffer.h" |
| 27 | |
| 28 | namespace android { |
| 29 | namespace uirenderer { |
| 30 | |
| 31 | void DisplayList::outputLogBuffer(int fd) { |
| 32 | DisplayListLogBuffer& logBuffer = DisplayListLogBuffer::getInstance(); |
| 33 | if (logBuffer.isEmpty()) { |
| 34 | return; |
| 35 | } |
| 36 | |
| 37 | FILE *file = fdopen(fd, "a"); |
| 38 | |
| 39 | fprintf(file, "\nRecent DisplayList operations\n"); |
| 40 | logBuffer.outputCommands(file); |
| 41 | |
| 42 | String8 cachesLog; |
| 43 | Caches::getInstance().dumpMemoryUsage(cachesLog); |
| 44 | fprintf(file, "\nCaches:\n%s", cachesLog.string()); |
| 45 | fprintf(file, "\n"); |
| 46 | |
| 47 | fflush(file); |
| 48 | } |
| 49 | |
| 50 | DisplayList::DisplayList(const DisplayListRenderer& recorder) : |
Chris Craik | 9846de6 | 2013-06-12 16:23:00 -0700 | [diff] [blame] | 51 | mDestroyed(false), mTransformMatrix(NULL), mTransformCamera(NULL), mTransformMatrix3D(NULL), |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 52 | mStaticMatrix(NULL), mAnimationMatrix(NULL) { |
| 53 | |
| 54 | initFromDisplayListRenderer(recorder); |
| 55 | } |
| 56 | |
| 57 | DisplayList::~DisplayList() { |
Chris Craik | 9846de6 | 2013-06-12 16:23:00 -0700 | [diff] [blame] | 58 | mDestroyed = true; |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 59 | clearResources(); |
| 60 | } |
| 61 | |
| 62 | void DisplayList::destroyDisplayListDeferred(DisplayList* displayList) { |
| 63 | if (displayList) { |
| 64 | DISPLAY_LIST_LOGD("Deferring display list destruction"); |
| 65 | Caches::getInstance().deleteDisplayListDeferred(displayList); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | void DisplayList::clearResources() { |
| 70 | mDisplayListData = NULL; |
Chris Craik | ff78583 | 2013-03-08 13:12:16 -0800 | [diff] [blame] | 71 | |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 72 | delete mTransformMatrix; |
| 73 | delete mTransformCamera; |
| 74 | delete mTransformMatrix3D; |
| 75 | delete mStaticMatrix; |
| 76 | delete mAnimationMatrix; |
| 77 | |
| 78 | mTransformMatrix = NULL; |
| 79 | mTransformCamera = NULL; |
| 80 | mTransformMatrix3D = NULL; |
| 81 | mStaticMatrix = NULL; |
| 82 | mAnimationMatrix = NULL; |
| 83 | |
| 84 | Caches& caches = Caches::getInstance(); |
| 85 | caches.unregisterFunctors(mFunctorCount); |
| 86 | caches.resourceCache.lock(); |
| 87 | |
| 88 | for (size_t i = 0; i < mBitmapResources.size(); i++) { |
| 89 | caches.resourceCache.decrementRefcountLocked(mBitmapResources.itemAt(i)); |
| 90 | } |
| 91 | |
| 92 | for (size_t i = 0; i < mOwnedBitmapResources.size(); i++) { |
| 93 | SkBitmap* bitmap = mOwnedBitmapResources.itemAt(i); |
| 94 | caches.resourceCache.decrementRefcountLocked(bitmap); |
| 95 | caches.resourceCache.destructorLocked(bitmap); |
| 96 | } |
| 97 | |
| 98 | for (size_t i = 0; i < mFilterResources.size(); i++) { |
| 99 | caches.resourceCache.decrementRefcountLocked(mFilterResources.itemAt(i)); |
| 100 | } |
| 101 | |
Romain Guy | e3b0a01 | 2013-06-26 15:45:41 -0700 | [diff] [blame] | 102 | for (size_t i = 0; i < mPatchResources.size(); i++) { |
| 103 | caches.resourceCache.decrementRefcountLocked(mPatchResources.itemAt(i)); |
| 104 | } |
| 105 | |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 106 | for (size_t i = 0; i < mShaders.size(); i++) { |
| 107 | caches.resourceCache.decrementRefcountLocked(mShaders.itemAt(i)); |
| 108 | caches.resourceCache.destructorLocked(mShaders.itemAt(i)); |
| 109 | } |
| 110 | |
| 111 | for (size_t i = 0; i < mSourcePaths.size(); i++) { |
| 112 | caches.resourceCache.decrementRefcountLocked(mSourcePaths.itemAt(i)); |
| 113 | } |
| 114 | |
| 115 | for (size_t i = 0; i < mLayers.size(); i++) { |
| 116 | caches.resourceCache.decrementRefcountLocked(mLayers.itemAt(i)); |
| 117 | } |
| 118 | |
| 119 | caches.resourceCache.unlock(); |
| 120 | |
| 121 | for (size_t i = 0; i < mPaints.size(); i++) { |
| 122 | delete mPaints.itemAt(i); |
| 123 | } |
| 124 | |
| 125 | for (size_t i = 0; i < mRegions.size(); i++) { |
| 126 | delete mRegions.itemAt(i); |
| 127 | } |
| 128 | |
| 129 | for (size_t i = 0; i < mPaths.size(); i++) { |
Romain Guy | c46d07a | 2013-03-15 19:06:39 -0700 | [diff] [blame] | 130 | delete mPaths.itemAt(i); |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 131 | } |
| 132 | |
| 133 | for (size_t i = 0; i < mMatrices.size(); i++) { |
| 134 | delete mMatrices.itemAt(i); |
| 135 | } |
| 136 | |
| 137 | mBitmapResources.clear(); |
| 138 | mOwnedBitmapResources.clear(); |
| 139 | mFilterResources.clear(); |
Romain Guy | e3b0a01 | 2013-06-26 15:45:41 -0700 | [diff] [blame] | 140 | mPatchResources.clear(); |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 141 | mShaders.clear(); |
| 142 | mSourcePaths.clear(); |
| 143 | mPaints.clear(); |
| 144 | mRegions.clear(); |
| 145 | mPaths.clear(); |
| 146 | mMatrices.clear(); |
| 147 | mLayers.clear(); |
| 148 | } |
| 149 | |
| 150 | void DisplayList::reset() { |
| 151 | clearResources(); |
| 152 | init(); |
| 153 | } |
| 154 | |
| 155 | void DisplayList::initFromDisplayListRenderer(const DisplayListRenderer& recorder, bool reusing) { |
| 156 | if (reusing) { |
| 157 | // re-using display list - clear out previous allocations |
| 158 | clearResources(); |
| 159 | } |
| 160 | |
| 161 | init(); |
| 162 | |
| 163 | mDisplayListData = recorder.getDisplayListData(); |
| 164 | mSize = mDisplayListData->allocator.usedSize(); |
| 165 | |
| 166 | if (mSize == 0) { |
| 167 | return; |
| 168 | } |
| 169 | |
| 170 | mFunctorCount = recorder.getFunctorCount(); |
| 171 | |
| 172 | Caches& caches = Caches::getInstance(); |
| 173 | caches.registerFunctors(mFunctorCount); |
| 174 | caches.resourceCache.lock(); |
| 175 | |
| 176 | const Vector<SkBitmap*>& bitmapResources = recorder.getBitmapResources(); |
| 177 | for (size_t i = 0; i < bitmapResources.size(); i++) { |
| 178 | SkBitmap* resource = bitmapResources.itemAt(i); |
| 179 | mBitmapResources.add(resource); |
| 180 | caches.resourceCache.incrementRefcountLocked(resource); |
| 181 | } |
| 182 | |
| 183 | const Vector<SkBitmap*> &ownedBitmapResources = recorder.getOwnedBitmapResources(); |
| 184 | for (size_t i = 0; i < ownedBitmapResources.size(); i++) { |
| 185 | SkBitmap* resource = ownedBitmapResources.itemAt(i); |
| 186 | mOwnedBitmapResources.add(resource); |
| 187 | caches.resourceCache.incrementRefcountLocked(resource); |
| 188 | } |
| 189 | |
| 190 | const Vector<SkiaColorFilter*>& filterResources = recorder.getFilterResources(); |
| 191 | for (size_t i = 0; i < filterResources.size(); i++) { |
| 192 | SkiaColorFilter* resource = filterResources.itemAt(i); |
| 193 | mFilterResources.add(resource); |
| 194 | caches.resourceCache.incrementRefcountLocked(resource); |
| 195 | } |
| 196 | |
Romain Guy | e3b0a01 | 2013-06-26 15:45:41 -0700 | [diff] [blame] | 197 | const Vector<Res_png_9patch*>& patchResources = recorder.getPatchResources(); |
| 198 | for (size_t i = 0; i < patchResources.size(); i++) { |
| 199 | Res_png_9patch* resource = patchResources.itemAt(i); |
| 200 | mPatchResources.add(resource); |
| 201 | caches.resourceCache.incrementRefcountLocked(resource); |
| 202 | } |
| 203 | |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 204 | const Vector<SkiaShader*>& shaders = recorder.getShaders(); |
| 205 | for (size_t i = 0; i < shaders.size(); i++) { |
| 206 | SkiaShader* resource = shaders.itemAt(i); |
| 207 | mShaders.add(resource); |
| 208 | caches.resourceCache.incrementRefcountLocked(resource); |
| 209 | } |
| 210 | |
| 211 | const SortedVector<SkPath*>& sourcePaths = recorder.getSourcePaths(); |
| 212 | for (size_t i = 0; i < sourcePaths.size(); i++) { |
| 213 | mSourcePaths.add(sourcePaths.itemAt(i)); |
| 214 | caches.resourceCache.incrementRefcountLocked(sourcePaths.itemAt(i)); |
| 215 | } |
| 216 | |
| 217 | const Vector<Layer*>& layers = recorder.getLayers(); |
| 218 | for (size_t i = 0; i < layers.size(); i++) { |
| 219 | mLayers.add(layers.itemAt(i)); |
| 220 | caches.resourceCache.incrementRefcountLocked(layers.itemAt(i)); |
| 221 | } |
| 222 | |
| 223 | caches.resourceCache.unlock(); |
| 224 | |
| 225 | mPaints.appendVector(recorder.getPaints()); |
| 226 | mRegions.appendVector(recorder.getRegions()); |
| 227 | mPaths.appendVector(recorder.getPaths()); |
| 228 | mMatrices.appendVector(recorder.getMatrices()); |
| 229 | } |
| 230 | |
| 231 | void DisplayList::init() { |
| 232 | mSize = 0; |
| 233 | mIsRenderable = true; |
| 234 | mFunctorCount = 0; |
| 235 | mLeft = 0; |
| 236 | mTop = 0; |
| 237 | mRight = 0; |
| 238 | mBottom = 0; |
Chet Haase | dd67159 | 2013-04-19 14:54:34 -0700 | [diff] [blame] | 239 | mClipToBounds = true; |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 240 | mAlpha = 1; |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 241 | mHasOverlappingRendering = true; |
| 242 | mTranslationX = 0; |
| 243 | mTranslationY = 0; |
Chris Craik | f57776b | 2013-10-25 18:30:17 -0700 | [diff] [blame^] | 244 | mTranslationZ = 0; |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 245 | mRotation = 0; |
| 246 | mRotationX = 0; |
| 247 | mRotationY= 0; |
| 248 | mScaleX = 1; |
| 249 | mScaleY = 1; |
| 250 | mPivotX = 0; |
| 251 | mPivotY = 0; |
| 252 | mCameraDistance = 0; |
| 253 | mMatrixDirty = false; |
| 254 | mMatrixFlags = 0; |
| 255 | mPrevWidth = -1; |
| 256 | mPrevHeight = -1; |
| 257 | mWidth = 0; |
| 258 | mHeight = 0; |
| 259 | mPivotExplicitlySet = false; |
| 260 | mCaching = false; |
Chris Craik | f57776b | 2013-10-25 18:30:17 -0700 | [diff] [blame^] | 261 | mIs3dRoot = true; // TODO: setter, java side impl |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 262 | } |
| 263 | |
| 264 | size_t DisplayList::getSize() { |
| 265 | return mSize; |
| 266 | } |
| 267 | |
| 268 | /** |
| 269 | * This function is a simplified version of replay(), where we simply retrieve and log the |
| 270 | * display list. This function should remain in sync with the replay() function. |
| 271 | */ |
| 272 | void DisplayList::output(uint32_t level) { |
Romain Guy | 7031ff6 | 2013-02-22 11:48:16 -0800 | [diff] [blame] | 273 | ALOGD("%*sStart display list (%p, %s, render=%d)", (level - 1) * 2, "", this, |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 274 | mName.string(), isRenderable()); |
Romain Guy | 7031ff6 | 2013-02-22 11:48:16 -0800 | [diff] [blame] | 275 | ALOGD("%*s%s %d", level * 2, "", "Save", |
| 276 | SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag); |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 277 | |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 278 | outputViewProperties(level); |
| 279 | int flags = DisplayListOp::kOpLogFlag_Recurse; |
| 280 | for (unsigned int i = 0; i < mDisplayListData->displayListOps.size(); i++) { |
| 281 | mDisplayListData->displayListOps[i]->output(level, flags); |
| 282 | } |
Romain Guy | 7031ff6 | 2013-02-22 11:48:16 -0800 | [diff] [blame] | 283 | |
| 284 | ALOGD("%*sDone (%p, %s)", (level - 1) * 2, "", this, mName.string()); |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 285 | } |
| 286 | |
Romain Guy | 52036b1 | 2013-02-14 18:03:37 -0800 | [diff] [blame] | 287 | float DisplayList::getPivotX() { |
| 288 | updateMatrix(); |
| 289 | return mPivotX; |
| 290 | } |
| 291 | |
| 292 | float DisplayList::getPivotY() { |
| 293 | updateMatrix(); |
| 294 | return mPivotY; |
| 295 | } |
| 296 | |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 297 | void DisplayList::updateMatrix() { |
| 298 | if (mMatrixDirty) { |
| 299 | if (!mTransformMatrix) { |
| 300 | mTransformMatrix = new SkMatrix(); |
| 301 | } |
| 302 | if (mMatrixFlags == 0 || mMatrixFlags == TRANSLATION) { |
| 303 | mTransformMatrix->reset(); |
| 304 | } else { |
| 305 | if (!mPivotExplicitlySet) { |
| 306 | if (mWidth != mPrevWidth || mHeight != mPrevHeight) { |
| 307 | mPrevWidth = mWidth; |
| 308 | mPrevHeight = mHeight; |
Chet Haase | 259b696 | 2013-05-03 15:25:33 -0700 | [diff] [blame] | 309 | mPivotX = mPrevWidth / 2.0f; |
| 310 | mPivotY = mPrevHeight / 2.0f; |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 311 | } |
| 312 | } |
Chris Craik | f57776b | 2013-10-25 18:30:17 -0700 | [diff] [blame^] | 313 | if (!DEBUG_ENABLE_3D && (mMatrixFlags & ROTATION_3D) == 0) { |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 314 | mTransformMatrix->setTranslate(mTranslationX, mTranslationY); |
| 315 | mTransformMatrix->preRotate(mRotation, mPivotX, mPivotY); |
| 316 | mTransformMatrix->preScale(mScaleX, mScaleY, mPivotX, mPivotY); |
| 317 | } else { |
Chris Craik | f57776b | 2013-10-25 18:30:17 -0700 | [diff] [blame^] | 318 | if (DEBUG_ENABLE_3D) { |
| 319 | mTransform.loadTranslate(mPivotX + mTranslationX, mPivotY + mTranslationY, |
| 320 | mTranslationZ); |
| 321 | mTransform.rotate(mRotationX, 1, 0, 0); |
| 322 | mTransform.rotate(mRotationY, 0, 1, 0); |
| 323 | mTransform.rotate(mRotation, 0, 0, 1); |
| 324 | mTransform.scale(mScaleX, mScaleY, 1); |
| 325 | mTransform.translate(-mPivotX, -mPivotY); |
| 326 | } else { |
| 327 | /* TODO: support this old transform approach, based on API level */ |
| 328 | if (!mTransformCamera) { |
| 329 | mTransformCamera = new Sk3DView(); |
| 330 | mTransformMatrix3D = new SkMatrix(); |
| 331 | } |
| 332 | mTransformMatrix->reset(); |
| 333 | mTransformCamera->save(); |
| 334 | mTransformMatrix->preScale(mScaleX, mScaleY, mPivotX, mPivotY); |
| 335 | mTransformCamera->rotateX(mRotationX); |
| 336 | mTransformCamera->rotateY(mRotationY); |
| 337 | mTransformCamera->rotateZ(-mRotation); |
| 338 | mTransformCamera->getMatrix(mTransformMatrix3D); |
| 339 | mTransformMatrix3D->preTranslate(-mPivotX, -mPivotY); |
| 340 | mTransformMatrix3D->postTranslate(mPivotX + mTranslationX, |
| 341 | mPivotY + mTranslationY); |
| 342 | mTransformMatrix->postConcat(*mTransformMatrix3D); |
| 343 | mTransformCamera->restore(); |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 344 | } |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 345 | } |
| 346 | } |
| 347 | mMatrixDirty = false; |
| 348 | } |
| 349 | } |
| 350 | |
Chris Craik | ff78583 | 2013-03-08 13:12:16 -0800 | [diff] [blame] | 351 | void DisplayList::outputViewProperties(const int level) { |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 352 | updateMatrix(); |
| 353 | if (mLeft != 0 || mTop != 0) { |
| 354 | ALOGD("%*sTranslate (left, top) %d, %d", level * 2, "", mLeft, mTop); |
| 355 | } |
| 356 | if (mStaticMatrix) { |
| 357 | ALOGD("%*sConcatMatrix (static) %p: " MATRIX_STRING, |
| 358 | level * 2, "", mStaticMatrix, MATRIX_ARGS(mStaticMatrix)); |
| 359 | } |
| 360 | if (mAnimationMatrix) { |
| 361 | ALOGD("%*sConcatMatrix (animation) %p: " MATRIX_STRING, |
Chris Craik | 66063ae | 2013-09-05 16:11:18 -0700 | [diff] [blame] | 362 | level * 2, "", mAnimationMatrix, MATRIX_ARGS(mAnimationMatrix)); |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 363 | } |
| 364 | if (mMatrixFlags != 0) { |
| 365 | if (mMatrixFlags == TRANSLATION) { |
| 366 | ALOGD("%*sTranslate %f, %f", level * 2, "", mTranslationX, mTranslationY); |
| 367 | } else { |
| 368 | ALOGD("%*sConcatMatrix %p: " MATRIX_STRING, |
| 369 | level * 2, "", mTransformMatrix, MATRIX_ARGS(mTransformMatrix)); |
| 370 | } |
| 371 | } |
Chris Craik | 39a908c | 2013-06-13 14:39:01 -0700 | [diff] [blame] | 372 | |
Romain Guy | 1de466f | 2013-09-12 16:09:19 -0700 | [diff] [blame] | 373 | bool clipToBoundsNeeded = mCaching ? false : mClipToBounds; |
Chris Craik | 5f80362 | 2013-03-21 14:39:04 -0700 | [diff] [blame] | 374 | if (mAlpha < 1) { |
Chris Craik | 16ecda5 | 2013-03-29 10:59:59 -0700 | [diff] [blame] | 375 | if (mCaching) { |
| 376 | ALOGD("%*sSetOverrideLayerAlpha %.2f", level * 2, "", mAlpha); |
| 377 | } else if (!mHasOverlappingRendering) { |
Chris Craik | 5f80362 | 2013-03-21 14:39:04 -0700 | [diff] [blame] | 378 | ALOGD("%*sScaleAlpha %.2f", level * 2, "", mAlpha); |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 379 | } else { |
| 380 | int flags = SkCanvas::kHasAlphaLayer_SaveFlag; |
Chris Craik | 39a908c | 2013-06-13 14:39:01 -0700 | [diff] [blame] | 381 | if (clipToBoundsNeeded) { |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 382 | flags |= SkCanvas::kClipToLayer_SaveFlag; |
Chris Craik | 39a908c | 2013-06-13 14:39:01 -0700 | [diff] [blame] | 383 | clipToBoundsNeeded = false; // clipping done by save layer |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 384 | } |
| 385 | ALOGD("%*sSaveLayerAlpha %.2f, %.2f, %.2f, %.2f, %d, 0x%x", level * 2, "", |
| 386 | (float) 0, (float) 0, (float) mRight - mLeft, (float) mBottom - mTop, |
Chris Craik | a08f95c | 2013-03-15 17:24:33 -0700 | [diff] [blame] | 387 | (int)(mAlpha * 255), flags); |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 388 | } |
| 389 | } |
Chris Craik | 39a908c | 2013-06-13 14:39:01 -0700 | [diff] [blame] | 390 | if (clipToBoundsNeeded) { |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 391 | ALOGD("%*sClipRect %.2f, %.2f, %.2f, %.2f", level * 2, "", 0.0f, 0.0f, |
| 392 | (float) mRight - mLeft, (float) mBottom - mTop); |
| 393 | } |
| 394 | } |
| 395 | |
Chris Craik | ff78583 | 2013-03-08 13:12:16 -0800 | [diff] [blame] | 396 | /* |
| 397 | * For property operations, we pass a savecount of 0, since the operations aren't part of the |
| 398 | * displaylist, and thus don't have to compensate for the record-time/playback-time discrepancy in |
| 399 | * base saveCount (i.e., how RestoreToCount uses saveCount + mCount) |
| 400 | */ |
| 401 | #define PROPERTY_SAVECOUNT 0 |
| 402 | |
| 403 | template <class T> |
| 404 | void DisplayList::setViewProperties(OpenGLRenderer& renderer, T& handler, |
| 405 | const int level) { |
| 406 | #if DEBUG_DISPLAY_LIST |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 407 | outputViewProperties(level); |
| 408 | #endif |
| 409 | updateMatrix(); |
| 410 | if (mLeft != 0 || mTop != 0) { |
| 411 | renderer.translate(mLeft, mTop); |
| 412 | } |
| 413 | if (mStaticMatrix) { |
| 414 | renderer.concatMatrix(mStaticMatrix); |
| 415 | } else if (mAnimationMatrix) { |
| 416 | renderer.concatMatrix(mAnimationMatrix); |
| 417 | } |
| 418 | if (mMatrixFlags != 0) { |
| 419 | if (mMatrixFlags == TRANSLATION) { |
| 420 | renderer.translate(mTranslationX, mTranslationY); |
Chris Craik | f57776b | 2013-10-25 18:30:17 -0700 | [diff] [blame^] | 421 | renderer.translateZ(mTranslationZ); |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 422 | } else { |
Chris Craik | f57776b | 2013-10-25 18:30:17 -0700 | [diff] [blame^] | 423 | #if DEBUG_ENABLE_3D |
| 424 | renderer.concatMatrix(mTransform); |
| 425 | #else |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 426 | renderer.concatMatrix(mTransformMatrix); |
Chris Craik | f57776b | 2013-10-25 18:30:17 -0700 | [diff] [blame^] | 427 | #endif |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 428 | } |
| 429 | } |
Romain Guy | 1de466f | 2013-09-12 16:09:19 -0700 | [diff] [blame] | 430 | bool clipToBoundsNeeded = mCaching ? false : mClipToBounds; |
Chris Craik | a08f95c | 2013-03-15 17:24:33 -0700 | [diff] [blame] | 431 | if (mAlpha < 1) { |
Chris Craik | 16ecda5 | 2013-03-29 10:59:59 -0700 | [diff] [blame] | 432 | if (mCaching) { |
| 433 | renderer.setOverrideLayerAlpha(mAlpha); |
| 434 | } else if (!mHasOverlappingRendering) { |
Chris Craik | a08f95c | 2013-03-15 17:24:33 -0700 | [diff] [blame] | 435 | renderer.scaleAlpha(mAlpha); |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 436 | } else { |
| 437 | // TODO: should be able to store the size of a DL at record time and not |
| 438 | // have to pass it into this call. In fact, this information might be in the |
| 439 | // location/size info that we store with the new native transform data. |
Chris Craik | ff78583 | 2013-03-08 13:12:16 -0800 | [diff] [blame] | 440 | int saveFlags = SkCanvas::kHasAlphaLayer_SaveFlag; |
Chris Craik | 39a908c | 2013-06-13 14:39:01 -0700 | [diff] [blame] | 441 | if (clipToBoundsNeeded) { |
Chris Craik | ff78583 | 2013-03-08 13:12:16 -0800 | [diff] [blame] | 442 | saveFlags |= SkCanvas::kClipToLayer_SaveFlag; |
Chris Craik | 39a908c | 2013-06-13 14:39:01 -0700 | [diff] [blame] | 443 | clipToBoundsNeeded = false; // clipping done by saveLayer |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 444 | } |
Chris Craik | f57776b | 2013-10-25 18:30:17 -0700 | [diff] [blame^] | 445 | |
| 446 | SaveLayerOp* op = new (handler.allocator()) SaveLayerOp( |
| 447 | 0, 0, mRight - mLeft, mBottom - mTop, |
| 448 | mAlpha * 255, SkXfermode::kSrcOver_Mode, saveFlags); |
| 449 | handler(op, PROPERTY_SAVECOUNT, mClipToBounds); |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 450 | } |
| 451 | } |
Chris Craik | 39a908c | 2013-06-13 14:39:01 -0700 | [diff] [blame] | 452 | if (clipToBoundsNeeded) { |
Chris Craik | f57776b | 2013-10-25 18:30:17 -0700 | [diff] [blame^] | 453 | ClipRectOp* op = new (handler.allocator()) ClipRectOp(0, 0, |
| 454 | mRight - mLeft, mBottom - mTop, SkRegion::kIntersect_Op); |
| 455 | handler(op, PROPERTY_SAVECOUNT, mClipToBounds); |
| 456 | } |
| 457 | } |
| 458 | |
| 459 | /** |
| 460 | * Apply property-based transformations to input matrix |
| 461 | */ |
| 462 | void DisplayList::applyViewPropertyTransforms(mat4& matrix) { |
| 463 | if (mLeft != 0 || mTop != 0) { |
| 464 | matrix.translate(mLeft, mTop); |
| 465 | } |
| 466 | if (mStaticMatrix) { |
| 467 | mat4 stat(*mStaticMatrix); |
| 468 | matrix.multiply(stat); |
| 469 | } else if (mAnimationMatrix) { |
| 470 | mat4 anim(*mAnimationMatrix); |
| 471 | matrix.multiply(anim); |
| 472 | } |
| 473 | if (mMatrixFlags != 0) { |
| 474 | if (mMatrixFlags == TRANSLATION) { |
| 475 | matrix.translate(mTranslationX, mTranslationY, mTranslationZ); |
| 476 | } else { |
| 477 | #if DEBUG_ENABLE_3D |
| 478 | matrix.multiply(mTransform); |
| 479 | #else |
| 480 | mat4 temp(*mTransformMatrix); |
| 481 | matrix.multiply(temp); |
| 482 | #endif |
| 483 | } |
| 484 | } |
| 485 | } |
| 486 | |
| 487 | /** |
| 488 | * Organizes the DisplayList hierarchy to prepare for Z-based draw order. |
| 489 | * |
| 490 | * This should be called before a call to defer() or drawDisplayList() |
| 491 | * |
| 492 | * Each DisplayList that serves as a 3d root builds its list of composited children, |
| 493 | * which are flagged to not draw in the standard draw loop. |
| 494 | */ |
| 495 | void DisplayList::computeOrdering() { |
| 496 | ATRACE_CALL(); |
| 497 | mat4::identity(); |
| 498 | for (unsigned int i = 0; i < mDisplayListData->children.size(); i++) { |
| 499 | DrawDisplayListOp* childOp = mDisplayListData->children[i]; |
| 500 | childOp->mDisplayList->computeOrderingImpl(childOp, &m3dNodes, &mat4::identity()); |
| 501 | } |
| 502 | } |
| 503 | |
| 504 | void DisplayList::computeOrderingImpl( |
| 505 | DrawDisplayListOp* opState, |
| 506 | KeyedVector<float, Vector<DrawDisplayListOp*> >* compositedChildrenOf3dRoot, |
| 507 | const mat4* transformFrom3dRoot) { |
| 508 | // TODO: should avoid this calculation in most cases |
| 509 | opState->mTransformFrom3dRoot.load(*transformFrom3dRoot); |
| 510 | opState->mTransformFrom3dRoot.multiply(opState->mTransformFromParent); |
| 511 | |
| 512 | if (mTranslationZ != 0.0f) { // TODO: other signals, such as custom 4x4 matrix |
| 513 | // composited layer, insert into current 3d root and flag for out of order draw |
| 514 | opState->mSkipInOrderDraw = true; |
| 515 | |
| 516 | Vector3 pivot(mPivotX, mPivotY, 0.0f); |
| 517 | mat4 totalTransform(opState->mTransformFrom3dRoot); |
| 518 | applyViewPropertyTransforms(totalTransform); |
| 519 | totalTransform.mapPoint3d(pivot); |
| 520 | const float key = pivot.z; |
| 521 | |
| 522 | if (compositedChildrenOf3dRoot->indexOfKey(key) < 0) { |
| 523 | compositedChildrenOf3dRoot->add(key, Vector<DrawDisplayListOp*>()); |
| 524 | } |
| 525 | compositedChildrenOf3dRoot->editValueFor(key).push(opState); |
| 526 | } else { |
| 527 | // standard in order draw |
| 528 | opState->mSkipInOrderDraw = false; |
| 529 | } |
| 530 | |
| 531 | m3dNodes.clear(); |
| 532 | if (mIs3dRoot) { |
| 533 | // create a new 3d space for children by separating their ordering |
| 534 | compositedChildrenOf3dRoot = &m3dNodes; |
| 535 | transformFrom3dRoot = &mat4::identity(); |
| 536 | } else { |
| 537 | transformFrom3dRoot = &(opState->mTransformFrom3dRoot); |
| 538 | } |
| 539 | |
| 540 | if (mDisplayListData->children.size() > 0) { |
| 541 | for (unsigned int i = 0; i < mDisplayListData->children.size(); i++) { |
| 542 | DrawDisplayListOp* childOp = mDisplayListData->children[i]; |
| 543 | childOp->mDisplayList->computeOrderingImpl(childOp, |
| 544 | compositedChildrenOf3dRoot, transformFrom3dRoot); |
| 545 | } |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 546 | } |
| 547 | } |
| 548 | |
Chris Craik | ff78583 | 2013-03-08 13:12:16 -0800 | [diff] [blame] | 549 | class DeferOperationHandler { |
| 550 | public: |
Chris Craik | a08f95c | 2013-03-15 17:24:33 -0700 | [diff] [blame] | 551 | DeferOperationHandler(DeferStateStruct& deferStruct, int level) |
| 552 | : mDeferStruct(deferStruct), mLevel(level) {} |
Chet Haase | dd67159 | 2013-04-19 14:54:34 -0700 | [diff] [blame] | 553 | inline void operator()(DisplayListOp* operation, int saveCount, bool clipToBounds) { |
| 554 | operation->defer(mDeferStruct, saveCount, mLevel, clipToBounds); |
Chris Craik | ff78583 | 2013-03-08 13:12:16 -0800 | [diff] [blame] | 555 | } |
Chris Craik | f57776b | 2013-10-25 18:30:17 -0700 | [diff] [blame^] | 556 | inline LinearAllocator& allocator() { return *(mDeferStruct.mAllocator); } |
| 557 | |
Chris Craik | ff78583 | 2013-03-08 13:12:16 -0800 | [diff] [blame] | 558 | private: |
| 559 | DeferStateStruct& mDeferStruct; |
Chris Craik | ff78583 | 2013-03-08 13:12:16 -0800 | [diff] [blame] | 560 | const int mLevel; |
| 561 | }; |
| 562 | |
| 563 | void DisplayList::defer(DeferStateStruct& deferStruct, const int level) { |
Chris Craik | a08f95c | 2013-03-15 17:24:33 -0700 | [diff] [blame] | 564 | DeferOperationHandler handler(deferStruct, level); |
Chris Craik | ff78583 | 2013-03-08 13:12:16 -0800 | [diff] [blame] | 565 | iterate<DeferOperationHandler>(deferStruct.mRenderer, handler, level); |
| 566 | } |
| 567 | |
| 568 | class ReplayOperationHandler { |
| 569 | public: |
Chris Craik | a08f95c | 2013-03-15 17:24:33 -0700 | [diff] [blame] | 570 | ReplayOperationHandler(ReplayStateStruct& replayStruct, int level) |
| 571 | : mReplayStruct(replayStruct), mLevel(level) {} |
Chet Haase | dd67159 | 2013-04-19 14:54:34 -0700 | [diff] [blame] | 572 | inline void operator()(DisplayListOp* operation, int saveCount, bool clipToBounds) { |
Chris Craik | ff78583 | 2013-03-08 13:12:16 -0800 | [diff] [blame] | 573 | #if DEBUG_DISPLAY_LIST_OPS_AS_EVENTS |
Chris Craik | d90144d | 2013-03-19 15:03:48 -0700 | [diff] [blame] | 574 | mReplayStruct.mRenderer.eventMark(operation->name()); |
Chris Craik | ff78583 | 2013-03-08 13:12:16 -0800 | [diff] [blame] | 575 | #endif |
Chet Haase | dd67159 | 2013-04-19 14:54:34 -0700 | [diff] [blame] | 576 | operation->replay(mReplayStruct, saveCount, mLevel, clipToBounds); |
Chris Craik | ff78583 | 2013-03-08 13:12:16 -0800 | [diff] [blame] | 577 | } |
Chris Craik | f57776b | 2013-10-25 18:30:17 -0700 | [diff] [blame^] | 578 | inline LinearAllocator& allocator() { return *(mReplayStruct.mAllocator); } |
| 579 | |
Chris Craik | ff78583 | 2013-03-08 13:12:16 -0800 | [diff] [blame] | 580 | private: |
| 581 | ReplayStateStruct& mReplayStruct; |
Chris Craik | ff78583 | 2013-03-08 13:12:16 -0800 | [diff] [blame] | 582 | const int mLevel; |
| 583 | }; |
| 584 | |
| 585 | void DisplayList::replay(ReplayStateStruct& replayStruct, const int level) { |
Chris Craik | a08f95c | 2013-03-15 17:24:33 -0700 | [diff] [blame] | 586 | ReplayOperationHandler handler(replayStruct, level); |
Chris Craik | ff78583 | 2013-03-08 13:12:16 -0800 | [diff] [blame] | 587 | |
| 588 | replayStruct.mRenderer.startMark(mName.string()); |
| 589 | iterate<ReplayOperationHandler>(replayStruct.mRenderer, handler, level); |
| 590 | replayStruct.mRenderer.endMark(); |
| 591 | |
| 592 | DISPLAY_LIST_LOGD("%*sDone (%p, %s), returning %d", level * 2, "", this, mName.string(), |
| 593 | replayStruct.mDrawGlStatus); |
| 594 | } |
| 595 | |
Chris Craik | f57776b | 2013-10-25 18:30:17 -0700 | [diff] [blame^] | 596 | template <class T> |
| 597 | void DisplayList::iterate3dChildren(ChildrenSelectMode mode, OpenGLRenderer& renderer, |
| 598 | T& handler, const int level) { |
| 599 | if (m3dNodes.size() == 0 || |
| 600 | (mode == kNegativeZChildren && m3dNodes.keyAt(0) > 0.0f) || |
| 601 | (mode == kPositiveZChildren && m3dNodes.keyAt(m3dNodes.size() - 1) < 0.0f)) { |
| 602 | // nothing to draw |
| 603 | return; |
| 604 | } |
| 605 | |
| 606 | LinearAllocator& alloc = handler.allocator(); |
| 607 | ClipRectOp* op = new (alloc) ClipRectOp(0, 0, mWidth, mHeight, |
| 608 | SkRegion::kIntersect_Op); // clip to 3d root bounds for now |
| 609 | handler(op, PROPERTY_SAVECOUNT, mClipToBounds); |
| 610 | int rootRestoreTo = renderer.save(SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag); |
| 611 | |
| 612 | for (int i = 0; i < m3dNodes.size(); i++) { |
| 613 | const float zValue = m3dNodes.keyAt(i); |
| 614 | |
| 615 | if (mode == kPositiveZChildren && zValue < 0.0f) continue; |
| 616 | if (mode == kNegativeZChildren && zValue > 0.0f) break; |
| 617 | |
| 618 | const Vector<DrawDisplayListOp*>& nodesAtZ = m3dNodes[i]; |
| 619 | for (int j = 0; j < nodesAtZ.size(); j++) { |
| 620 | DrawDisplayListOp* op = nodesAtZ[j]; |
| 621 | if (mode == kPositiveZChildren) { |
| 622 | /* draw shadow on renderer with parent matrix applied, passing in the child's total matrix |
| 623 | * |
| 624 | * TODO: |
| 625 | * -determine and pass background shape (and possibly drawable alpha) |
| 626 | * -view must opt-in to shadows |
| 627 | * -consider shadows for other content |
| 628 | */ |
| 629 | mat4 shadowMatrix(op->mTransformFrom3dRoot); |
| 630 | op->mDisplayList->applyViewPropertyTransforms(shadowMatrix); |
| 631 | DisplayListOp* shadowOp = new (alloc) DrawShadowOp(shadowMatrix, op->mDisplayList->mAlpha, |
| 632 | op->mDisplayList->getWidth(), op->mDisplayList->getHeight()); |
| 633 | handler(shadowOp, PROPERTY_SAVECOUNT, mClipToBounds); |
| 634 | } |
| 635 | |
| 636 | renderer.concatMatrix(op->mTransformFrom3dRoot); |
| 637 | op->mSkipInOrderDraw = false; // this is horrible, I'm so sorry everyone |
| 638 | handler(op, renderer.getSaveCount() - 1, mClipToBounds); |
| 639 | op->mSkipInOrderDraw = true; |
| 640 | } |
| 641 | } |
| 642 | handler(new (alloc) RestoreToCountOp(rootRestoreTo), PROPERTY_SAVECOUNT, mClipToBounds); |
| 643 | } |
| 644 | |
Chris Craik | ff78583 | 2013-03-08 13:12:16 -0800 | [diff] [blame] | 645 | /** |
| 646 | * This function serves both defer and replay modes, and will organize the displayList's component |
| 647 | * operations for a single frame: |
| 648 | * |
Chris Craik | f57776b | 2013-10-25 18:30:17 -0700 | [diff] [blame^] | 649 | * Every 'simple' state operation that affects just the matrix and alpha (or other factors of |
Chris Craik | ff78583 | 2013-03-08 13:12:16 -0800 | [diff] [blame] | 650 | * DeferredDisplayState) may be issued directly to the renderer, but complex operations (with custom |
| 651 | * defer logic) and operations in displayListOps are issued through the 'handler' which handles the |
| 652 | * defer vs replay logic, per operation |
| 653 | */ |
| 654 | template <class T> |
| 655 | void DisplayList::iterate(OpenGLRenderer& renderer, T& handler, const int level) { |
Chris Craik | 9846de6 | 2013-06-12 16:23:00 -0700 | [diff] [blame] | 656 | if (CC_UNLIKELY(mDestroyed)) { // temporary debug logging |
| 657 | ALOGW("Error: %s is drawing after destruction, size %d", getName(), mSize); |
| 658 | CRASH(); |
| 659 | } |
| 660 | if (mSize == 0 || mAlpha <= 0) { |
Chris Craik | ff78583 | 2013-03-08 13:12:16 -0800 | [diff] [blame] | 661 | DISPLAY_LIST_LOGD("%*sEmpty display list (%p, %s)", level * 2, "", this, mName.string()); |
| 662 | return; |
| 663 | } |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 664 | |
| 665 | #if DEBUG_DISPLAY_LIST |
| 666 | Rect* clipRect = renderer.getClipRect(); |
Chris Craik | 527a3aa | 2013-03-04 10:19:31 -0800 | [diff] [blame] | 667 | DISPLAY_LIST_LOGD("%*sStart display list (%p, %s), clipRect: %.0f, %.0f, %.0f, %.0f", |
Chris Craik | ff78583 | 2013-03-08 13:12:16 -0800 | [diff] [blame] | 668 | level * 2, "", this, mName.string(), clipRect->left, clipRect->top, |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 669 | clipRect->right, clipRect->bottom); |
| 670 | #endif |
| 671 | |
Chris Craik | f57776b | 2013-10-25 18:30:17 -0700 | [diff] [blame^] | 672 | LinearAllocator& alloc = handler.allocator(); |
Chris Craik | ff78583 | 2013-03-08 13:12:16 -0800 | [diff] [blame] | 673 | int restoreTo = renderer.getSaveCount(); |
Chris Craik | f57776b | 2013-10-25 18:30:17 -0700 | [diff] [blame^] | 674 | handler(new (alloc) SaveOp(SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag), |
Chet Haase | dd67159 | 2013-04-19 14:54:34 -0700 | [diff] [blame] | 675 | PROPERTY_SAVECOUNT, mClipToBounds); |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 676 | |
Chris Craik | ff78583 | 2013-03-08 13:12:16 -0800 | [diff] [blame] | 677 | DISPLAY_LIST_LOGD("%*sSave %d %d", (level + 1) * 2, "", |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 678 | SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag, restoreTo); |
Chris Craik | c3566d0 | 2013-02-04 16:16:33 -0800 | [diff] [blame] | 679 | |
Chris Craik | ff78583 | 2013-03-08 13:12:16 -0800 | [diff] [blame] | 680 | setViewProperties<T>(renderer, handler, level + 1); |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 681 | |
Chris Craik | f57776b | 2013-10-25 18:30:17 -0700 | [diff] [blame^] | 682 | bool quickRejected = mClipToBounds && renderer.quickRejectConservative(0, 0, mWidth, mHeight); |
| 683 | if (!quickRejected) { |
| 684 | // for 3d root, draw children with negative z values |
| 685 | iterate3dChildren(kNegativeZChildren, renderer, handler, level); |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 686 | |
Chris Craik | f57776b | 2013-10-25 18:30:17 -0700 | [diff] [blame^] | 687 | DisplayListLogBuffer& logBuffer = DisplayListLogBuffer::getInstance(); |
| 688 | const int saveCountOffset = renderer.getSaveCount() - 1; |
| 689 | for (unsigned int i = 0; i < mDisplayListData->displayListOps.size(); i++) { |
| 690 | DisplayListOp *op = mDisplayListData->displayListOps[i]; |
Chris Craik | ff78583 | 2013-03-08 13:12:16 -0800 | [diff] [blame] | 691 | |
Chris Craik | 6045d2b | 2013-05-21 10:49:47 -0700 | [diff] [blame] | 692 | #if DEBUG_DISPLAY_LIST |
Chris Craik | f57776b | 2013-10-25 18:30:17 -0700 | [diff] [blame^] | 693 | op->output(level + 1); |
Chris Craik | 6045d2b | 2013-05-21 10:49:47 -0700 | [diff] [blame] | 694 | #endif |
| 695 | |
Chris Craik | f57776b | 2013-10-25 18:30:17 -0700 | [diff] [blame^] | 696 | logBuffer.writeCommand(level, op->name()); |
| 697 | handler(op, saveCountOffset, mClipToBounds); |
| 698 | } |
| 699 | |
| 700 | // for 3d root, draw children with positive z values |
| 701 | iterate3dChildren(kPositiveZChildren, renderer, handler, level); |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 702 | } |
| 703 | |
Chris Craik | ff78583 | 2013-03-08 13:12:16 -0800 | [diff] [blame] | 704 | DISPLAY_LIST_LOGD("%*sRestoreToCount %d", (level + 1) * 2, "", restoreTo); |
Chris Craik | f57776b | 2013-10-25 18:30:17 -0700 | [diff] [blame^] | 705 | handler(new (alloc) RestoreToCountOp(restoreTo), |
| 706 | PROPERTY_SAVECOUNT, mClipToBounds); |
Chris Craik | 16ecda5 | 2013-03-29 10:59:59 -0700 | [diff] [blame] | 707 | renderer.setOverrideLayerAlpha(1.0f); |
Chris Craik | 0776a60 | 2013-02-14 15:36:01 -0800 | [diff] [blame] | 708 | } |
| 709 | |
| 710 | }; // namespace uirenderer |
| 711 | }; // namespace android |