Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 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 "SkiaRecordingCanvas.h" |
| 18 | |
John Reck | 1bcacfd | 2017-11-03 10:12:19 -0700 | [diff] [blame] | 19 | #include <SkImagePriv.h> |
John Reck | 9ce2bf7 | 2018-07-02 18:33:32 -0700 | [diff] [blame] | 20 | #include "CanvasTransform.h" |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 21 | #include "Layer.h" |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 22 | #include "LayerDrawable.h" |
| 23 | #include "NinePatchUtils.h" |
John Reck | 1bcacfd | 2017-11-03 10:12:19 -0700 | [diff] [blame] | 24 | #include "RenderNode.h" |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 25 | #include "pipeline/skia/AnimatedDrawables.h" |
Stan Iliev | 11606ff | 2018-09-17 14:01:16 -0400 | [diff] [blame] | 26 | #include "pipeline/skia/GLFunctorDrawable.h" |
Chris Blume | 4142339 | 2018-11-06 11:47:03 -0800 | [diff] [blame] | 27 | #include "pipeline/skia/VkFunctorDrawable.h" |
John Reck | 283bb46 | 2018-12-13 16:40:14 -0800 | [diff] [blame] | 28 | #include "pipeline/skia/VkInteropFunctorDrawable.h" |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 29 | |
| 30 | namespace android { |
| 31 | namespace uirenderer { |
| 32 | namespace skiapipeline { |
| 33 | |
| 34 | // ---------------------------------------------------------------------------- |
| 35 | // Recording Canvas Setup |
| 36 | // ---------------------------------------------------------------------------- |
| 37 | |
| 38 | void SkiaRecordingCanvas::initDisplayList(uirenderer::RenderNode* renderNode, int width, |
John Reck | 1bcacfd | 2017-11-03 10:12:19 -0700 | [diff] [blame] | 39 | int height) { |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 40 | mCurrentBarrier = nullptr; |
| 41 | SkASSERT(mDisplayList.get() == nullptr); |
| 42 | |
| 43 | if (renderNode) { |
| 44 | mDisplayList = renderNode->detachAvailableList(); |
| 45 | } |
Derek Sollenberger | ea1fe9b | 2017-03-01 13:02:43 -0500 | [diff] [blame] | 46 | if (!mDisplayList) { |
| 47 | mDisplayList.reset(new SkiaDisplayList()); |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 48 | } |
| 49 | |
Derek Sollenberger | ea1fe9b | 2017-03-01 13:02:43 -0500 | [diff] [blame] | 50 | mDisplayList->attachRecorder(&mRecorder, SkIRect::MakeWH(width, height)); |
John Reck | 8f45d4a | 2018-08-15 10:17:12 -0700 | [diff] [blame] | 51 | SkiaCanvas::reset(&mRecorder); |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 52 | } |
| 53 | |
| 54 | uirenderer::DisplayList* SkiaRecordingCanvas::finishRecording() { |
| 55 | // close any existing chunks if necessary |
| 56 | insertReorderBarrier(false); |
| 57 | mRecorder.restoreToCount(1); |
| 58 | return mDisplayList.release(); |
| 59 | } |
| 60 | |
| 61 | // ---------------------------------------------------------------------------- |
| 62 | // Recording Canvas draw operations: View System |
| 63 | // ---------------------------------------------------------------------------- |
| 64 | |
| 65 | void SkiaRecordingCanvas::drawRoundRect(uirenderer::CanvasPropertyPrimitive* left, |
John Reck | 1bcacfd | 2017-11-03 10:12:19 -0700 | [diff] [blame] | 66 | uirenderer::CanvasPropertyPrimitive* top, |
| 67 | uirenderer::CanvasPropertyPrimitive* right, |
| 68 | uirenderer::CanvasPropertyPrimitive* bottom, |
| 69 | uirenderer::CanvasPropertyPrimitive* rx, |
| 70 | uirenderer::CanvasPropertyPrimitive* ry, |
| 71 | uirenderer::CanvasPropertyPaint* paint) { |
Stan Iliev | f7aa6cd | 2017-03-29 18:25:12 -0400 | [diff] [blame] | 72 | // Destructor of drawables created with allocateDrawable, will be invoked by ~LinearAllocator. |
John Reck | 1bcacfd | 2017-11-03 10:12:19 -0700 | [diff] [blame] | 73 | drawDrawable(mDisplayList->allocateDrawable<AnimatedRoundRect>(left, top, right, bottom, rx, ry, |
| 74 | paint)); |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | void SkiaRecordingCanvas::drawCircle(uirenderer::CanvasPropertyPrimitive* x, |
John Reck | 1bcacfd | 2017-11-03 10:12:19 -0700 | [diff] [blame] | 78 | uirenderer::CanvasPropertyPrimitive* y, |
| 79 | uirenderer::CanvasPropertyPrimitive* radius, |
| 80 | uirenderer::CanvasPropertyPaint* paint) { |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 81 | drawDrawable(mDisplayList->allocateDrawable<AnimatedCircle>(x, y, radius, paint)); |
| 82 | } |
| 83 | |
| 84 | void SkiaRecordingCanvas::insertReorderBarrier(bool enableReorder) { |
John Reck | ddeaa48 | 2018-10-30 10:47:43 -0700 | [diff] [blame] | 85 | if (mCurrentBarrier && enableReorder) { |
| 86 | // Already in a re-order section, nothing to do |
| 87 | return; |
| 88 | } |
| 89 | |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 90 | if (nullptr != mCurrentBarrier) { |
| 91 | // finish off the existing chunk |
| 92 | SkDrawable* drawable = |
John Reck | 1bcacfd | 2017-11-03 10:12:19 -0700 | [diff] [blame] | 93 | mDisplayList->allocateDrawable<EndReorderBarrierDrawable>(mCurrentBarrier); |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 94 | mCurrentBarrier = nullptr; |
| 95 | drawDrawable(drawable); |
| 96 | } |
Stan Iliev | 88e0891 | 2016-11-22 18:19:29 -0500 | [diff] [blame] | 97 | if (enableReorder) { |
John Reck | 283bb46 | 2018-12-13 16:40:14 -0800 | [diff] [blame] | 98 | mCurrentBarrier = |
| 99 | mDisplayList->allocateDrawable<StartReorderBarrierDrawable>(mDisplayList.get()); |
Stan Iliev | 88e0891 | 2016-11-22 18:19:29 -0500 | [diff] [blame] | 100 | drawDrawable(mCurrentBarrier); |
| 101 | } |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | void SkiaRecordingCanvas::drawLayer(uirenderer::DeferredLayerUpdater* layerUpdater) { |
Derek Sollenberger | f5a370e | 2017-06-15 13:50:08 -0400 | [diff] [blame] | 105 | if (layerUpdater != nullptr) { |
Stan Iliev | f7aa6cd | 2017-03-29 18:25:12 -0400 | [diff] [blame] | 106 | // Create a ref-counted drawable, which is kept alive by sk_sp in SkLiteDL. |
Derek Sollenberger | f5a370e | 2017-06-15 13:50:08 -0400 | [diff] [blame] | 107 | sk_sp<SkDrawable> drawable(new LayerDrawable(layerUpdater)); |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 108 | drawDrawable(drawable.get()); |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | void SkiaRecordingCanvas::drawRenderNode(uirenderer::RenderNode* renderNode) { |
Stan Iliev | f7aa6cd | 2017-03-29 18:25:12 -0400 | [diff] [blame] | 113 | // Record the child node. Drawable dtor will be invoked when mChildNodes deque is cleared. |
Stan Iliev | 2f06e8a | 2016-11-02 15:29:03 -0400 | [diff] [blame] | 114 | mDisplayList->mChildNodes.emplace_back(renderNode, asSkCanvas(), true, mCurrentBarrier); |
Stan Iliev | db45a4b | 2016-11-08 14:18:31 -0500 | [diff] [blame] | 115 | auto& renderNodeDrawable = mDisplayList->mChildNodes.back(); |
Stan Iliev | f09ee58 | 2018-11-06 17:35:50 -0500 | [diff] [blame] | 116 | if (Properties::getRenderPipelineType() == RenderPipelineType::SkiaVulkan) { |
| 117 | // Put Vulkan WebViews with non-rectangular clips in a HW layer |
| 118 | renderNode->mutateStagingProperties().setClipMayBeComplex(mRecorder.isClipMayBeComplex()); |
| 119 | } |
Stan Iliev | db45a4b | 2016-11-08 14:18:31 -0500 | [diff] [blame] | 120 | drawDrawable(&renderNodeDrawable); |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 121 | |
| 122 | // use staging property, since recording on UI thread |
| 123 | if (renderNode->stagingProperties().isProjectionReceiver()) { |
Stan Iliev | db45a4b | 2016-11-08 14:18:31 -0500 | [diff] [blame] | 124 | mDisplayList->mProjectionReceiver = &renderNodeDrawable; |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 125 | } |
| 126 | } |
| 127 | |
| 128 | void SkiaRecordingCanvas::callDrawGLFunction(Functor* functor, |
John Reck | 1bcacfd | 2017-11-03 10:12:19 -0700 | [diff] [blame] | 129 | uirenderer::GlFunctorLifecycleListener* listener) { |
Stan Iliev | 11606ff | 2018-09-17 14:01:16 -0400 | [diff] [blame] | 130 | FunctorDrawable* functorDrawable; |
| 131 | if (Properties::getRenderPipelineType() == RenderPipelineType::SkiaVulkan) { |
John Reck | 283bb46 | 2018-12-13 16:40:14 -0800 | [diff] [blame] | 132 | functorDrawable = mDisplayList->allocateDrawable<VkInteropFunctorDrawable>( |
| 133 | functor, listener, asSkCanvas()); |
Stan Iliev | 11606ff | 2018-09-17 14:01:16 -0400 | [diff] [blame] | 134 | } else { |
John Reck | 283bb46 | 2018-12-13 16:40:14 -0800 | [diff] [blame] | 135 | functorDrawable = |
| 136 | mDisplayList->allocateDrawable<GLFunctorDrawable>(functor, listener, asSkCanvas()); |
| 137 | } |
| 138 | mDisplayList->mChildFunctors.push_back(functorDrawable); |
| 139 | drawDrawable(functorDrawable); |
| 140 | } |
| 141 | |
| 142 | void SkiaRecordingCanvas::drawWebViewFunctor(int functor) { |
| 143 | FunctorDrawable* functorDrawable; |
| 144 | if (Properties::getRenderPipelineType() == RenderPipelineType::SkiaVulkan) { |
John Reck | 283bb46 | 2018-12-13 16:40:14 -0800 | [diff] [blame] | 145 | functorDrawable = |
Bo Liu | d25d134 | 2019-02-04 14:55:02 -0800 | [diff] [blame] | 146 | mDisplayList->allocateDrawable<VkFunctorDrawable>(functor, asSkCanvas()); |
John Reck | 283bb46 | 2018-12-13 16:40:14 -0800 | [diff] [blame] | 147 | } else { |
| 148 | functorDrawable = mDisplayList->allocateDrawable<GLFunctorDrawable>(functor, asSkCanvas()); |
Stan Iliev | 11606ff | 2018-09-17 14:01:16 -0400 | [diff] [blame] | 149 | } |
| 150 | mDisplayList->mChildFunctors.push_back(functorDrawable); |
| 151 | drawDrawable(functorDrawable); |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 152 | } |
| 153 | |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 154 | void SkiaRecordingCanvas::drawVectorDrawable(VectorDrawableRoot* tree) { |
John Reck | 08ee815 | 2018-09-20 16:27:46 -0700 | [diff] [blame] | 155 | mRecorder.drawVectorDrawable(tree); |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 156 | mDisplayList->mVectorDrawables.push_back(tree); |
| 157 | } |
| 158 | |
| 159 | // ---------------------------------------------------------------------------- |
| 160 | // Recording Canvas draw operations: Bitmaps |
| 161 | // ---------------------------------------------------------------------------- |
| 162 | |
Ben Wagner | 0ed10be | 2018-06-28 17:08:16 -0400 | [diff] [blame] | 163 | SkiaCanvas::PaintCoW&& SkiaRecordingCanvas::filterBitmap(PaintCoW&& paint, |
| 164 | sk_sp<SkColorFilter> colorSpaceFilter) { |
| 165 | bool fixBlending = false; |
| 166 | bool fixAA = false; |
| 167 | if (paint) { |
| 168 | // kClear blend mode is drawn as kDstOut on HW for compatibility with Android O and |
| 169 | // older. |
| 170 | fixBlending = sApiLevel <= 27 && paint->getBlendMode() == SkBlendMode::kClear; |
| 171 | fixAA = paint->isAntiAlias(); |
| 172 | } |
| 173 | |
| 174 | if (fixBlending || fixAA || colorSpaceFilter) { |
| 175 | SkPaint& tmpPaint = paint.writeable(); |
| 176 | |
| 177 | if (fixBlending) { |
| 178 | tmpPaint.setBlendMode(SkBlendMode::kDstOut); |
| 179 | } |
| 180 | |
| 181 | if (colorSpaceFilter) { |
| 182 | if (tmpPaint.getColorFilter()) { |
| 183 | tmpPaint.setColorFilter(SkColorFilter::MakeComposeFilter( |
John Reck | 283bb46 | 2018-12-13 16:40:14 -0800 | [diff] [blame] | 184 | tmpPaint.refColorFilter(), std::move(colorSpaceFilter))); |
Ben Wagner | 0ed10be | 2018-06-28 17:08:16 -0400 | [diff] [blame] | 185 | } else { |
| 186 | tmpPaint.setColorFilter(std::move(colorSpaceFilter)); |
| 187 | } |
| 188 | LOG_ALWAYS_FATAL_IF(!tmpPaint.getColorFilter()); |
| 189 | } |
| 190 | |
| 191 | // disabling AA on bitmap draws matches legacy HWUI behavior |
| 192 | tmpPaint.setAntiAlias(false); |
| 193 | } |
| 194 | |
| 195 | return filterPaint(std::move(paint)); |
| 196 | } |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 197 | |
| 198 | void SkiaRecordingCanvas::drawBitmap(Bitmap& bitmap, float left, float top, const SkPaint* paint) { |
Derek Sollenberger | d01b591 | 2018-10-19 15:55:33 -0400 | [diff] [blame] | 199 | sk_sp<SkImage> image = bitmap.makeImage(); |
| 200 | mRecorder.drawImage(image, left, top, filterPaint(paint), bitmap.palette()); |
Stan Iliev | 0cc4e36 | 2017-05-18 14:21:23 -0400 | [diff] [blame] | 201 | // if image->unique() is true, then mRecorder.drawImage failed for some reason. It also means |
| 202 | // it is not safe to store a raw SkImage pointer, because the image object will be destroyed |
| 203 | // when this function ends. |
Stan Iliev | 7bc3bc6 | 2017-05-24 13:28:36 -0400 | [diff] [blame] | 204 | if (!bitmap.isImmutable() && image.get() && !image->unique()) { |
Stan Iliev | 0cc4e36 | 2017-05-18 14:21:23 -0400 | [diff] [blame] | 205 | mDisplayList->mMutableImages.push_back(image.get()); |
| 206 | } |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 207 | } |
| 208 | |
John Reck | 1bcacfd | 2017-11-03 10:12:19 -0700 | [diff] [blame] | 209 | void SkiaRecordingCanvas::drawBitmap(Bitmap& bitmap, const SkMatrix& matrix, const SkPaint* paint) { |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 210 | SkAutoCanvasRestore acr(&mRecorder, true); |
| 211 | concat(matrix); |
Derek Sollenberger | fb0c8fc | 2017-07-26 13:53:27 -0400 | [diff] [blame] | 212 | |
Derek Sollenberger | d01b591 | 2018-10-19 15:55:33 -0400 | [diff] [blame] | 213 | sk_sp<SkImage> image = bitmap.makeImage(); |
| 214 | mRecorder.drawImage(image, 0, 0, filterPaint(paint), bitmap.palette()); |
Derek Sollenberger | fb0c8fc | 2017-07-26 13:53:27 -0400 | [diff] [blame] | 215 | if (!bitmap.isImmutable() && image.get() && !image->unique()) { |
Stan Iliev | 0cc4e36 | 2017-05-18 14:21:23 -0400 | [diff] [blame] | 216 | mDisplayList->mMutableImages.push_back(image.get()); |
| 217 | } |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 218 | } |
| 219 | |
John Reck | 1bcacfd | 2017-11-03 10:12:19 -0700 | [diff] [blame] | 220 | void SkiaRecordingCanvas::drawBitmap(Bitmap& bitmap, float srcLeft, float srcTop, float srcRight, |
| 221 | float srcBottom, float dstLeft, float dstTop, float dstRight, |
| 222 | float dstBottom, const SkPaint* paint) { |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 223 | SkRect srcRect = SkRect::MakeLTRB(srcLeft, srcTop, srcRight, srcBottom); |
| 224 | SkRect dstRect = SkRect::MakeLTRB(dstLeft, dstTop, dstRight, dstBottom); |
Derek Sollenberger | fb0c8fc | 2017-07-26 13:53:27 -0400 | [diff] [blame] | 225 | |
Derek Sollenberger | d01b591 | 2018-10-19 15:55:33 -0400 | [diff] [blame] | 226 | sk_sp<SkImage> image = bitmap.makeImage(); |
| 227 | mRecorder.drawImageRect(image, srcRect, dstRect, filterPaint(paint), |
John Reck | f3c724f | 2018-09-20 13:00:04 -0700 | [diff] [blame] | 228 | SkCanvas::kFast_SrcRectConstraint, bitmap.palette()); |
John Reck | 1bcacfd | 2017-11-03 10:12:19 -0700 | [diff] [blame] | 229 | if (!bitmap.isImmutable() && image.get() && !image->unique() && !srcRect.isEmpty() && |
| 230 | !dstRect.isEmpty()) { |
Stan Iliev | 0cc4e36 | 2017-05-18 14:21:23 -0400 | [diff] [blame] | 231 | mDisplayList->mMutableImages.push_back(image.get()); |
| 232 | } |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 233 | } |
| 234 | |
John Reck | 1bcacfd | 2017-11-03 10:12:19 -0700 | [diff] [blame] | 235 | void SkiaRecordingCanvas::drawNinePatch(Bitmap& bitmap, const Res_png_9patch& chunk, float dstLeft, |
| 236 | float dstTop, float dstRight, float dstBottom, |
| 237 | const SkPaint* paint) { |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 238 | SkCanvas::Lattice lattice; |
Derek Sollenberger | fb0c8fc | 2017-07-26 13:53:27 -0400 | [diff] [blame] | 239 | NinePatchUtils::SetLatticeDivs(&lattice, chunk, bitmap.width(), bitmap.height()); |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 240 | |
Stan Iliev | e12d731 | 2017-12-04 14:48:27 -0500 | [diff] [blame] | 241 | lattice.fRectTypes = nullptr; |
| 242 | lattice.fColors = nullptr; |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 243 | int numFlags = 0; |
| 244 | if (chunk.numColors > 0 && chunk.numColors == NinePatchUtils::NumDistinctRects(lattice)) { |
| 245 | // We can expect the framework to give us a color for every distinct rect. |
| 246 | // Skia requires placeholder flags for degenerate rects. |
| 247 | numFlags = (lattice.fXCount + 1) * (lattice.fYCount + 1); |
| 248 | } |
| 249 | |
Stan Iliev | e12d731 | 2017-12-04 14:48:27 -0500 | [diff] [blame] | 250 | SkAutoSTMalloc<25, SkCanvas::Lattice::RectType> flags(numFlags); |
| 251 | SkAutoSTMalloc<25, SkColor> colors(numFlags); |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 252 | if (numFlags > 0) { |
Stan Iliev | e12d731 | 2017-12-04 14:48:27 -0500 | [diff] [blame] | 253 | NinePatchUtils::SetLatticeFlags(&lattice, flags.get(), numFlags, chunk, colors.get()); |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 254 | } |
| 255 | |
| 256 | lattice.fBounds = nullptr; |
| 257 | SkRect dst = SkRect::MakeLTRB(dstLeft, dstTop, dstRight, dstBottom); |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 258 | |
Ben Wagner | 0ed10be | 2018-06-28 17:08:16 -0400 | [diff] [blame] | 259 | PaintCoW filteredPaint(paint); |
Stan Iliev | 038fc37 | 2018-07-30 18:31:46 -0400 | [diff] [blame] | 260 | // HWUI always draws 9-patches with bilinear filtering, regardless of what is set in the Paint. |
| 261 | if (!filteredPaint || filteredPaint->getFilterQuality() != kLow_SkFilterQuality) { |
Ben Wagner | 0ed10be | 2018-06-28 17:08:16 -0400 | [diff] [blame] | 262 | filteredPaint.writeable().setFilterQuality(kLow_SkFilterQuality); |
Leon Scroggins III | 5a66376 | 2018-04-23 11:15:00 -0400 | [diff] [blame] | 263 | } |
Derek Sollenberger | d01b591 | 2018-10-19 15:55:33 -0400 | [diff] [blame] | 264 | sk_sp<SkImage> image = bitmap.makeImage(); |
John Reck | 283bb46 | 2018-12-13 16:40:14 -0800 | [diff] [blame] | 265 | mRecorder.drawImageLattice(image, lattice, dst, filterPaint(std::move(filteredPaint)), |
John Reck | 3b4510cd | 2018-09-27 17:39:45 -0700 | [diff] [blame] | 266 | bitmap.palette()); |
Derek Sollenberger | fb0c8fc | 2017-07-26 13:53:27 -0400 | [diff] [blame] | 267 | if (!bitmap.isImmutable() && image.get() && !image->unique() && !dst.isEmpty()) { |
Stan Iliev | 0cc4e36 | 2017-05-18 14:21:23 -0400 | [diff] [blame] | 268 | mDisplayList->mMutableImages.push_back(image.get()); |
| 269 | } |
Stan Iliev | 021693b | 2016-10-17 16:26:15 -0400 | [diff] [blame] | 270 | } |
| 271 | |
Derek Sollenberger | 2d14213 | 2018-01-22 10:25:26 -0500 | [diff] [blame] | 272 | double SkiaRecordingCanvas::drawAnimatedImage(AnimatedImageDrawable* animatedImage) { |
| 273 | drawDrawable(animatedImage); |
| 274 | mDisplayList->mAnimatedImages.push_back(animatedImage); |
| 275 | return 0; |
| 276 | } |
| 277 | |
Chris Blume | 7b8a808 | 2018-11-30 15:51:58 -0800 | [diff] [blame] | 278 | } // namespace skiapipeline |
| 279 | } // namespace uirenderer |
| 280 | } // namespace android |