blob: 9683d0614e26cec8094dc1ccd755b9ff82bae79f [file] [log] [blame]
Derek Sollenberger8872b382014-06-23 14:13:53 -04001/*
2 * Copyright (C) 2014 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
Derek Sollenbergerc1908132016-07-15 10:28:16 -040017#include "SkiaCanvas.h"
Derek Sollenberger8872b382014-06-23 14:13:53 -040018
Derek Sollenbergerc1908132016-07-15 10:28:16 -040019#include "CanvasProperty.h"
Matt Sarett7de73852016-10-25 18:36:39 -040020#include "NinePatchUtils.h"
Derek Sollenbergerc1908132016-07-15 10:28:16 -040021#include "VectorDrawable.h"
sergeyvaed7f582016-10-14 16:30:21 -070022#include "hwui/Bitmap.h"
Yuqian Liafc221492016-07-18 13:07:42 -040023#include "hwui/MinikinUtils.h"
Stan Iliev021693b2016-10-17 16:26:15 -040024#include "pipeline/skia/AnimatedDrawables.h"
Derek Sollenbergerc1908132016-07-15 10:28:16 -040025
Matt Sarettd0814db2017-04-13 09:33:18 -040026#include <SkCanvasStateUtils.h>
Derek Sollenbergerfb0c8fc2017-07-26 13:53:27 -040027#include <SkColorFilter.h>
28// TODO remove me!
Matt Sarettea70d222017-03-29 16:25:10 -040029#include <SkColorSpaceXformCanvas.h>
Derek Sollenberger6f485562015-07-30 10:00:39 -040030#include <SkDrawable.h>
John Reck849911a2015-01-20 07:51:14 -080031#include <SkDeque.h>
32#include <SkDrawFilter.h>
33#include <SkGraphics.h>
Derek Sollenberger6f485562015-07-30 10:00:39 -040034#include <SkImage.h>
Matt Sarett62feb3a2016-09-20 10:34:11 -040035#include <SkImagePriv.h>
Yuqian Liafc221492016-07-18 13:07:42 -040036#include <SkRSXform.h>
John Reck849911a2015-01-20 07:51:14 -080037#include <SkShader.h>
John Reck849911a2015-01-20 07:51:14 -080038#include <SkTemplates.h>
Stan Ilievf50806a2016-10-24 10:40:39 -040039#include <SkTextBlob.h>
Derek Sollenberger8872b382014-06-23 14:13:53 -040040
Ben Wagner60126ef2015-08-07 12:13:48 -040041#include <memory>
42
Derek Sollenberger8872b382014-06-23 14:13:53 -040043namespace android {
44
Stan Ilievf50806a2016-10-24 10:40:39 -040045using uirenderer::PaintUtils;
46
John Reckc1b33d62015-04-22 09:04:45 -070047Canvas* Canvas::create_canvas(const SkBitmap& bitmap) {
Derek Sollenberger8872b382014-06-23 14:13:53 -040048 return new SkiaCanvas(bitmap);
49}
50
Matt Sarettea70d222017-03-29 16:25:10 -040051Canvas* Canvas::create_canvas(SkCanvas* skiaCanvas, XformToSRGB xformToSRGB) {
52 return new SkiaCanvas(skiaCanvas, xformToSRGB);
Derek Sollenberger8872b382014-06-23 14:13:53 -040053}
54
Stan Ilievf50806a2016-10-24 10:40:39 -040055SkiaCanvas::SkiaCanvas() {}
56
Matt Sarettea70d222017-03-29 16:25:10 -040057SkiaCanvas::SkiaCanvas(SkCanvas* canvas, XformToSRGB xformToSRGB)
58 : mCanvas(canvas)
59{
60 LOG_ALWAYS_FATAL_IF(XformToSRGB::kImmediate == xformToSRGB);
61}
Stan Ilievf50806a2016-10-24 10:40:39 -040062
John Reckc1b33d62015-04-22 09:04:45 -070063SkiaCanvas::SkiaCanvas(const SkBitmap& bitmap) {
Romain Guy82426562017-04-04 19:38:50 -070064 sk_sp<SkColorSpace> cs = bitmap.refColorSpace();
Matt Sarettca9b7032017-04-13 12:18:47 -040065 mCanvasOwned =
66 std::unique_ptr<SkCanvas>(new SkCanvas(bitmap, SkCanvas::ColorBehavior::kLegacy));
Romain Guy82426562017-04-04 19:38:50 -070067 mCanvasWrapper = SkCreateColorSpaceXformCanvas(mCanvasOwned.get(),
68 cs == nullptr ? SkColorSpace::MakeSRGB() : std::move(cs));
Matt Sarettea70d222017-03-29 16:25:10 -040069 mCanvas = mCanvasWrapper.get();
Derek Sollenberger8872b382014-06-23 14:13:53 -040070}
71
Stan Iliev021693b2016-10-17 16:26:15 -040072SkiaCanvas::~SkiaCanvas() {}
73
Derek Sollenbergerc1908132016-07-15 10:28:16 -040074void SkiaCanvas::reset(SkCanvas* skiaCanvas) {
Mike Reed6acfe162016-11-18 17:21:09 -050075 if (mCanvas != skiaCanvas) {
76 mCanvas = skiaCanvas;
77 mCanvasOwned.reset();
78 }
Derek Sollenbergerc1908132016-07-15 10:28:16 -040079 mSaveStack.reset(nullptr);
80 mHighContrastText = false;
81}
82
Derek Sollenberger8872b382014-06-23 14:13:53 -040083// ----------------------------------------------------------------------------
84// Canvas state operations: Replace Bitmap
85// ----------------------------------------------------------------------------
86
John Reckc1b33d62015-04-22 09:04:45 -070087void SkiaCanvas::setBitmap(const SkBitmap& bitmap) {
Romain Guy82426562017-04-04 19:38:50 -070088 sk_sp<SkColorSpace> cs = bitmap.refColorSpace();
Matt Sarettca9b7032017-04-13 12:18:47 -040089 std::unique_ptr<SkCanvas> newCanvas =
90 std::unique_ptr<SkCanvas>(new SkCanvas(bitmap, SkCanvas::ColorBehavior::kLegacy));
Romain Guy82426562017-04-04 19:38:50 -070091 std::unique_ptr<SkCanvas> newCanvasWrapper = SkCreateColorSpaceXformCanvas(newCanvas.get(),
92 cs == nullptr ? SkColorSpace::MakeSRGB() : std::move(cs));
Tony Mantler4f641d12017-03-14 22:36:14 +000093
Tony Mantler4f641d12017-03-14 22:36:14 +000094 // deletes the previously owned canvas (if any)
Matt Sarettea70d222017-03-29 16:25:10 -040095 mCanvasOwned = std::move(newCanvas);
96 mCanvasWrapper = std::move(newCanvasWrapper);
97 mCanvas = mCanvasWrapper.get();
Tony Mantler4f641d12017-03-14 22:36:14 +000098
Derek Sollenberger8872b382014-06-23 14:13:53 -040099 // clean up the old save stack
Stan Ilievf50806a2016-10-24 10:40:39 -0400100 mSaveStack.reset(nullptr);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400101}
102
103// ----------------------------------------------------------------------------
104// Canvas state operations
105// ----------------------------------------------------------------------------
106
107bool SkiaCanvas::isOpaque() {
Leon Scroggins IIIf35b9892015-07-31 10:38:40 -0400108 return mCanvas->imageInfo().isOpaque();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400109}
110
111int SkiaCanvas::width() {
Leon Scroggins IIIf35b9892015-07-31 10:38:40 -0400112 return mCanvas->imageInfo().width();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400113}
114
115int SkiaCanvas::height() {
Leon Scroggins IIIf35b9892015-07-31 10:38:40 -0400116 return mCanvas->imageInfo().height();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400117}
118
119// ----------------------------------------------------------------------------
120// Canvas state operations: Save (layer)
121// ----------------------------------------------------------------------------
122
123int SkiaCanvas::getSaveCount() const {
124 return mCanvas->getSaveCount();
125}
126
Florin Malitaeecff562015-12-21 10:43:01 -0500127int SkiaCanvas::save(SaveFlags::Flags flags) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400128 int count = mCanvas->save();
129 recordPartialSave(flags);
130 return count;
131}
132
Florin Malita5e271402015-11-04 14:36:02 -0500133// The SkiaCanvas::restore operation layers on the capability to preserve
134// either (or both) the matrix and/or clip state after a SkCanvas::restore
135// operation. It does this by explicitly saving off the clip & matrix state
136// when requested and playing it back after the SkCanvas::restore.
Derek Sollenberger8872b382014-06-23 14:13:53 -0400137void SkiaCanvas::restore() {
Stan Ilievf50806a2016-10-24 10:40:39 -0400138 const auto* rec = this->currentSaveRec();
139 if (!rec) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400140 // Fast path - no record for this frame.
141 mCanvas->restore();
142 return;
143 }
144
Florin Malitaeecff562015-12-21 10:43:01 -0500145 bool preserveMatrix = !(rec->saveFlags & SaveFlags::Matrix);
146 bool preserveClip = !(rec->saveFlags & SaveFlags::Clip);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400147
148 SkMatrix savedMatrix;
149 if (preserveMatrix) {
150 savedMatrix = mCanvas->getTotalMatrix();
151 }
152
Stan Ilievf50806a2016-10-24 10:40:39 -0400153 const size_t clipIndex = rec->clipIndex;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400154
155 mCanvas->restore();
Stan Ilievf50806a2016-10-24 10:40:39 -0400156 mSaveStack->pop_back();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400157
158 if (preserveMatrix) {
159 mCanvas->setMatrix(savedMatrix);
160 }
161
Stan Ilievf50806a2016-10-24 10:40:39 -0400162 if (preserveClip) {
163 this->applyPersistentClips(clipIndex);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400164 }
Derek Sollenberger8872b382014-06-23 14:13:53 -0400165}
166
167void SkiaCanvas::restoreToCount(int restoreCount) {
168 while (mCanvas->getSaveCount() > restoreCount) {
169 this->restore();
170 }
171}
172
Florin Malitaeecff562015-12-21 10:43:01 -0500173static inline SkCanvas::SaveLayerFlags layerFlags(SaveFlags::Flags flags) {
174 SkCanvas::SaveLayerFlags layerFlags = 0;
175
Yuqian Li83427ff2016-09-14 11:14:06 -0400176 // We intentionally ignore the SaveFlags::HasAlphaLayer and
177 // SkCanvas::kIsOpaque_SaveLayerFlag flags because HWUI ignores it
178 // and our Android client may use it incorrectly.
179 // In Skia, this flag is purely for performance optimization.
Florin Malitaeecff562015-12-21 10:43:01 -0500180
181 if (!(flags & SaveFlags::ClipToLayer)) {
182 layerFlags |= SkCanvas::kDontClipToLayer_Legacy_SaveLayerFlag;
183 }
184
185 return layerFlags;
186}
187
Derek Sollenberger8872b382014-06-23 14:13:53 -0400188int SkiaCanvas::saveLayer(float left, float top, float right, float bottom,
Florin Malitaeecff562015-12-21 10:43:01 -0500189 const SkPaint* paint, SaveFlags::Flags flags) {
190 const SkRect bounds = SkRect::MakeLTRB(left, top, right, bottom);
Derek Sollenbergerb8201192017-01-09 16:11:59 -0500191 const SkCanvas::SaveLayerRec rec(&bounds, paint, layerFlags(flags));
Florin Malitaeecff562015-12-21 10:43:01 -0500192
Stan Iliev68885e32016-12-14 11:18:34 -0500193 return mCanvas->saveLayer(rec);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400194}
195
196int SkiaCanvas::saveLayerAlpha(float left, float top, float right, float bottom,
Florin Malitaeecff562015-12-21 10:43:01 -0500197 int alpha, SaveFlags::Flags flags) {
Florin Malitaeecff562015-12-21 10:43:01 -0500198 if (static_cast<unsigned>(alpha) < 0xFF) {
Yuqian Lifd92ee42016-04-27 17:03:38 -0400199 SkPaint alphaPaint;
200 alphaPaint.setAlpha(alpha);
201 return this->saveLayer(left, top, right, bottom, &alphaPaint, flags);
Florin Malitaeecff562015-12-21 10:43:01 -0500202 }
Yuqian Lifd92ee42016-04-27 17:03:38 -0400203 return this->saveLayer(left, top, right, bottom, nullptr, flags);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400204}
205
Stan Ilievf50806a2016-10-24 10:40:39 -0400206class SkiaCanvas::Clip {
207public:
Mike Reed6e49c9f2016-12-02 15:36:59 -0500208 Clip(const SkRect& rect, SkClipOp op, const SkMatrix& m)
Stan Ilievf50806a2016-10-24 10:40:39 -0400209 : mType(Type::Rect), mOp(op), mMatrix(m), mRRect(SkRRect::MakeRect(rect)) {}
Mike Reed6e49c9f2016-12-02 15:36:59 -0500210 Clip(const SkRRect& rrect, SkClipOp op, const SkMatrix& m)
Stan Ilievf50806a2016-10-24 10:40:39 -0400211 : mType(Type::RRect), mOp(op), mMatrix(m), mRRect(rrect) {}
Mike Reed6e49c9f2016-12-02 15:36:59 -0500212 Clip(const SkPath& path, SkClipOp op, const SkMatrix& m)
Stan Ilievf50806a2016-10-24 10:40:39 -0400213 : mType(Type::Path), mOp(op), mMatrix(m), mPath(&path) {}
214
215 void apply(SkCanvas* canvas) const {
216 canvas->setMatrix(mMatrix);
217 switch (mType) {
218 case Type::Rect:
219 canvas->clipRect(mRRect.rect(), mOp);
220 break;
221 case Type::RRect:
222 canvas->clipRRect(mRRect, mOp);
223 break;
224 case Type::Path:
225 canvas->clipPath(*mPath.get(), mOp);
226 break;
227 }
228 }
229
230private:
231 enum class Type {
232 Rect,
233 RRect,
234 Path,
235 };
236
Mike Reed6e49c9f2016-12-02 15:36:59 -0500237 Type mType;
238 SkClipOp mOp;
239 SkMatrix mMatrix;
Stan Ilievf50806a2016-10-24 10:40:39 -0400240
241 // These are logically a union (tracked separately due to non-POD path).
242 SkTLazy<SkPath> mPath;
243 SkRRect mRRect;
244};
245
246const SkiaCanvas::SaveRec* SkiaCanvas::currentSaveRec() const {
247 const SaveRec* rec = mSaveStack
248 ? static_cast<const SaveRec*>(mSaveStack->back())
249 : nullptr;
250 int currentSaveCount = mCanvas->getSaveCount();
251 SkASSERT(!rec || currentSaveCount >= rec->saveCount);
252
253 return (rec && rec->saveCount == currentSaveCount) ? rec : nullptr;
254}
255
Derek Sollenberger8872b382014-06-23 14:13:53 -0400256// ----------------------------------------------------------------------------
257// functions to emulate legacy SaveFlags (i.e. independent matrix/clip flags)
258// ----------------------------------------------------------------------------
259
Florin Malitaeecff562015-12-21 10:43:01 -0500260void SkiaCanvas::recordPartialSave(SaveFlags::Flags flags) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400261 // A partial save is a save operation which doesn't capture the full canvas state.
Florin Malitaeecff562015-12-21 10:43:01 -0500262 // (either SaveFlags::Matrix or SaveFlags::Clip is missing).
Derek Sollenberger8872b382014-06-23 14:13:53 -0400263
264 // Mask-out non canvas state bits.
Florin Malitaeecff562015-12-21 10:43:01 -0500265 flags &= SaveFlags::MatrixClip;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400266
Florin Malitaeecff562015-12-21 10:43:01 -0500267 if (flags == SaveFlags::MatrixClip) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400268 // not a partial save.
269 return;
270 }
271
Stan Ilievf50806a2016-10-24 10:40:39 -0400272 if (!mSaveStack) {
Ben Wagnerd1cbc162015-08-19 12:45:09 -0400273 mSaveStack.reset(new SkDeque(sizeof(struct SaveRec), 8));
Derek Sollenberger8872b382014-06-23 14:13:53 -0400274 }
275
276 SaveRec* rec = static_cast<SaveRec*>(mSaveStack->push_back());
Florin Malita5e271402015-11-04 14:36:02 -0500277 rec->saveCount = mCanvas->getSaveCount();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400278 rec->saveFlags = flags;
Stan Ilievf50806a2016-10-24 10:40:39 -0400279 rec->clipIndex = mClipStack.size();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400280}
281
Stan Ilievf50806a2016-10-24 10:40:39 -0400282template <typename T>
Mike Reed6e49c9f2016-12-02 15:36:59 -0500283void SkiaCanvas::recordClip(const T& clip, SkClipOp op) {
Stan Ilievf50806a2016-10-24 10:40:39 -0400284 // Only need tracking when in a partial save frame which
285 // doesn't restore the clip.
286 const SaveRec* rec = this->currentSaveRec();
287 if (rec && !(rec->saveFlags & SaveFlags::Clip)) {
288 mClipStack.emplace_back(clip, op, mCanvas->getTotalMatrix());
Derek Sollenberger8872b382014-06-23 14:13:53 -0400289 }
290}
291
Stan Ilievf50806a2016-10-24 10:40:39 -0400292// Applies and optionally removes all clips >= index.
293void SkiaCanvas::applyPersistentClips(size_t clipStartIndex) {
294 SkASSERT(clipStartIndex <= mClipStack.size());
295 const auto begin = mClipStack.cbegin() + clipStartIndex;
296 const auto end = mClipStack.cend();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400297
Stan Ilievf50806a2016-10-24 10:40:39 -0400298 // Clip application mutates the CTM.
299 const SkMatrix saveMatrix = mCanvas->getTotalMatrix();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400300
Stan Ilievf50806a2016-10-24 10:40:39 -0400301 for (auto clip = begin; clip != end; ++clip) {
Mike Reed6acfe162016-11-18 17:21:09 -0500302 clip->apply(mCanvas);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400303 }
304
Stan Ilievf50806a2016-10-24 10:40:39 -0400305 mCanvas->setMatrix(saveMatrix);
306
307 // If the current/post-restore save rec is also persisting clips, we
308 // leave them on the stack to be reapplied part of the next restore().
309 // Otherwise we're done and just pop them.
310 const auto* rec = this->currentSaveRec();
311 if (!rec || (rec->saveFlags & SaveFlags::Clip)) {
312 mClipStack.erase(begin, end);
313 }
Derek Sollenberger8872b382014-06-23 14:13:53 -0400314}
315
316// ----------------------------------------------------------------------------
317// Canvas state operations: Matrix
318// ----------------------------------------------------------------------------
319
320void SkiaCanvas::getMatrix(SkMatrix* outMatrix) const {
321 *outMatrix = mCanvas->getTotalMatrix();
322}
323
324void SkiaCanvas::setMatrix(const SkMatrix& matrix) {
325 mCanvas->setMatrix(matrix);
326}
327
328void SkiaCanvas::concat(const SkMatrix& matrix) {
329 mCanvas->concat(matrix);
330}
331
332void SkiaCanvas::rotate(float degrees) {
333 mCanvas->rotate(degrees);
334}
335
336void SkiaCanvas::scale(float sx, float sy) {
337 mCanvas->scale(sx, sy);
338}
339
340void SkiaCanvas::skew(float sx, float sy) {
341 mCanvas->skew(sx, sy);
342}
343
344void SkiaCanvas::translate(float dx, float dy) {
345 mCanvas->translate(dx, dy);
346}
347
348// ----------------------------------------------------------------------------
349// Canvas state operations: Clips
350// ----------------------------------------------------------------------------
351
352// This function is a mirror of SkCanvas::getClipBounds except that it does
353// not outset the edge of the clip to account for anti-aliasing. There is
354// a skia bug to investigate pushing this logic into back into skia.
355// (see https://code.google.com/p/skia/issues/detail?id=1303)
356bool SkiaCanvas::getClipBounds(SkRect* outRect) const {
357 SkIRect ibounds;
Mike Reed5e438982017-01-25 08:23:25 -0500358 if (!mCanvas->getDeviceClipBounds(&ibounds)) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400359 return false;
360 }
361
362 SkMatrix inverse;
363 // if we can't invert the CTM, we can't return local clip bounds
364 if (!mCanvas->getTotalMatrix().invert(&inverse)) {
365 if (outRect) {
366 outRect->setEmpty();
367 }
368 return false;
369 }
370
371 if (NULL != outRect) {
372 SkRect r = SkRect::Make(ibounds);
373 inverse.mapRect(outRect, r);
374 }
375 return true;
376}
377
378bool SkiaCanvas::quickRejectRect(float left, float top, float right, float bottom) const {
379 SkRect bounds = SkRect::MakeLTRB(left, top, right, bottom);
380 return mCanvas->quickReject(bounds);
381}
382
383bool SkiaCanvas::quickRejectPath(const SkPath& path) const {
384 return mCanvas->quickReject(path);
385}
386
Mike Reed6e49c9f2016-12-02 15:36:59 -0500387bool SkiaCanvas::clipRect(float left, float top, float right, float bottom, SkClipOp op) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400388 SkRect rect = SkRect::MakeLTRB(left, top, right, bottom);
Stan Ilievf50806a2016-10-24 10:40:39 -0400389 this->recordClip(rect, op);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400390 mCanvas->clipRect(rect, op);
Chris Craik5ec6a282015-06-23 15:42:12 -0700391 return !mCanvas->isClipEmpty();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400392}
393
Mike Reed6e49c9f2016-12-02 15:36:59 -0500394bool SkiaCanvas::clipPath(const SkPath* path, SkClipOp op) {
Derek Sollenbergerf7d98f42017-04-17 11:27:36 -0400395 this->recordClip(*path, op);
396 mCanvas->clipPath(*path, op);
Chris Craik5ec6a282015-06-23 15:42:12 -0700397 return !mCanvas->isClipEmpty();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400398}
399
Derek Sollenberger8872b382014-06-23 14:13:53 -0400400// ----------------------------------------------------------------------------
401// Canvas state operations: Filters
402// ----------------------------------------------------------------------------
403
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400404SkDrawFilter* SkiaCanvas::getDrawFilter() {
405 return mCanvas->getDrawFilter();
406}
407
Derek Sollenberger8872b382014-06-23 14:13:53 -0400408void SkiaCanvas::setDrawFilter(SkDrawFilter* drawFilter) {
409 mCanvas->setDrawFilter(drawFilter);
410}
411
412// ----------------------------------------------------------------------------
Matt Sarettd0814db2017-04-13 09:33:18 -0400413// Canvas state operations: Capture
414// ----------------------------------------------------------------------------
415
416SkCanvasState* SkiaCanvas::captureCanvasState() const {
417 SkCanvas* canvas = mCanvas;
418 if (mCanvasOwned) {
419 // Important to use the underlying SkCanvas, not the wrapper.
420 canvas = mCanvasOwned.get();
421 }
422
423 // Workarounds for http://crbug.com/271096: SW draw only supports
424 // translate & scale transforms, and a simple rectangular clip.
425 // (This also avoids significant wasted time in calling
426 // SkCanvasStateUtils::CaptureCanvasState when the clip is complex).
427 if (!canvas->isClipRect() ||
428 (canvas->getTotalMatrix().getType() &
429 ~(SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask))) {
430 return nullptr;
431 }
432
433 return SkCanvasStateUtils::CaptureCanvasState(canvas);
434}
435
436// ----------------------------------------------------------------------------
Derek Sollenberger8872b382014-06-23 14:13:53 -0400437// Canvas draw operations
438// ----------------------------------------------------------------------------
439
Mike Reed260ab722016-10-07 15:59:20 -0400440void SkiaCanvas::drawColor(int color, SkBlendMode mode) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400441 mCanvas->drawColor(color, mode);
442}
443
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400444void SkiaCanvas::drawPaint(const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400445 mCanvas->drawPaint(paint);
446}
447
448// ----------------------------------------------------------------------------
449// Canvas draw operations: Geometry
450// ----------------------------------------------------------------------------
451
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400452void SkiaCanvas::drawPoints(const float* points, int count, const SkPaint& paint,
Derek Sollenberger8872b382014-06-23 14:13:53 -0400453 SkCanvas::PointMode mode) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500454 if (CC_UNLIKELY(count < 2 || paint.nothingToDraw())) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400455 // convert the floats into SkPoints
456 count >>= 1; // now it is the number of points
Ben Wagner6bbf68d2015-08-19 11:26:06 -0400457 std::unique_ptr<SkPoint[]> pts(new SkPoint[count]);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400458 for (int i = 0; i < count; i++) {
459 pts[i].set(points[0], points[1]);
460 points += 2;
461 }
Ben Wagner6bbf68d2015-08-19 11:26:06 -0400462 mCanvas->drawPoints(mode, count, pts.get(), paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400463}
464
465
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400466void SkiaCanvas::drawPoint(float x, float y, const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400467 mCanvas->drawPoint(x, y, paint);
468}
469
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400470void SkiaCanvas::drawPoints(const float* points, int count, const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400471 this->drawPoints(points, count, paint, SkCanvas::kPoints_PointMode);
472}
473
474void SkiaCanvas::drawLine(float startX, float startY, float stopX, float stopY,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400475 const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400476 mCanvas->drawLine(startX, startY, stopX, stopY, paint);
477}
478
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400479void SkiaCanvas::drawLines(const float* points, int count, const SkPaint& paint) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500480 if (CC_UNLIKELY(count < 4 || paint.nothingToDraw())) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400481 this->drawPoints(points, count, paint, SkCanvas::kLines_PointMode);
482}
483
484void SkiaCanvas::drawRect(float left, float top, float right, float bottom,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400485 const SkPaint& paint) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500486 if (CC_UNLIKELY(paint.nothingToDraw())) return;
Mike Reed6c9bb242017-04-04 09:15:37 -0400487 mCanvas->drawRect({left, top, right, bottom}, paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400488
489}
490
Derek Sollenberger94394b32015-07-10 09:58:41 -0400491void SkiaCanvas::drawRegion(const SkRegion& region, const SkPaint& paint) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500492 if (CC_UNLIKELY(paint.nothingToDraw())) return;
Stan Ilievf50806a2016-10-24 10:40:39 -0400493 mCanvas->drawRegion(region, paint);
Derek Sollenberger94394b32015-07-10 09:58:41 -0400494}
495
Derek Sollenberger8872b382014-06-23 14:13:53 -0400496void SkiaCanvas::drawRoundRect(float left, float top, float right, float bottom,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400497 float rx, float ry, const SkPaint& paint) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500498 if (CC_UNLIKELY(paint.nothingToDraw())) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400499 SkRect rect = SkRect::MakeLTRB(left, top, right, bottom);
500 mCanvas->drawRoundRect(rect, rx, ry, paint);
501}
502
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400503void SkiaCanvas::drawCircle(float x, float y, float radius, const SkPaint& paint) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500504 if (CC_UNLIKELY(radius <= 0 || paint.nothingToDraw())) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400505 mCanvas->drawCircle(x, y, radius, paint);
506}
507
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400508void SkiaCanvas::drawOval(float left, float top, float right, float bottom, const SkPaint& paint) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500509 if (CC_UNLIKELY(paint.nothingToDraw())) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400510 SkRect oval = SkRect::MakeLTRB(left, top, right, bottom);
511 mCanvas->drawOval(oval, paint);
512}
513
514void SkiaCanvas::drawArc(float left, float top, float right, float bottom,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400515 float startAngle, float sweepAngle, bool useCenter, const SkPaint& paint) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500516 if (CC_UNLIKELY(paint.nothingToDraw())) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400517 SkRect arc = SkRect::MakeLTRB(left, top, right, bottom);
518 mCanvas->drawArc(arc, startAngle, sweepAngle, useCenter, paint);
519}
520
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400521void SkiaCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500522 if (CC_UNLIKELY(paint.nothingToDraw())) return;
Derek Sollenbergerd7f13f82017-03-09 13:08:27 -0500523 mCanvas->drawPath(path, paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400524}
525
Mike Reed826deef2017-04-04 15:32:04 -0400526void SkiaCanvas::drawVertices(const SkVertices* vertices, SkBlendMode mode, const SkPaint& paint) {
527 mCanvas->drawVertices(vertices, mode, paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400528}
529
530// ----------------------------------------------------------------------------
531// Canvas draw operations: Bitmaps
532// ----------------------------------------------------------------------------
533
Derek Sollenbergerfb0c8fc2017-07-26 13:53:27 -0400534inline static const SkPaint* addFilter(const SkPaint* origPaint, SkPaint* tmpPaint,
535 sk_sp<SkColorFilter> colorFilter) {
536 if (colorFilter) {
537 if (origPaint) {
538 *tmpPaint = *origPaint;
539 }
540 tmpPaint->setColorFilter(colorFilter);
541 return tmpPaint;
542 } else {
543 return origPaint;
544 }
Derek Sollenberger8872b382014-06-23 14:13:53 -0400545}
546
Derek Sollenbergerfb0c8fc2017-07-26 13:53:27 -0400547void SkiaCanvas::drawBitmap(Bitmap& bitmap, float left, float top, const SkPaint* paint) {
548 SkPaint tmpPaint;
549 sk_sp<SkColorFilter> colorFilter;
550 sk_sp<SkImage> image = bitmap.makeImage(&colorFilter);
551 mCanvas->drawImage(image, left, top, addFilter(paint, &tmpPaint, colorFilter));
552}
553
554void SkiaCanvas::drawBitmap(Bitmap& bitmap, const SkMatrix& matrix, const SkPaint* paint) {
Mike Reed6acfe162016-11-18 17:21:09 -0500555 SkAutoCanvasRestore acr(mCanvas, true);
Mike Reed70ffbf92014-12-08 17:03:30 -0500556 mCanvas->concat(matrix);
Derek Sollenbergerfb0c8fc2017-07-26 13:53:27 -0400557
558 SkPaint tmpPaint;
559 sk_sp<SkColorFilter> colorFilter;
560 sk_sp<SkImage> image = bitmap.makeImage(&colorFilter);
561 mCanvas->drawImage(image, 0, 0, addFilter(paint, &tmpPaint, colorFilter));
Derek Sollenberger8872b382014-06-23 14:13:53 -0400562}
563
Derek Sollenbergerfb0c8fc2017-07-26 13:53:27 -0400564void SkiaCanvas::drawBitmap(Bitmap& bitmap, float srcLeft, float srcTop,
Derek Sollenberger8872b382014-06-23 14:13:53 -0400565 float srcRight, float srcBottom, float dstLeft, float dstTop,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400566 float dstRight, float dstBottom, const SkPaint* paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400567 SkRect srcRect = SkRect::MakeLTRB(srcLeft, srcTop, srcRight, srcBottom);
568 SkRect dstRect = SkRect::MakeLTRB(dstLeft, dstTop, dstRight, dstBottom);
Derek Sollenbergerfb0c8fc2017-07-26 13:53:27 -0400569
570 SkPaint tmpPaint;
571 sk_sp<SkColorFilter> colorFilter;
572 sk_sp<SkImage> image = bitmap.makeImage(&colorFilter);
573 mCanvas->drawImageRect(image, srcRect, dstRect, addFilter(paint, &tmpPaint, colorFilter));
Derek Sollenberger8872b382014-06-23 14:13:53 -0400574}
575
Derek Sollenbergerfb0c8fc2017-07-26 13:53:27 -0400576void SkiaCanvas::drawBitmapMesh(Bitmap& bitmap, int meshWidth, int meshHeight,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400577 const float* vertices, const int* colors, const SkPaint* paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400578 const int ptCount = (meshWidth + 1) * (meshHeight + 1);
579 const int indexCount = meshWidth * meshHeight * 6;
Mike Reed871cd2d2017-03-17 10:15:52 -0400580 uint32_t flags = SkVertices::kHasTexCoords_BuilderFlag;
581 if (colors) {
582 flags |= SkVertices::kHasColors_BuilderFlag;
583 }
Mike Reed826deef2017-04-04 15:32:04 -0400584 SkVertices::Builder builder(SkVertices::kTriangles_VertexMode, ptCount, indexCount, flags);
Mike Reed871cd2d2017-03-17 10:15:52 -0400585 memcpy(builder.positions(), vertices, ptCount * sizeof(SkPoint));
586 if (colors) {
587 memcpy(builder.colors(), colors, ptCount * sizeof(SkColor));
588 }
589 SkPoint* texs = builder.texCoords();
590 uint16_t* indices = builder.indices();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400591
592 // cons up texture coordinates and indices
593 {
Derek Sollenbergerfb0c8fc2017-07-26 13:53:27 -0400594 const SkScalar w = SkIntToScalar(bitmap.width());
595 const SkScalar h = SkIntToScalar(bitmap.height());
Derek Sollenberger8872b382014-06-23 14:13:53 -0400596 const SkScalar dx = w / meshWidth;
597 const SkScalar dy = h / meshHeight;
598
599 SkPoint* texsPtr = texs;
600 SkScalar y = 0;
601 for (int i = 0; i <= meshHeight; i++) {
602 if (i == meshHeight) {
603 y = h; // to ensure numerically we hit h exactly
604 }
605 SkScalar x = 0;
606 for (int j = 0; j < meshWidth; j++) {
607 texsPtr->set(x, y);
608 texsPtr += 1;
609 x += dx;
610 }
611 texsPtr->set(w, y);
612 texsPtr += 1;
613 y += dy;
614 }
615 SkASSERT(texsPtr - texs == ptCount);
616 }
617
618 // cons up indices
619 {
620 uint16_t* indexPtr = indices;
621 int index = 0;
622 for (int i = 0; i < meshHeight; i++) {
623 for (int j = 0; j < meshWidth; j++) {
624 // lower-left triangle
625 *indexPtr++ = index;
626 *indexPtr++ = index + meshWidth + 1;
627 *indexPtr++ = index + meshWidth + 2;
628 // upper-right triangle
629 *indexPtr++ = index;
630 *indexPtr++ = index + meshWidth + 2;
631 *indexPtr++ = index + 1;
632 // bump to the next cell
633 index += 1;
634 }
635 // bump to the next row
636 index += 1;
637 }
638 SkASSERT(indexPtr - indices == indexCount);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400639 }
640
641 // double-check that we have legal indices
642#ifdef SK_DEBUG
643 {
644 for (int i = 0; i < indexCount; i++) {
645 SkASSERT((unsigned)indices[i] < (unsigned)ptCount);
646 }
647 }
648#endif
649
650 // cons-up a shader for the bitmap
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400651 SkPaint tmpPaint;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400652 if (paint) {
653 tmpPaint = *paint;
654 }
Stan Ilievf50806a2016-10-24 10:40:39 -0400655
Derek Sollenbergerfb0c8fc2017-07-26 13:53:27 -0400656 sk_sp<SkColorFilter> colorFilter;
657 sk_sp<SkImage> image = bitmap.makeImage(&colorFilter);
658 sk_sp<SkShader> shader = image->makeShader(SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);
659 if(colorFilter) {
660 shader = shader->makeWithColorFilter(colorFilter);
661 }
662 tmpPaint.setShader(shader);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400663
Mike Reed871cd2d2017-03-17 10:15:52 -0400664 mCanvas->drawVertices(builder.detach(), SkBlendMode::kModulate, tmpPaint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400665}
666
Derek Sollenbergerfb0c8fc2017-07-26 13:53:27 -0400667void SkiaCanvas::drawNinePatch(Bitmap& bitmap, const Res_png_9patch& chunk,
Derek Sollenbergeredca3202015-07-10 13:56:39 -0400668 float dstLeft, float dstTop, float dstRight, float dstBottom, const SkPaint* paint) {
Stan Ilievf50806a2016-10-24 10:40:39 -0400669
Stan Ilievf50806a2016-10-24 10:40:39 -0400670 SkCanvas::Lattice lattice;
Derek Sollenbergerfb0c8fc2017-07-26 13:53:27 -0400671 NinePatchUtils::SetLatticeDivs(&lattice, chunk, bitmap.width(), bitmap.height());
Stan Ilievf50806a2016-10-24 10:40:39 -0400672
673 lattice.fFlags = nullptr;
674 int numFlags = 0;
Stan Iliev021693b2016-10-17 16:26:15 -0400675 if (chunk.numColors > 0 && chunk.numColors == NinePatchUtils::NumDistinctRects(lattice)) {
Stan Ilievf50806a2016-10-24 10:40:39 -0400676 // We can expect the framework to give us a color for every distinct rect.
677 // Skia requires a flag for every rect.
678 numFlags = (lattice.fXCount + 1) * (lattice.fYCount + 1);
679 }
680
681 SkAutoSTMalloc<25, SkCanvas::Lattice::Flags> flags(numFlags);
682 if (numFlags > 0) {
Stan Iliev021693b2016-10-17 16:26:15 -0400683 NinePatchUtils::SetLatticeFlags(&lattice, flags.get(), numFlags, chunk);
Stan Ilievf50806a2016-10-24 10:40:39 -0400684 }
685
686 lattice.fBounds = nullptr;
687 SkRect dst = SkRect::MakeLTRB(dstLeft, dstTop, dstRight, dstBottom);
Derek Sollenbergerfb0c8fc2017-07-26 13:53:27 -0400688
689 SkPaint tmpPaint;
690 sk_sp<SkColorFilter> colorFilter;
691 sk_sp<SkImage> image = bitmap.makeImage(&colorFilter);
692 mCanvas->drawImageLattice(image.get(), lattice, dst, addFilter(paint, &tmpPaint, colorFilter));
Derek Sollenbergeredca3202015-07-10 13:56:39 -0400693}
694
Doris Liu766431a2016-02-04 22:17:11 +0000695void SkiaCanvas::drawVectorDrawable(VectorDrawableRoot* vectorDrawable) {
Doris Liu1d8e1942016-03-02 15:16:28 -0800696 vectorDrawable->drawStaging(this);
Doris Liu766431a2016-02-04 22:17:11 +0000697}
698
Derek Sollenberger8872b382014-06-23 14:13:53 -0400699// ----------------------------------------------------------------------------
700// Canvas draw operations: Text
701// ----------------------------------------------------------------------------
702
Stan Iliev0b58d992017-03-30 18:22:27 -0400703void SkiaCanvas::drawGlyphs(ReadGlyphFunc glyphFunc, int count, const SkPaint& paint, float x,
704 float y, float boundsLeft, float boundsTop, float boundsRight, float boundsBottom,
Tom Hudson8dfaa492014-12-09 15:03:44 -0500705 float totalAdvance) {
Stan Iliev0b58d992017-03-30 18:22:27 -0400706 if (count <= 0 || paint.nothingToDraw()) return;
Stan Ilievf50806a2016-10-24 10:40:39 -0400707 // Set align to left for drawing, as we don't want individual
708 // glyphs centered or right-aligned; the offset above takes
709 // care of all alignment.
710 SkPaint paintCopy(paint);
711 paintCopy.setTextAlign(SkPaint::kLeft_Align);
712
713 SkRect bounds = SkRect::MakeLTRB(boundsLeft + x, boundsTop + y,
714 boundsRight + x, boundsBottom + y);
715
716 SkTextBlobBuilder builder;
717 const SkTextBlobBuilder::RunBuffer& buffer = builder.allocRunPos(paintCopy, count, &bounds);
Stan Iliev0b58d992017-03-30 18:22:27 -0400718 glyphFunc(buffer.glyphs, buffer.pos);
Stan Ilievf50806a2016-10-24 10:40:39 -0400719
720 sk_sp<SkTextBlob> textBlob(builder.make());
721 mCanvas->drawTextBlob(textBlob, 0, 0, paintCopy);
722 drawTextDecorations(x, y, totalAdvance, paintCopy);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400723}
724
Yuqian Liafc221492016-07-18 13:07:42 -0400725void SkiaCanvas::drawLayoutOnPath(const minikin::Layout& layout, float hOffset, float vOffset,
726 const SkPaint& paint, const SkPath& path, size_t start, size_t end) {
727 const int N = end - start;
Derek Sollenbergere547dd02016-11-09 11:55:59 -0500728 SkAutoSTMalloc<1024, uint8_t> storage(N * (sizeof(uint16_t) + sizeof(SkRSXform)));
Yuqian Liafc221492016-07-18 13:07:42 -0400729 SkRSXform* xform = (SkRSXform*)storage.get();
730 uint16_t* glyphs = (uint16_t*)(xform + N);
731 SkPathMeasure meas(path, false);
732
733 for (size_t i = start; i < end; i++) {
734 glyphs[i - start] = layout.getGlyphId(i);
735 float x = hOffset + layout.getX(i);
736 float y = vOffset + layout.getY(i);
737
738 SkPoint pos;
739 SkVector tan;
740 if (!meas.getPosTan(x, &pos, &tan)) {
741 pos.set(x, y);
742 tan.set(1, 0);
743 }
744 xform[i - start].fSCos = tan.x();
745 xform[i - start].fSSin = tan.y();
746 xform[i - start].fTx = pos.x() - tan.y() * y;
747 xform[i - start].fTy = pos.y() + tan.x() * y;
748 }
749
750 this->asSkCanvas()->drawTextRSXform(glyphs, sizeof(uint16_t) * N, xform, nullptr, paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400751}
752
Derek Sollenberger6f485562015-07-30 10:00:39 -0400753// ----------------------------------------------------------------------------
754// Canvas draw operations: Animations
755// ----------------------------------------------------------------------------
756
Derek Sollenberger6f485562015-07-30 10:00:39 -0400757void SkiaCanvas::drawRoundRect(uirenderer::CanvasPropertyPrimitive* left,
758 uirenderer::CanvasPropertyPrimitive* top, uirenderer::CanvasPropertyPrimitive* right,
759 uirenderer::CanvasPropertyPrimitive* bottom, uirenderer::CanvasPropertyPrimitive* rx,
760 uirenderer::CanvasPropertyPrimitive* ry, uirenderer::CanvasPropertyPaint* paint) {
Stan Iliev021693b2016-10-17 16:26:15 -0400761 sk_sp<uirenderer::skiapipeline::AnimatedRoundRect> drawable(
762 new uirenderer::skiapipeline::AnimatedRoundRect(left, top, right, bottom, rx, ry, paint));
Derek Sollenberger6f485562015-07-30 10:00:39 -0400763 mCanvas->drawDrawable(drawable.get());
764}
765
766void SkiaCanvas::drawCircle(uirenderer::CanvasPropertyPrimitive* x, uirenderer::CanvasPropertyPrimitive* y,
767 uirenderer::CanvasPropertyPrimitive* radius, uirenderer::CanvasPropertyPaint* paint) {
Stan Iliev021693b2016-10-17 16:26:15 -0400768 sk_sp<uirenderer::skiapipeline::AnimatedCircle> drawable(new uirenderer::skiapipeline::AnimatedCircle(x, y, radius, paint));
Derek Sollenberger6f485562015-07-30 10:00:39 -0400769 mCanvas->drawDrawable(drawable.get());
770}
771
772// ----------------------------------------------------------------------------
773// Canvas draw operations: View System
774// ----------------------------------------------------------------------------
775
Stan Ilievf50806a2016-10-24 10:40:39 -0400776void SkiaCanvas::drawLayer(uirenderer::DeferredLayerUpdater* layerUpdater) {
Derek Sollenbergerc1908132016-07-15 10:28:16 -0400777 LOG_ALWAYS_FATAL("SkiaCanvas can't directly draw Layers");
778}
Derek Sollenberger6f485562015-07-30 10:00:39 -0400779
Derek Sollenbergerc1908132016-07-15 10:28:16 -0400780void SkiaCanvas::drawRenderNode(uirenderer::RenderNode* renderNode) {
781 LOG_ALWAYS_FATAL("SkiaCanvas can't directly draw RenderNodes");
782}
Derek Sollenberger6f485562015-07-30 10:00:39 -0400783
John Reckcd1c3eb2016-04-14 10:38:54 -0700784void SkiaCanvas::callDrawGLFunction(Functor* functor,
Derek Sollenbergerc1908132016-07-15 10:28:16 -0400785 uirenderer::GlFunctorLifecycleListener* listener) {
786 LOG_ALWAYS_FATAL("SkiaCanvas can't directly draw GL Content");
787}
Derek Sollenberger6f485562015-07-30 10:00:39 -0400788
Derek Sollenberger8872b382014-06-23 14:13:53 -0400789} // namespace android