DisplayListCanvas.cpp revision 90fb1f6732a610ad5ff6acdb3bd9ae392c8eac82
1/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "DisplayListCanvas.h"
18
19#include "ResourceCache.h"
20#include "DeferredDisplayList.h"
21#include "DeferredLayerUpdater.h"
22#include "DisplayListOp.h"
23#include "RenderNode.h"
24#include "utils/PaintUtils.h"
25
26#include <SkCamera.h>
27#include <SkCanvas.h>
28
29#include <private/hwui/DrawGlInfo.h>
30
31namespace android {
32namespace uirenderer {
33
34DisplayListCanvas::DisplayListCanvas()
35    : mState(*this)
36    , mResourceCache(ResourceCache::getInstance())
37    , mDisplayListData(nullptr)
38    , mTranslateX(0.0f)
39    , mTranslateY(0.0f)
40    , mHasDeferredTranslate(false)
41    , mDeferredBarrierType(kBarrier_None)
42    , mHighContrastText(false)
43    , mRestoreSaveCount(-1) {
44}
45
46DisplayListCanvas::~DisplayListCanvas() {
47    LOG_ALWAYS_FATAL_IF(mDisplayListData,
48            "Destroyed a DisplayListCanvas during a record!");
49}
50
51///////////////////////////////////////////////////////////////////////////////
52// Operations
53///////////////////////////////////////////////////////////////////////////////
54
55DisplayListData* DisplayListCanvas::finishRecording() {
56    mPaintMap.clear();
57    mRegionMap.clear();
58    mPathMap.clear();
59    DisplayListData* data = mDisplayListData;
60    mDisplayListData = nullptr;
61    mSkiaCanvasProxy.reset(nullptr);
62    return data;
63}
64
65void DisplayListCanvas::prepareDirty(float left, float top,
66        float right, float bottom) {
67
68    LOG_ALWAYS_FATAL_IF(mDisplayListData,
69            "prepareDirty called a second time during a recording!");
70    mDisplayListData = new DisplayListData();
71
72    mState.initializeSaveStack(0, 0, mState.getWidth(), mState.getHeight(), Vector3());
73
74    mDeferredBarrierType = kBarrier_InOrder;
75    mState.setDirtyClip(false);
76    mRestoreSaveCount = -1;
77}
78
79bool DisplayListCanvas::finish() {
80    flushRestoreToCount();
81    flushTranslate();
82    return false;
83}
84
85void DisplayListCanvas::interrupt() {
86}
87
88void DisplayListCanvas::resume() {
89}
90
91void DisplayListCanvas::callDrawGLFunction(Functor *functor) {
92    addDrawOp(new (alloc()) DrawFunctorOp(functor));
93    mDisplayListData->functors.add(functor);
94}
95
96SkCanvas* DisplayListCanvas::asSkCanvas() {
97    LOG_ALWAYS_FATAL_IF(!mDisplayListData,
98            "attempting to get an SkCanvas when we are not recording!");
99    if (!mSkiaCanvasProxy) {
100        mSkiaCanvasProxy.reset(new SkiaCanvasProxy(this));
101    }
102
103    // SkCanvas instances default to identity transform, but should inherit
104    // the state of this Canvas; if this code was in the SkiaCanvasProxy
105    // constructor, we couldn't cache mSkiaCanvasProxy.
106    SkMatrix parentTransform;
107    getMatrix(&parentTransform);
108    mSkiaCanvasProxy.get()->setMatrix(parentTransform);
109
110    return mSkiaCanvasProxy.get();
111}
112
113int DisplayListCanvas::save(SkCanvas::SaveFlags flags) {
114    addStateOp(new (alloc()) SaveOp((int) flags));
115    return mState.save((int) flags);
116}
117
118void DisplayListCanvas::restore() {
119    if (mRestoreSaveCount < 0) {
120        restoreToCount(getSaveCount() - 1);
121        return;
122    }
123
124    mRestoreSaveCount--;
125    flushTranslate();
126    mState.restore();
127}
128
129void DisplayListCanvas::restoreToCount(int saveCount) {
130    mRestoreSaveCount = saveCount;
131    flushTranslate();
132    mState.restoreToCount(saveCount);
133}
134
135int DisplayListCanvas::saveLayer(float left, float top, float right, float bottom,
136        const SkPaint* paint, SkCanvas::SaveFlags flags) {
137    // force matrix/clip isolation for layer
138    flags |= SkCanvas::kClip_SaveFlag | SkCanvas::kMatrix_SaveFlag;
139
140    paint = refPaint(paint);
141    addStateOp(new (alloc()) SaveLayerOp(left, top, right, bottom, paint, (int) flags));
142    return mState.save((int) flags);
143}
144
145void DisplayListCanvas::translate(float dx, float dy) {
146    mHasDeferredTranslate = true;
147    mTranslateX += dx;
148    mTranslateY += dy;
149    flushRestoreToCount();
150    mState.translate(dx, dy, 0.0f);
151}
152
153void DisplayListCanvas::rotate(float degrees) {
154    addStateOp(new (alloc()) RotateOp(degrees));
155    mState.rotate(degrees);
156}
157
158void DisplayListCanvas::scale(float sx, float sy) {
159    addStateOp(new (alloc()) ScaleOp(sx, sy));
160    mState.scale(sx, sy);
161}
162
163void DisplayListCanvas::skew(float sx, float sy) {
164    addStateOp(new (alloc()) SkewOp(sx, sy));
165    mState.skew(sx, sy);
166}
167
168void DisplayListCanvas::setMatrix(const SkMatrix& matrix) {
169    addStateOp(new (alloc()) SetMatrixOp(matrix));
170    mState.setMatrix(matrix);
171}
172
173void DisplayListCanvas::concat(const SkMatrix& matrix) {
174    addStateOp(new (alloc()) ConcatMatrixOp(matrix));
175    mState.concatMatrix(matrix);
176}
177
178bool DisplayListCanvas::getClipBounds(SkRect* outRect) const {
179    Rect bounds = mState.getLocalClipBounds();
180    *outRect = SkRect::MakeLTRB(bounds.left, bounds.top, bounds.right, bounds.bottom);
181    return !(outRect->isEmpty());
182}
183
184bool DisplayListCanvas::quickRejectRect(float left, float top, float right, float bottom) const {
185    return mState.quickRejectConservative(left, top, right, bottom);
186}
187
188bool DisplayListCanvas::quickRejectPath(const SkPath& path) const {
189    SkRect bounds = path.getBounds();
190    return mState.quickRejectConservative(bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom);
191}
192
193
194bool DisplayListCanvas::clipRect(float left, float top, float right, float bottom,
195        SkRegion::Op op) {
196    addStateOp(new (alloc()) ClipRectOp(left, top, right, bottom, op));
197    return mState.clipRect(left, top, right, bottom, op);
198}
199
200bool DisplayListCanvas::clipPath(const SkPath* path, SkRegion::Op op) {
201    path = refPath(path);
202    addStateOp(new (alloc()) ClipPathOp(path, op));
203    return mState.clipPath(path, op);
204}
205
206bool DisplayListCanvas::clipRegion(const SkRegion* region, SkRegion::Op op) {
207    region = refRegion(region);
208    addStateOp(new (alloc()) ClipRegionOp(region, op));
209    return mState.clipRegion(region, op);
210}
211
212void DisplayListCanvas::drawRenderNode(RenderNode* renderNode) {
213    LOG_ALWAYS_FATAL_IF(!renderNode, "missing rendernode");
214    DrawRenderNodeOp* op = new (alloc()) DrawRenderNodeOp(
215            renderNode,
216            *mState.currentTransform(),
217            mState.clipIsSimple());
218    addRenderNodeOp(op);
219}
220
221void DisplayListCanvas::drawLayer(DeferredLayerUpdater* layerHandle, float x, float y) {
222    // We ref the DeferredLayerUpdater due to its thread-safe ref-counting
223    // semantics.
224    mDisplayListData->ref(layerHandle);
225    addDrawOp(new (alloc()) DrawLayerOp(layerHandle->backingLayer(), x, y));
226}
227
228void DisplayListCanvas::drawBitmap(const SkBitmap* bitmap, const SkPaint* paint) {
229    bitmap = refBitmap(*bitmap);
230    paint = refPaint(paint);
231
232    addDrawOp(new (alloc()) DrawBitmapOp(bitmap, paint));
233}
234
235void DisplayListCanvas::drawBitmap(const SkBitmap& bitmap, float left, float top,
236        const SkPaint* paint) {
237    save(SkCanvas::kMatrix_SaveFlag);
238    translate(left, top);
239    drawBitmap(&bitmap, paint);
240    restore();
241}
242
243void DisplayListCanvas::drawBitmap(const SkBitmap& bitmap, const SkMatrix& matrix,
244        const SkPaint* paint) {
245    if (matrix.isIdentity()) {
246        drawBitmap(&bitmap, paint);
247    } else if (!(matrix.getType() & ~(SkMatrix::kScale_Mask | SkMatrix::kTranslate_Mask))) {
248        // SkMatrix::isScaleTranslate() not available in L
249        SkRect src;
250        SkRect dst;
251        bitmap.getBounds(&src);
252        matrix.mapRect(&dst, src);
253        drawBitmap(bitmap, src.fLeft, src.fTop, src.fRight, src.fBottom,
254                   dst.fLeft, dst.fTop, dst.fRight, dst.fBottom, paint);
255    } else {
256        save(SkCanvas::kMatrix_SaveFlag);
257        concat(matrix);
258        drawBitmap(&bitmap, paint);
259        restore();
260    }
261}
262
263void DisplayListCanvas::drawBitmap(const SkBitmap& bitmap, float srcLeft, float srcTop,
264        float srcRight, float srcBottom, float dstLeft, float dstTop,
265        float dstRight, float dstBottom, const SkPaint* paint) {
266    if (srcLeft == 0 && srcTop == 0
267            && srcRight == bitmap.width()
268            && srcBottom == bitmap.height()
269            && (srcBottom - srcTop == dstBottom - dstTop)
270            && (srcRight - srcLeft == dstRight - dstLeft)) {
271        // transform simple rect to rect drawing case into position bitmap ops, since they merge
272        save(SkCanvas::kMatrix_SaveFlag);
273        translate(dstLeft, dstTop);
274        drawBitmap(&bitmap, paint);
275        restore();
276    } else {
277        paint = refPaint(paint);
278
279        if (paint && paint->getShader()) {
280            float scaleX = (dstRight - dstLeft) / (srcRight - srcLeft);
281            float scaleY = (dstBottom - dstTop) / (srcBottom - srcTop);
282            if (!MathUtils::areEqual(scaleX, 1.0f) || !MathUtils::areEqual(scaleY, 1.0f)) {
283                // Apply the scale transform on the canvas, so that the shader
284                // effectively calculates positions relative to src rect space
285
286                save(SkCanvas::kMatrix_SaveFlag);
287                translate(dstLeft, dstTop);
288                scale(scaleX, scaleY);
289
290                dstLeft = 0.0f;
291                dstTop = 0.0f;
292                dstRight = srcRight - srcLeft;
293                dstBottom = srcBottom - srcTop;
294
295                addDrawOp(new (alloc()) DrawBitmapRectOp(refBitmap(bitmap),
296                        srcLeft, srcTop, srcRight, srcBottom,
297                        dstLeft, dstTop, dstRight, dstBottom, paint));
298                restore();
299                return;
300            }
301        }
302
303        addDrawOp(new (alloc()) DrawBitmapRectOp(refBitmap(bitmap),
304                srcLeft, srcTop, srcRight, srcBottom,
305                dstLeft, dstTop, dstRight, dstBottom, paint));
306    }
307}
308
309void DisplayListCanvas::drawBitmapMesh(const SkBitmap& bitmap, int meshWidth, int meshHeight,
310        const float* vertices, const int* colors, const SkPaint* paint) {
311    int vertexCount = (meshWidth + 1) * (meshHeight + 1);
312    vertices = refBuffer<float>(vertices, vertexCount * 2); // 2 floats per vertex
313    paint = refPaint(paint);
314    colors = refBuffer<int>(colors, vertexCount); // 1 color per vertex
315
316    addDrawOp(new (alloc()) DrawBitmapMeshOp(refBitmap(bitmap), meshWidth, meshHeight,
317           vertices, colors, paint));
318}
319
320void DisplayListCanvas::drawPatch(const SkBitmap& bitmap, const Res_png_9patch* patch,
321        float left, float top, float right, float bottom, const SkPaint* paint) {
322    const SkBitmap* bitmapPtr = refBitmap(bitmap);
323    patch = refPatch(patch);
324    paint = refPaint(paint);
325
326    addDrawOp(new (alloc()) DrawPatchOp(bitmapPtr, patch, left, top, right, bottom, paint));
327}
328
329void DisplayListCanvas::drawColor(int color, SkXfermode::Mode mode) {
330    addDrawOp(new (alloc()) DrawColorOp(color, mode));
331}
332
333void DisplayListCanvas::drawPaint(const SkPaint& paint) {
334    SkRect bounds;
335    if (getClipBounds(&bounds)) {
336        drawRect(bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom, paint);
337    }
338}
339
340
341void DisplayListCanvas::drawRect(float left, float top, float right, float bottom,
342        const SkPaint& paint) {
343    addDrawOp(new (alloc()) DrawRectOp(left, top, right, bottom, refPaint(&paint)));
344}
345
346void DisplayListCanvas::drawRoundRect(float left, float top, float right, float bottom,
347        float rx, float ry, const SkPaint& paint) {
348    addDrawOp(new (alloc()) DrawRoundRectOp(left, top, right, bottom, rx, ry, refPaint(&paint)));
349}
350
351void DisplayListCanvas::drawRoundRect(
352        CanvasPropertyPrimitive* left, CanvasPropertyPrimitive* top,
353        CanvasPropertyPrimitive* right, CanvasPropertyPrimitive* bottom,
354        CanvasPropertyPrimitive* rx, CanvasPropertyPrimitive* ry,
355        CanvasPropertyPaint* paint) {
356    mDisplayListData->ref(left);
357    mDisplayListData->ref(top);
358    mDisplayListData->ref(right);
359    mDisplayListData->ref(bottom);
360    mDisplayListData->ref(rx);
361    mDisplayListData->ref(ry);
362    mDisplayListData->ref(paint);
363    refBitmapsInShader(paint->value.getShader());
364    addDrawOp(new (alloc()) DrawRoundRectPropsOp(&left->value, &top->value,
365            &right->value, &bottom->value, &rx->value, &ry->value, &paint->value));
366}
367
368void DisplayListCanvas::drawCircle(float x, float y, float radius, const SkPaint& paint) {
369    addDrawOp(new (alloc()) DrawCircleOp(x, y, radius, refPaint(&paint)));
370}
371
372void DisplayListCanvas::drawCircle(CanvasPropertyPrimitive* x, CanvasPropertyPrimitive* y,
373        CanvasPropertyPrimitive* radius, CanvasPropertyPaint* paint) {
374    mDisplayListData->ref(x);
375    mDisplayListData->ref(y);
376    mDisplayListData->ref(radius);
377    mDisplayListData->ref(paint);
378    refBitmapsInShader(paint->value.getShader());
379    addDrawOp(new (alloc()) DrawCirclePropsOp(&x->value, &y->value,
380            &radius->value, &paint->value));
381}
382
383void DisplayListCanvas::drawOval(float left, float top, float right, float bottom,
384        const SkPaint& paint) {
385    addDrawOp(new (alloc()) DrawOvalOp(left, top, right, bottom, refPaint(&paint)));
386}
387
388void DisplayListCanvas::drawArc(float left, float top, float right, float bottom,
389        float startAngle, float sweepAngle, bool useCenter, const SkPaint& paint) {
390    if (fabs(sweepAngle) >= 360.0f) {
391        drawOval(left, top, right, bottom, paint);
392    } else {
393        addDrawOp(new (alloc()) DrawArcOp(left, top, right, bottom,
394                        startAngle, sweepAngle, useCenter, refPaint(&paint)));
395    }
396}
397
398void DisplayListCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
399    addDrawOp(new (alloc()) DrawPathOp(refPath(&path), refPaint(&paint)));
400}
401
402void DisplayListCanvas::drawLines(const float* points, int count, const SkPaint& paint) {
403    points = refBuffer<float>(points, count);
404
405    addDrawOp(new (alloc()) DrawLinesOp(points, count, refPaint(&paint)));
406}
407
408void DisplayListCanvas::drawPoints(const float* points, int count, const SkPaint& paint) {
409    points = refBuffer<float>(points, count);
410
411    addDrawOp(new (alloc()) DrawPointsOp(points, count, refPaint(&paint)));
412}
413
414void DisplayListCanvas::drawTextOnPath(const uint16_t* glyphs, int count,
415        const SkPath& path, float hOffset, float vOffset, const SkPaint& paint) {
416    if (!glyphs || count <= 0) return;
417
418    int bytesCount = 2 * count;
419    DrawOp* op = new (alloc()) DrawTextOnPathOp(refText((const char*) glyphs, bytesCount),
420            bytesCount, count, refPath(&path),
421            hOffset, vOffset, refPaint(&paint));
422    addDrawOp(op);
423}
424
425void DisplayListCanvas::drawPosText(const uint16_t* text, const float* positions,
426        int count, int posCount, const SkPaint& paint) {
427    if (!text || count <= 0) return;
428
429    int bytesCount = 2 * count;
430    positions = refBuffer<float>(positions, count * 2);
431
432    DrawOp* op = new (alloc()) DrawPosTextOp(refText((const char*) text, bytesCount),
433                                             bytesCount, count, positions, refPaint(&paint));
434    addDrawOp(op);
435}
436
437static void simplifyPaint(int color, SkPaint* paint) {
438    paint->setColor(color);
439    paint->setShader(nullptr);
440    paint->setColorFilter(nullptr);
441    paint->setLooper(nullptr);
442    paint->setStrokeWidth(4 + 0.04 * paint->getTextSize());
443    paint->setStrokeJoin(SkPaint::kRound_Join);
444    paint->setLooper(nullptr);
445}
446
447void DisplayListCanvas::drawText(const uint16_t* glyphs, const float* positions,
448        int count, const SkPaint& paint, float x, float y,
449        float boundsLeft, float boundsTop, float boundsRight, float boundsBottom,
450        float totalAdvance) {
451
452    if (!glyphs || count <= 0 || PaintUtils::paintWillNotDrawText(paint)) return;
453
454    int bytesCount = count * 2;
455    const char* text = refText((const char*) glyphs, bytesCount);
456    positions = refBuffer<float>(positions, count * 2);
457    Rect bounds(boundsLeft, boundsTop, boundsRight, boundsBottom);
458
459    if (CC_UNLIKELY(mHighContrastText)) {
460        // high contrast draw path
461        int color = paint.getColor();
462        int channelSum = SkColorGetR(color) + SkColorGetG(color) + SkColorGetB(color);
463        bool darken = channelSum < (128 * 3);
464
465        // outline
466        SkPaint* outlinePaint = copyPaint(&paint);
467        simplifyPaint(darken ? SK_ColorWHITE : SK_ColorBLACK, outlinePaint);
468        outlinePaint->setStyle(SkPaint::kStrokeAndFill_Style);
469        addDrawOp(new (alloc()) DrawTextOp(text, bytesCount, count,
470                x, y, positions, outlinePaint, totalAdvance, bounds)); // bounds?
471
472        // inner
473        SkPaint* innerPaint = copyPaint(&paint);
474        simplifyPaint(darken ? SK_ColorBLACK : SK_ColorWHITE, innerPaint);
475        innerPaint->setStyle(SkPaint::kFill_Style);
476        addDrawOp(new (alloc()) DrawTextOp(text, bytesCount, count,
477                x, y, positions, innerPaint, totalAdvance, bounds));
478    } else {
479        // standard draw path
480        DrawOp* op = new (alloc()) DrawTextOp(text, bytesCount, count,
481                x, y, positions, refPaint(&paint), totalAdvance, bounds);
482        addDrawOp(op);
483    }
484}
485
486void DisplayListCanvas::drawRects(const float* rects, int count, const SkPaint* paint) {
487    if (count <= 0) return;
488
489    rects = refBuffer<float>(rects, count);
490    paint = refPaint(paint);
491    addDrawOp(new (alloc()) DrawRectsOp(rects, count, paint));
492}
493
494void DisplayListCanvas::setDrawFilter(SkDrawFilter* filter) {
495    mDrawFilter.reset(SkSafeRef(filter));
496}
497
498void DisplayListCanvas::insertReorderBarrier(bool enableReorder) {
499    flushRestoreToCount();
500    flushTranslate();
501    mDeferredBarrierType = enableReorder ? kBarrier_OutOfOrder : kBarrier_InOrder;
502}
503
504void DisplayListCanvas::flushRestoreToCount() {
505    if (mRestoreSaveCount >= 0) {
506        addOpAndUpdateChunk(new (alloc()) RestoreToCountOp(mRestoreSaveCount));
507        mRestoreSaveCount = -1;
508    }
509}
510
511void DisplayListCanvas::flushTranslate() {
512    if (mHasDeferredTranslate) {
513        if (mTranslateX != 0.0f || mTranslateY != 0.0f) {
514            addOpAndUpdateChunk(new (alloc()) TranslateOp(mTranslateX, mTranslateY));
515            mTranslateX = mTranslateY = 0.0f;
516        }
517        mHasDeferredTranslate = false;
518    }
519}
520
521size_t DisplayListCanvas::addOpAndUpdateChunk(DisplayListOp* op) {
522    int insertIndex = mDisplayListData->displayListOps.add(op);
523    if (mDeferredBarrierType != kBarrier_None) {
524        // op is first in new chunk
525        mDisplayListData->chunks.push();
526        DisplayListData::Chunk& newChunk = mDisplayListData->chunks.editTop();
527        newChunk.beginOpIndex = insertIndex;
528        newChunk.endOpIndex = insertIndex + 1;
529        newChunk.reorderChildren = (mDeferredBarrierType == kBarrier_OutOfOrder);
530
531        int nextChildIndex = mDisplayListData->children().size();
532        newChunk.beginChildIndex = newChunk.endChildIndex = nextChildIndex;
533        mDeferredBarrierType = kBarrier_None;
534    } else {
535        // standard case - append to existing chunk
536        mDisplayListData->chunks.editTop().endOpIndex = insertIndex + 1;
537    }
538    return insertIndex;
539}
540
541size_t DisplayListCanvas::flushAndAddOp(DisplayListOp* op) {
542    flushRestoreToCount();
543    flushTranslate();
544    return addOpAndUpdateChunk(op);
545}
546
547size_t DisplayListCanvas::addStateOp(StateOp* op) {
548    return flushAndAddOp(op);
549}
550
551size_t DisplayListCanvas::addDrawOp(DrawOp* op) {
552    Rect localBounds;
553    if (op->getLocalBounds(localBounds)) {
554        bool rejected = quickRejectRect(localBounds.left, localBounds.top,
555                localBounds.right, localBounds.bottom);
556        op->setQuickRejected(rejected);
557    }
558
559    mDisplayListData->hasDrawOps = true;
560    return flushAndAddOp(op);
561}
562
563size_t DisplayListCanvas::addRenderNodeOp(DrawRenderNodeOp* op) {
564    int opIndex = addDrawOp(op);
565    int childIndex = mDisplayListData->addChild(op);
566
567    // update the chunk's child indices
568    DisplayListData::Chunk& chunk = mDisplayListData->chunks.editTop();
569    chunk.endChildIndex = childIndex + 1;
570
571    if (op->renderNode()->stagingProperties().isProjectionReceiver()) {
572        // use staging property, since recording on UI thread
573        mDisplayListData->projectionReceiveIndex = opIndex;
574    }
575    return opIndex;
576}
577
578void DisplayListCanvas::refBitmapsInShader(const SkShader* shader) {
579    if (!shader) return;
580
581    // If this paint has an SkShader that has an SkBitmap add
582    // it to the bitmap pile
583    SkBitmap bitmap;
584    SkShader::TileMode xy[2];
585    if (shader->asABitmap(&bitmap, nullptr, xy) == SkShader::kDefault_BitmapType) {
586        refBitmap(bitmap);
587        return;
588    }
589    SkShader::ComposeRec rec;
590    if (shader->asACompose(&rec)) {
591        refBitmapsInShader(rec.fShaderA);
592        refBitmapsInShader(rec.fShaderB);
593        return;
594    }
595}
596
597}; // namespace uirenderer
598}; // namespace android
599