blob: d95acff8a38e0a9e409fe2dfedf0c23fa9a6ffa9 [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 Sarett44dc2702017-04-13 09:33:18 -040026#include <SkCanvasStateUtils.h>
Matt Sarettea70d222017-03-29 16:25:10 -040027#include <SkColorSpaceXformCanvas.h>
Derek Sollenberger6f485562015-07-30 10:00:39 -040028#include <SkDrawable.h>
John Reck849911a2015-01-20 07:51:14 -080029#include <SkDeque.h>
30#include <SkDrawFilter.h>
31#include <SkGraphics.h>
Derek Sollenberger6f485562015-07-30 10:00:39 -040032#include <SkImage.h>
Matt Sarett62feb3a2016-09-20 10:34:11 -040033#include <SkImagePriv.h>
Yuqian Liafc221492016-07-18 13:07:42 -040034#include <SkRSXform.h>
John Reck849911a2015-01-20 07:51:14 -080035#include <SkShader.h>
John Reck849911a2015-01-20 07:51:14 -080036#include <SkTemplates.h>
Stan Ilievf50806a2016-10-24 10:40:39 -040037#include <SkTextBlob.h>
Derek Sollenberger8872b382014-06-23 14:13:53 -040038
Ben Wagner60126ef2015-08-07 12:13:48 -040039#include <memory>
40
Derek Sollenberger8872b382014-06-23 14:13:53 -040041namespace android {
42
Stan Ilievf50806a2016-10-24 10:40:39 -040043using uirenderer::PaintUtils;
44
John Reckc1b33d62015-04-22 09:04:45 -070045Canvas* Canvas::create_canvas(const SkBitmap& bitmap) {
Derek Sollenberger8872b382014-06-23 14:13:53 -040046 return new SkiaCanvas(bitmap);
47}
48
Matt Sarettea70d222017-03-29 16:25:10 -040049Canvas* Canvas::create_canvas(SkCanvas* skiaCanvas, XformToSRGB xformToSRGB) {
50 return new SkiaCanvas(skiaCanvas, xformToSRGB);
Derek Sollenberger8872b382014-06-23 14:13:53 -040051}
52
Stan Ilievf50806a2016-10-24 10:40:39 -040053SkiaCanvas::SkiaCanvas() {}
54
Matt Sarettea70d222017-03-29 16:25:10 -040055SkiaCanvas::SkiaCanvas(SkCanvas* canvas, XformToSRGB xformToSRGB)
56 : mCanvas(canvas)
57{
58 LOG_ALWAYS_FATAL_IF(XformToSRGB::kImmediate == xformToSRGB);
59}
Stan Ilievf50806a2016-10-24 10:40:39 -040060
John Reckc1b33d62015-04-22 09:04:45 -070061SkiaCanvas::SkiaCanvas(const SkBitmap& bitmap) {
Romain Guy82426562017-04-04 19:38:50 -070062 sk_sp<SkColorSpace> cs = bitmap.refColorSpace();
Matt Sarettca9b7032017-04-13 12:18:47 -040063 mCanvasOwned =
64 std::unique_ptr<SkCanvas>(new SkCanvas(bitmap, SkCanvas::ColorBehavior::kLegacy));
Romain Guy82426562017-04-04 19:38:50 -070065 mCanvasWrapper = SkCreateColorSpaceXformCanvas(mCanvasOwned.get(),
66 cs == nullptr ? SkColorSpace::MakeSRGB() : std::move(cs));
Matt Sarettea70d222017-03-29 16:25:10 -040067 mCanvas = mCanvasWrapper.get();
Derek Sollenberger8872b382014-06-23 14:13:53 -040068}
69
Stan Iliev021693b2016-10-17 16:26:15 -040070SkiaCanvas::~SkiaCanvas() {}
71
Derek Sollenbergerc1908132016-07-15 10:28:16 -040072void SkiaCanvas::reset(SkCanvas* skiaCanvas) {
Mike Reed6acfe162016-11-18 17:21:09 -050073 if (mCanvas != skiaCanvas) {
74 mCanvas = skiaCanvas;
75 mCanvasOwned.reset();
76 }
Derek Sollenbergerc1908132016-07-15 10:28:16 -040077 mSaveStack.reset(nullptr);
78 mHighContrastText = false;
79}
80
Derek Sollenberger8872b382014-06-23 14:13:53 -040081// ----------------------------------------------------------------------------
82// Canvas state operations: Replace Bitmap
83// ----------------------------------------------------------------------------
84
John Reckc1b33d62015-04-22 09:04:45 -070085void SkiaCanvas::setBitmap(const SkBitmap& bitmap) {
Romain Guy82426562017-04-04 19:38:50 -070086 sk_sp<SkColorSpace> cs = bitmap.refColorSpace();
Matt Sarettca9b7032017-04-13 12:18:47 -040087 std::unique_ptr<SkCanvas> newCanvas =
88 std::unique_ptr<SkCanvas>(new SkCanvas(bitmap, SkCanvas::ColorBehavior::kLegacy));
Romain Guy82426562017-04-04 19:38:50 -070089 std::unique_ptr<SkCanvas> newCanvasWrapper = SkCreateColorSpaceXformCanvas(newCanvas.get(),
90 cs == nullptr ? SkColorSpace::MakeSRGB() : std::move(cs));
Tony Mantler4f641d12017-03-14 22:36:14 +000091
Tony Mantler4f641d12017-03-14 22:36:14 +000092 // deletes the previously owned canvas (if any)
Matt Sarettea70d222017-03-29 16:25:10 -040093 mCanvasOwned = std::move(newCanvas);
94 mCanvasWrapper = std::move(newCanvasWrapper);
95 mCanvas = mCanvasWrapper.get();
Tony Mantler4f641d12017-03-14 22:36:14 +000096
Derek Sollenberger8872b382014-06-23 14:13:53 -040097 // clean up the old save stack
Stan Ilievf50806a2016-10-24 10:40:39 -040098 mSaveStack.reset(nullptr);
Derek Sollenberger8872b382014-06-23 14:13:53 -040099}
100
101// ----------------------------------------------------------------------------
102// Canvas state operations
103// ----------------------------------------------------------------------------
104
105bool SkiaCanvas::isOpaque() {
Leon Scroggins IIIf35b9892015-07-31 10:38:40 -0400106 return mCanvas->imageInfo().isOpaque();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400107}
108
109int SkiaCanvas::width() {
Leon Scroggins IIIf35b9892015-07-31 10:38:40 -0400110 return mCanvas->imageInfo().width();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400111}
112
113int SkiaCanvas::height() {
Leon Scroggins IIIf35b9892015-07-31 10:38:40 -0400114 return mCanvas->imageInfo().height();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400115}
116
117// ----------------------------------------------------------------------------
118// Canvas state operations: Save (layer)
119// ----------------------------------------------------------------------------
120
121int SkiaCanvas::getSaveCount() const {
122 return mCanvas->getSaveCount();
123}
124
Florin Malitaeecff562015-12-21 10:43:01 -0500125int SkiaCanvas::save(SaveFlags::Flags flags) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400126 int count = mCanvas->save();
127 recordPartialSave(flags);
128 return count;
129}
130
Florin Malita5e271402015-11-04 14:36:02 -0500131// The SkiaCanvas::restore operation layers on the capability to preserve
132// either (or both) the matrix and/or clip state after a SkCanvas::restore
133// operation. It does this by explicitly saving off the clip & matrix state
134// when requested and playing it back after the SkCanvas::restore.
Derek Sollenberger8872b382014-06-23 14:13:53 -0400135void SkiaCanvas::restore() {
Stan Ilievf50806a2016-10-24 10:40:39 -0400136 const auto* rec = this->currentSaveRec();
137 if (!rec) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400138 // Fast path - no record for this frame.
139 mCanvas->restore();
140 return;
141 }
142
Florin Malitaeecff562015-12-21 10:43:01 -0500143 bool preserveMatrix = !(rec->saveFlags & SaveFlags::Matrix);
144 bool preserveClip = !(rec->saveFlags & SaveFlags::Clip);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400145
146 SkMatrix savedMatrix;
147 if (preserveMatrix) {
148 savedMatrix = mCanvas->getTotalMatrix();
149 }
150
Stan Ilievf50806a2016-10-24 10:40:39 -0400151 const size_t clipIndex = rec->clipIndex;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400152
153 mCanvas->restore();
Stan Ilievf50806a2016-10-24 10:40:39 -0400154 mSaveStack->pop_back();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400155
156 if (preserveMatrix) {
157 mCanvas->setMatrix(savedMatrix);
158 }
159
Stan Ilievf50806a2016-10-24 10:40:39 -0400160 if (preserveClip) {
161 this->applyPersistentClips(clipIndex);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400162 }
Derek Sollenberger8872b382014-06-23 14:13:53 -0400163}
164
165void SkiaCanvas::restoreToCount(int restoreCount) {
166 while (mCanvas->getSaveCount() > restoreCount) {
167 this->restore();
168 }
169}
170
Florin Malitaeecff562015-12-21 10:43:01 -0500171static inline SkCanvas::SaveLayerFlags layerFlags(SaveFlags::Flags flags) {
172 SkCanvas::SaveLayerFlags layerFlags = 0;
173
Yuqian Li83427ff2016-09-14 11:14:06 -0400174 // We intentionally ignore the SaveFlags::HasAlphaLayer and
175 // SkCanvas::kIsOpaque_SaveLayerFlag flags because HWUI ignores it
176 // and our Android client may use it incorrectly.
177 // In Skia, this flag is purely for performance optimization.
Florin Malitaeecff562015-12-21 10:43:01 -0500178
179 if (!(flags & SaveFlags::ClipToLayer)) {
180 layerFlags |= SkCanvas::kDontClipToLayer_Legacy_SaveLayerFlag;
181 }
182
183 return layerFlags;
184}
185
Derek Sollenberger8872b382014-06-23 14:13:53 -0400186int SkiaCanvas::saveLayer(float left, float top, float right, float bottom,
Florin Malitaeecff562015-12-21 10:43:01 -0500187 const SkPaint* paint, SaveFlags::Flags flags) {
188 const SkRect bounds = SkRect::MakeLTRB(left, top, right, bottom);
Derek Sollenbergerb8201192017-01-09 16:11:59 -0500189 const SkCanvas::SaveLayerRec rec(&bounds, paint, layerFlags(flags));
Florin Malitaeecff562015-12-21 10:43:01 -0500190
Stan Iliev68885e32016-12-14 11:18:34 -0500191 return mCanvas->saveLayer(rec);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400192}
193
194int SkiaCanvas::saveLayerAlpha(float left, float top, float right, float bottom,
Florin Malitaeecff562015-12-21 10:43:01 -0500195 int alpha, SaveFlags::Flags flags) {
Florin Malitaeecff562015-12-21 10:43:01 -0500196 if (static_cast<unsigned>(alpha) < 0xFF) {
Yuqian Lifd92ee42016-04-27 17:03:38 -0400197 SkPaint alphaPaint;
198 alphaPaint.setAlpha(alpha);
199 return this->saveLayer(left, top, right, bottom, &alphaPaint, flags);
Florin Malitaeecff562015-12-21 10:43:01 -0500200 }
Yuqian Lifd92ee42016-04-27 17:03:38 -0400201 return this->saveLayer(left, top, right, bottom, nullptr, flags);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400202}
203
Stan Ilievf50806a2016-10-24 10:40:39 -0400204class SkiaCanvas::Clip {
205public:
Mike Reed6e49c9f2016-12-02 15:36:59 -0500206 Clip(const SkRect& rect, SkClipOp op, const SkMatrix& m)
Stan Ilievf50806a2016-10-24 10:40:39 -0400207 : mType(Type::Rect), mOp(op), mMatrix(m), mRRect(SkRRect::MakeRect(rect)) {}
Mike Reed6e49c9f2016-12-02 15:36:59 -0500208 Clip(const SkRRect& rrect, SkClipOp op, const SkMatrix& m)
Stan Ilievf50806a2016-10-24 10:40:39 -0400209 : mType(Type::RRect), mOp(op), mMatrix(m), mRRect(rrect) {}
Mike Reed6e49c9f2016-12-02 15:36:59 -0500210 Clip(const SkPath& path, SkClipOp op, const SkMatrix& m)
Stan Ilievf50806a2016-10-24 10:40:39 -0400211 : mType(Type::Path), mOp(op), mMatrix(m), mPath(&path) {}
212
213 void apply(SkCanvas* canvas) const {
214 canvas->setMatrix(mMatrix);
215 switch (mType) {
216 case Type::Rect:
217 canvas->clipRect(mRRect.rect(), mOp);
218 break;
219 case Type::RRect:
220 canvas->clipRRect(mRRect, mOp);
221 break;
222 case Type::Path:
223 canvas->clipPath(*mPath.get(), mOp);
224 break;
225 }
226 }
227
228private:
229 enum class Type {
230 Rect,
231 RRect,
232 Path,
233 };
234
Mike Reed6e49c9f2016-12-02 15:36:59 -0500235 Type mType;
236 SkClipOp mOp;
237 SkMatrix mMatrix;
Stan Ilievf50806a2016-10-24 10:40:39 -0400238
239 // These are logically a union (tracked separately due to non-POD path).
240 SkTLazy<SkPath> mPath;
241 SkRRect mRRect;
242};
243
244const SkiaCanvas::SaveRec* SkiaCanvas::currentSaveRec() const {
245 const SaveRec* rec = mSaveStack
246 ? static_cast<const SaveRec*>(mSaveStack->back())
247 : nullptr;
248 int currentSaveCount = mCanvas->getSaveCount();
249 SkASSERT(!rec || currentSaveCount >= rec->saveCount);
250
251 return (rec && rec->saveCount == currentSaveCount) ? rec : nullptr;
252}
253
Derek Sollenberger8872b382014-06-23 14:13:53 -0400254// ----------------------------------------------------------------------------
255// functions to emulate legacy SaveFlags (i.e. independent matrix/clip flags)
256// ----------------------------------------------------------------------------
257
Florin Malitaeecff562015-12-21 10:43:01 -0500258void SkiaCanvas::recordPartialSave(SaveFlags::Flags flags) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400259 // A partial save is a save operation which doesn't capture the full canvas state.
Florin Malitaeecff562015-12-21 10:43:01 -0500260 // (either SaveFlags::Matrix or SaveFlags::Clip is missing).
Derek Sollenberger8872b382014-06-23 14:13:53 -0400261
262 // Mask-out non canvas state bits.
Florin Malitaeecff562015-12-21 10:43:01 -0500263 flags &= SaveFlags::MatrixClip;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400264
Florin Malitaeecff562015-12-21 10:43:01 -0500265 if (flags == SaveFlags::MatrixClip) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400266 // not a partial save.
267 return;
268 }
269
Stan Ilievf50806a2016-10-24 10:40:39 -0400270 if (!mSaveStack) {
Ben Wagnerd1cbc162015-08-19 12:45:09 -0400271 mSaveStack.reset(new SkDeque(sizeof(struct SaveRec), 8));
Derek Sollenberger8872b382014-06-23 14:13:53 -0400272 }
273
274 SaveRec* rec = static_cast<SaveRec*>(mSaveStack->push_back());
Florin Malita5e271402015-11-04 14:36:02 -0500275 rec->saveCount = mCanvas->getSaveCount();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400276 rec->saveFlags = flags;
Stan Ilievf50806a2016-10-24 10:40:39 -0400277 rec->clipIndex = mClipStack.size();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400278}
279
Stan Ilievf50806a2016-10-24 10:40:39 -0400280template <typename T>
Mike Reed6e49c9f2016-12-02 15:36:59 -0500281void SkiaCanvas::recordClip(const T& clip, SkClipOp op) {
Stan Ilievf50806a2016-10-24 10:40:39 -0400282 // Only need tracking when in a partial save frame which
283 // doesn't restore the clip.
284 const SaveRec* rec = this->currentSaveRec();
285 if (rec && !(rec->saveFlags & SaveFlags::Clip)) {
286 mClipStack.emplace_back(clip, op, mCanvas->getTotalMatrix());
Derek Sollenberger8872b382014-06-23 14:13:53 -0400287 }
288}
289
Stan Ilievf50806a2016-10-24 10:40:39 -0400290// Applies and optionally removes all clips >= index.
291void SkiaCanvas::applyPersistentClips(size_t clipStartIndex) {
292 SkASSERT(clipStartIndex <= mClipStack.size());
293 const auto begin = mClipStack.cbegin() + clipStartIndex;
294 const auto end = mClipStack.cend();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400295
Stan Ilievf50806a2016-10-24 10:40:39 -0400296 // Clip application mutates the CTM.
297 const SkMatrix saveMatrix = mCanvas->getTotalMatrix();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400298
Stan Ilievf50806a2016-10-24 10:40:39 -0400299 for (auto clip = begin; clip != end; ++clip) {
Mike Reed6acfe162016-11-18 17:21:09 -0500300 clip->apply(mCanvas);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400301 }
302
Stan Ilievf50806a2016-10-24 10:40:39 -0400303 mCanvas->setMatrix(saveMatrix);
304
305 // If the current/post-restore save rec is also persisting clips, we
306 // leave them on the stack to be reapplied part of the next restore().
307 // Otherwise we're done and just pop them.
308 const auto* rec = this->currentSaveRec();
309 if (!rec || (rec->saveFlags & SaveFlags::Clip)) {
310 mClipStack.erase(begin, end);
311 }
Derek Sollenberger8872b382014-06-23 14:13:53 -0400312}
313
314// ----------------------------------------------------------------------------
315// Canvas state operations: Matrix
316// ----------------------------------------------------------------------------
317
318void SkiaCanvas::getMatrix(SkMatrix* outMatrix) const {
319 *outMatrix = mCanvas->getTotalMatrix();
320}
321
322void SkiaCanvas::setMatrix(const SkMatrix& matrix) {
323 mCanvas->setMatrix(matrix);
324}
325
326void SkiaCanvas::concat(const SkMatrix& matrix) {
327 mCanvas->concat(matrix);
328}
329
330void SkiaCanvas::rotate(float degrees) {
331 mCanvas->rotate(degrees);
332}
333
334void SkiaCanvas::scale(float sx, float sy) {
335 mCanvas->scale(sx, sy);
336}
337
338void SkiaCanvas::skew(float sx, float sy) {
339 mCanvas->skew(sx, sy);
340}
341
342void SkiaCanvas::translate(float dx, float dy) {
343 mCanvas->translate(dx, dy);
344}
345
346// ----------------------------------------------------------------------------
347// Canvas state operations: Clips
348// ----------------------------------------------------------------------------
349
350// This function is a mirror of SkCanvas::getClipBounds except that it does
351// not outset the edge of the clip to account for anti-aliasing. There is
352// a skia bug to investigate pushing this logic into back into skia.
353// (see https://code.google.com/p/skia/issues/detail?id=1303)
354bool SkiaCanvas::getClipBounds(SkRect* outRect) const {
355 SkIRect ibounds;
Mike Reed5e438982017-01-25 08:23:25 -0500356 if (!mCanvas->getDeviceClipBounds(&ibounds)) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400357 return false;
358 }
359
360 SkMatrix inverse;
361 // if we can't invert the CTM, we can't return local clip bounds
362 if (!mCanvas->getTotalMatrix().invert(&inverse)) {
363 if (outRect) {
364 outRect->setEmpty();
365 }
366 return false;
367 }
368
369 if (NULL != outRect) {
370 SkRect r = SkRect::Make(ibounds);
371 inverse.mapRect(outRect, r);
372 }
373 return true;
374}
375
376bool SkiaCanvas::quickRejectRect(float left, float top, float right, float bottom) const {
377 SkRect bounds = SkRect::MakeLTRB(left, top, right, bottom);
378 return mCanvas->quickReject(bounds);
379}
380
381bool SkiaCanvas::quickRejectPath(const SkPath& path) const {
382 return mCanvas->quickReject(path);
383}
384
Mike Reed6e49c9f2016-12-02 15:36:59 -0500385bool SkiaCanvas::clipRect(float left, float top, float right, float bottom, SkClipOp op) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400386 SkRect rect = SkRect::MakeLTRB(left, top, right, bottom);
Stan Ilievf50806a2016-10-24 10:40:39 -0400387 this->recordClip(rect, op);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400388 mCanvas->clipRect(rect, op);
Chris Craik5ec6a282015-06-23 15:42:12 -0700389 return !mCanvas->isClipEmpty();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400390}
391
Mike Reed6e49c9f2016-12-02 15:36:59 -0500392bool SkiaCanvas::clipPath(const SkPath* path, SkClipOp op) {
Derek Sollenbergerc1908132016-07-15 10:28:16 -0400393 SkRRect roundRect;
394 if (path->isRRect(&roundRect)) {
Stan Ilievf50806a2016-10-24 10:40:39 -0400395 this->recordClip(roundRect, op);
Derek Sollenbergerc1908132016-07-15 10:28:16 -0400396 mCanvas->clipRRect(roundRect, op);
397 } else {
Stan Ilievf50806a2016-10-24 10:40:39 -0400398 this->recordClip(*path, op);
Derek Sollenbergerc1908132016-07-15 10:28:16 -0400399 mCanvas->clipPath(*path, op);
400 }
Chris Craik5ec6a282015-06-23 15:42:12 -0700401 return !mCanvas->isClipEmpty();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400402}
403
Derek Sollenberger8872b382014-06-23 14:13:53 -0400404// ----------------------------------------------------------------------------
405// Canvas state operations: Filters
406// ----------------------------------------------------------------------------
407
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400408SkDrawFilter* SkiaCanvas::getDrawFilter() {
409 return mCanvas->getDrawFilter();
410}
411
Derek Sollenberger8872b382014-06-23 14:13:53 -0400412void SkiaCanvas::setDrawFilter(SkDrawFilter* drawFilter) {
413 mCanvas->setDrawFilter(drawFilter);
414}
415
416// ----------------------------------------------------------------------------
Matt Sarett44dc2702017-04-13 09:33:18 -0400417// Canvas state operations: Capture
418// ----------------------------------------------------------------------------
419
420SkCanvasState* SkiaCanvas::captureCanvasState() const {
421 SkCanvas* canvas = mCanvas;
422 if (mCanvasOwned) {
423 // Important to use the underlying SkCanvas, not the wrapper.
424 canvas = mCanvasOwned.get();
425 }
426
427 // Workarounds for http://crbug.com/271096: SW draw only supports
428 // translate & scale transforms, and a simple rectangular clip.
429 // (This also avoids significant wasted time in calling
430 // SkCanvasStateUtils::CaptureCanvasState when the clip is complex).
431 if (!canvas->isClipRect() ||
432 (canvas->getTotalMatrix().getType() &
433 ~(SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask))) {
434 return nullptr;
435 }
436
437 return SkCanvasStateUtils::CaptureCanvasState(canvas);
438}
439
440// ----------------------------------------------------------------------------
Derek Sollenberger8872b382014-06-23 14:13:53 -0400441// Canvas draw operations
442// ----------------------------------------------------------------------------
443
Mike Reed260ab722016-10-07 15:59:20 -0400444void SkiaCanvas::drawColor(int color, SkBlendMode mode) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400445 mCanvas->drawColor(color, mode);
446}
447
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400448void SkiaCanvas::drawPaint(const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400449 mCanvas->drawPaint(paint);
450}
451
452// ----------------------------------------------------------------------------
453// Canvas draw operations: Geometry
454// ----------------------------------------------------------------------------
455
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400456void SkiaCanvas::drawPoints(const float* points, int count, const SkPaint& paint,
Derek Sollenberger8872b382014-06-23 14:13:53 -0400457 SkCanvas::PointMode mode) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500458 if (CC_UNLIKELY(count < 2 || paint.nothingToDraw())) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400459 // convert the floats into SkPoints
460 count >>= 1; // now it is the number of points
Ben Wagner6bbf68d2015-08-19 11:26:06 -0400461 std::unique_ptr<SkPoint[]> pts(new SkPoint[count]);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400462 for (int i = 0; i < count; i++) {
463 pts[i].set(points[0], points[1]);
464 points += 2;
465 }
Ben Wagner6bbf68d2015-08-19 11:26:06 -0400466 mCanvas->drawPoints(mode, count, pts.get(), paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400467}
468
469
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400470void SkiaCanvas::drawPoint(float x, float y, const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400471 mCanvas->drawPoint(x, y, paint);
472}
473
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400474void SkiaCanvas::drawPoints(const float* points, int count, const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400475 this->drawPoints(points, count, paint, SkCanvas::kPoints_PointMode);
476}
477
478void SkiaCanvas::drawLine(float startX, float startY, float stopX, float stopY,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400479 const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400480 mCanvas->drawLine(startX, startY, stopX, stopY, paint);
481}
482
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400483void SkiaCanvas::drawLines(const float* points, int count, const SkPaint& paint) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500484 if (CC_UNLIKELY(count < 4 || paint.nothingToDraw())) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400485 this->drawPoints(points, count, paint, SkCanvas::kLines_PointMode);
486}
487
488void SkiaCanvas::drawRect(float left, float top, float right, float bottom,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400489 const SkPaint& paint) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500490 if (CC_UNLIKELY(paint.nothingToDraw())) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400491 mCanvas->drawRectCoords(left, top, right, bottom, paint);
492
493}
494
Derek Sollenberger94394b32015-07-10 09:58:41 -0400495void SkiaCanvas::drawRegion(const SkRegion& region, const SkPaint& paint) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500496 if (CC_UNLIKELY(paint.nothingToDraw())) return;
Stan Ilievf50806a2016-10-24 10:40:39 -0400497 mCanvas->drawRegion(region, paint);
Derek Sollenberger94394b32015-07-10 09:58:41 -0400498}
499
Derek Sollenberger8872b382014-06-23 14:13:53 -0400500void SkiaCanvas::drawRoundRect(float left, float top, float right, float bottom,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400501 float rx, float ry, const SkPaint& paint) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500502 if (CC_UNLIKELY(paint.nothingToDraw())) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400503 SkRect rect = SkRect::MakeLTRB(left, top, right, bottom);
504 mCanvas->drawRoundRect(rect, rx, ry, paint);
505}
506
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400507void SkiaCanvas::drawCircle(float x, float y, float radius, const SkPaint& paint) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500508 if (CC_UNLIKELY(radius <= 0 || paint.nothingToDraw())) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400509 mCanvas->drawCircle(x, y, radius, paint);
510}
511
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400512void SkiaCanvas::drawOval(float left, float top, float right, float bottom, const SkPaint& paint) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500513 if (CC_UNLIKELY(paint.nothingToDraw())) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400514 SkRect oval = SkRect::MakeLTRB(left, top, right, bottom);
515 mCanvas->drawOval(oval, paint);
516}
517
518void SkiaCanvas::drawArc(float left, float top, float right, float bottom,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400519 float startAngle, float sweepAngle, bool useCenter, const SkPaint& paint) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500520 if (CC_UNLIKELY(paint.nothingToDraw())) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400521 SkRect arc = SkRect::MakeLTRB(left, top, right, bottom);
522 mCanvas->drawArc(arc, startAngle, sweepAngle, useCenter, paint);
523}
524
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400525void SkiaCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500526 if (CC_UNLIKELY(paint.nothingToDraw())) return;
Derek Sollenbergerd7f13f82017-03-09 13:08:27 -0500527 mCanvas->drawPath(path, paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400528}
529
530void SkiaCanvas::drawVertices(SkCanvas::VertexMode vertexMode, int vertexCount,
531 const float* verts, const float* texs, const int* colors,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400532 const uint16_t* indices, int indexCount, const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400533#ifndef SK_SCALAR_IS_FLOAT
534 SkDEBUGFAIL("SkScalar must be a float for these conversions to be valid");
535#endif
536 const int ptCount = vertexCount >> 1;
Mike Reed871cd2d2017-03-17 10:15:52 -0400537 mCanvas->drawVertices(SkVertices::MakeCopy(vertexMode, ptCount, (SkPoint*)verts,
538 (SkPoint*)texs, (SkColor*)colors,
539 indexCount, indices),
540 SkBlendMode::kModulate, paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400541}
542
543// ----------------------------------------------------------------------------
544// Canvas draw operations: Bitmaps
545// ----------------------------------------------------------------------------
546
sergeyvaed7f582016-10-14 16:30:21 -0700547void SkiaCanvas::drawBitmap(Bitmap& bitmap, float left, float top, const SkPaint* paint) {
548 SkBitmap skBitmap;
549 bitmap.getSkBitmap(&skBitmap);
550 mCanvas->drawBitmap(skBitmap, left, top, paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400551}
552
sergeyvfc9999502016-10-17 13:07:38 -0700553void SkiaCanvas::drawBitmap(Bitmap& hwuiBitmap, const SkMatrix& matrix, const SkPaint* paint) {
554 SkBitmap bitmap;
555 hwuiBitmap.getSkBitmap(&bitmap);
Mike Reed6acfe162016-11-18 17:21:09 -0500556 SkAutoCanvasRestore acr(mCanvas, true);
Mike Reed70ffbf92014-12-08 17:03:30 -0500557 mCanvas->concat(matrix);
558 mCanvas->drawBitmap(bitmap, 0, 0, paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400559}
560
sergeyvfc9999502016-10-17 13:07:38 -0700561void SkiaCanvas::drawBitmap(Bitmap& hwuiBitmap, float srcLeft, float srcTop,
Derek Sollenberger8872b382014-06-23 14:13:53 -0400562 float srcRight, float srcBottom, float dstLeft, float dstTop,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400563 float dstRight, float dstBottom, const SkPaint* paint) {
sergeyvfc9999502016-10-17 13:07:38 -0700564 SkBitmap bitmap;
565 hwuiBitmap.getSkBitmap(&bitmap);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400566 SkRect srcRect = SkRect::MakeLTRB(srcLeft, srcTop, srcRight, srcBottom);
567 SkRect dstRect = SkRect::MakeLTRB(dstLeft, dstTop, dstRight, dstBottom);
Leon Scroggins IIIf35b9892015-07-31 10:38:40 -0400568 mCanvas->drawBitmapRect(bitmap, srcRect, dstRect, paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400569}
570
sergeyv5fd2a1c2016-10-20 15:04:28 -0700571void SkiaCanvas::drawBitmapMesh(Bitmap& hwuiBitmap, int meshWidth, int meshHeight,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400572 const float* vertices, const int* colors, const SkPaint* paint) {
sergeyv5fd2a1c2016-10-20 15:04:28 -0700573 SkBitmap bitmap;
574 hwuiBitmap.getSkBitmap(&bitmap);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400575 const int ptCount = (meshWidth + 1) * (meshHeight + 1);
576 const int indexCount = meshWidth * meshHeight * 6;
Mike Reed871cd2d2017-03-17 10:15:52 -0400577 uint32_t flags = SkVertices::kHasTexCoords_BuilderFlag;
578 if (colors) {
579 flags |= SkVertices::kHasColors_BuilderFlag;
580 }
581 SkVertices::Builder builder(SkCanvas::kTriangles_VertexMode, ptCount, indexCount, flags);
582 memcpy(builder.positions(), vertices, ptCount * sizeof(SkPoint));
583 if (colors) {
584 memcpy(builder.colors(), colors, ptCount * sizeof(SkColor));
585 }
586 SkPoint* texs = builder.texCoords();
587 uint16_t* indices = builder.indices();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400588
589 // cons up texture coordinates and indices
590 {
591 const SkScalar w = SkIntToScalar(bitmap.width());
592 const SkScalar h = SkIntToScalar(bitmap.height());
593 const SkScalar dx = w / meshWidth;
594 const SkScalar dy = h / meshHeight;
595
596 SkPoint* texsPtr = texs;
597 SkScalar y = 0;
598 for (int i = 0; i <= meshHeight; i++) {
599 if (i == meshHeight) {
600 y = h; // to ensure numerically we hit h exactly
601 }
602 SkScalar x = 0;
603 for (int j = 0; j < meshWidth; j++) {
604 texsPtr->set(x, y);
605 texsPtr += 1;
606 x += dx;
607 }
608 texsPtr->set(w, y);
609 texsPtr += 1;
610 y += dy;
611 }
612 SkASSERT(texsPtr - texs == ptCount);
613 }
614
615 // cons up indices
616 {
617 uint16_t* indexPtr = indices;
618 int index = 0;
619 for (int i = 0; i < meshHeight; i++) {
620 for (int j = 0; j < meshWidth; j++) {
621 // lower-left triangle
622 *indexPtr++ = index;
623 *indexPtr++ = index + meshWidth + 1;
624 *indexPtr++ = index + meshWidth + 2;
625 // upper-right triangle
626 *indexPtr++ = index;
627 *indexPtr++ = index + meshWidth + 2;
628 *indexPtr++ = index + 1;
629 // bump to the next cell
630 index += 1;
631 }
632 // bump to the next row
633 index += 1;
634 }
635 SkASSERT(indexPtr - indices == indexCount);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400636 }
637
638 // double-check that we have legal indices
639#ifdef SK_DEBUG
640 {
641 for (int i = 0; i < indexCount; i++) {
642 SkASSERT((unsigned)indices[i] < (unsigned)ptCount);
643 }
644 }
645#endif
646
647 // cons-up a shader for the bitmap
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400648 SkPaint tmpPaint;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400649 if (paint) {
650 tmpPaint = *paint;
651 }
Stan Ilievf50806a2016-10-24 10:40:39 -0400652
653 sk_sp<SkImage> image = SkMakeImageFromRasterBitmap(bitmap, kNever_SkCopyPixelsMode);
654 tmpPaint.setShader(image->makeShader(SkShader::kClamp_TileMode, SkShader::kClamp_TileMode));
Derek Sollenberger8872b382014-06-23 14:13:53 -0400655
Mike Reed871cd2d2017-03-17 10:15:52 -0400656 mCanvas->drawVertices(builder.detach(), SkBlendMode::kModulate, tmpPaint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400657}
658
sergeyv5fd2a1c2016-10-20 15:04:28 -0700659void SkiaCanvas::drawNinePatch(Bitmap& hwuiBitmap, const Res_png_9patch& chunk,
Derek Sollenbergeredca3202015-07-10 13:56:39 -0400660 float dstLeft, float dstTop, float dstRight, float dstBottom, const SkPaint* paint) {
Stan Ilievf50806a2016-10-24 10:40:39 -0400661
sergeyv5fd2a1c2016-10-20 15:04:28 -0700662 SkBitmap bitmap;
663 hwuiBitmap.getSkBitmap(&bitmap);
Stan Ilievf50806a2016-10-24 10:40:39 -0400664
665 SkCanvas::Lattice lattice;
Matt Sarett7de73852016-10-25 18:36:39 -0400666 NinePatchUtils::SetLatticeDivs(&lattice, chunk, bitmap.width(), bitmap.height());
Stan Ilievf50806a2016-10-24 10:40:39 -0400667
668 lattice.fFlags = nullptr;
669 int numFlags = 0;
Stan Iliev021693b2016-10-17 16:26:15 -0400670 if (chunk.numColors > 0 && chunk.numColors == NinePatchUtils::NumDistinctRects(lattice)) {
Stan Ilievf50806a2016-10-24 10:40:39 -0400671 // We can expect the framework to give us a color for every distinct rect.
672 // Skia requires a flag for every rect.
673 numFlags = (lattice.fXCount + 1) * (lattice.fYCount + 1);
674 }
675
676 SkAutoSTMalloc<25, SkCanvas::Lattice::Flags> flags(numFlags);
677 if (numFlags > 0) {
Stan Iliev021693b2016-10-17 16:26:15 -0400678 NinePatchUtils::SetLatticeFlags(&lattice, flags.get(), numFlags, chunk);
Stan Ilievf50806a2016-10-24 10:40:39 -0400679 }
680
681 lattice.fBounds = nullptr;
682 SkRect dst = SkRect::MakeLTRB(dstLeft, dstTop, dstRight, dstBottom);
683 mCanvas->drawBitmapLattice(bitmap, lattice, dst, paint);
Derek Sollenbergeredca3202015-07-10 13:56:39 -0400684}
685
Doris Liu766431a2016-02-04 22:17:11 +0000686void SkiaCanvas::drawVectorDrawable(VectorDrawableRoot* vectorDrawable) {
Doris Liu1d8e1942016-03-02 15:16:28 -0800687 vectorDrawable->drawStaging(this);
Doris Liu766431a2016-02-04 22:17:11 +0000688}
689
Derek Sollenberger8872b382014-06-23 14:13:53 -0400690// ----------------------------------------------------------------------------
691// Canvas draw operations: Text
692// ----------------------------------------------------------------------------
693
sergeyvdccca442016-03-21 15:38:21 -0700694void SkiaCanvas::drawGlyphs(const uint16_t* text, const float* positions, int count,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400695 const SkPaint& paint, float x, float y,
Tom Hudson8dfaa492014-12-09 15:03:44 -0500696 float boundsLeft, float boundsTop, float boundsRight, float boundsBottom,
697 float totalAdvance) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500698 if (!text || !positions || count <= 0 || paint.nothingToDraw()) return;
Stan Ilievf50806a2016-10-24 10:40:39 -0400699 // Set align to left for drawing, as we don't want individual
700 // glyphs centered or right-aligned; the offset above takes
701 // care of all alignment.
702 SkPaint paintCopy(paint);
703 paintCopy.setTextAlign(SkPaint::kLeft_Align);
704
705 SkRect bounds = SkRect::MakeLTRB(boundsLeft + x, boundsTop + y,
706 boundsRight + x, boundsBottom + y);
707
708 SkTextBlobBuilder builder;
709 const SkTextBlobBuilder::RunBuffer& buffer = builder.allocRunPos(paintCopy, count, &bounds);
710 // TODO: we could reduce the number of memcpy's if the this were exposed further up
711 // in the architecture.
712 memcpy(buffer.glyphs, text, count * sizeof(uint16_t));
713 memcpy(buffer.pos, positions, (count << 1) * sizeof(float));
714
715 sk_sp<SkTextBlob> textBlob(builder.make());
716 mCanvas->drawTextBlob(textBlob, 0, 0, paintCopy);
717 drawTextDecorations(x, y, totalAdvance, paintCopy);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400718}
719
Yuqian Liafc221492016-07-18 13:07:42 -0400720void SkiaCanvas::drawLayoutOnPath(const minikin::Layout& layout, float hOffset, float vOffset,
721 const SkPaint& paint, const SkPath& path, size_t start, size_t end) {
722 const int N = end - start;
Derek Sollenbergere547dd02016-11-09 11:55:59 -0500723 SkAutoSTMalloc<1024, uint8_t> storage(N * (sizeof(uint16_t) + sizeof(SkRSXform)));
Yuqian Liafc221492016-07-18 13:07:42 -0400724 SkRSXform* xform = (SkRSXform*)storage.get();
725 uint16_t* glyphs = (uint16_t*)(xform + N);
726 SkPathMeasure meas(path, false);
727
728 for (size_t i = start; i < end; i++) {
729 glyphs[i - start] = layout.getGlyphId(i);
730 float x = hOffset + layout.getX(i);
731 float y = vOffset + layout.getY(i);
732
733 SkPoint pos;
734 SkVector tan;
735 if (!meas.getPosTan(x, &pos, &tan)) {
736 pos.set(x, y);
737 tan.set(1, 0);
738 }
739 xform[i - start].fSCos = tan.x();
740 xform[i - start].fSSin = tan.y();
741 xform[i - start].fTx = pos.x() - tan.y() * y;
742 xform[i - start].fTy = pos.y() + tan.x() * y;
743 }
744
745 this->asSkCanvas()->drawTextRSXform(glyphs, sizeof(uint16_t) * N, xform, nullptr, paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400746}
747
Derek Sollenberger6f485562015-07-30 10:00:39 -0400748// ----------------------------------------------------------------------------
749// Canvas draw operations: Animations
750// ----------------------------------------------------------------------------
751
Derek Sollenberger6f485562015-07-30 10:00:39 -0400752void SkiaCanvas::drawRoundRect(uirenderer::CanvasPropertyPrimitive* left,
753 uirenderer::CanvasPropertyPrimitive* top, uirenderer::CanvasPropertyPrimitive* right,
754 uirenderer::CanvasPropertyPrimitive* bottom, uirenderer::CanvasPropertyPrimitive* rx,
755 uirenderer::CanvasPropertyPrimitive* ry, uirenderer::CanvasPropertyPaint* paint) {
Stan Iliev021693b2016-10-17 16:26:15 -0400756 sk_sp<uirenderer::skiapipeline::AnimatedRoundRect> drawable(
757 new uirenderer::skiapipeline::AnimatedRoundRect(left, top, right, bottom, rx, ry, paint));
Derek Sollenberger6f485562015-07-30 10:00:39 -0400758 mCanvas->drawDrawable(drawable.get());
759}
760
761void SkiaCanvas::drawCircle(uirenderer::CanvasPropertyPrimitive* x, uirenderer::CanvasPropertyPrimitive* y,
762 uirenderer::CanvasPropertyPrimitive* radius, uirenderer::CanvasPropertyPaint* paint) {
Stan Iliev021693b2016-10-17 16:26:15 -0400763 sk_sp<uirenderer::skiapipeline::AnimatedCircle> drawable(new uirenderer::skiapipeline::AnimatedCircle(x, y, radius, paint));
Derek Sollenberger6f485562015-07-30 10:00:39 -0400764 mCanvas->drawDrawable(drawable.get());
765}
766
767// ----------------------------------------------------------------------------
768// Canvas draw operations: View System
769// ----------------------------------------------------------------------------
770
Stan Ilievf50806a2016-10-24 10:40:39 -0400771void SkiaCanvas::drawLayer(uirenderer::DeferredLayerUpdater* layerUpdater) {
Derek Sollenbergerc1908132016-07-15 10:28:16 -0400772 LOG_ALWAYS_FATAL("SkiaCanvas can't directly draw Layers");
773}
Derek Sollenberger6f485562015-07-30 10:00:39 -0400774
Derek Sollenbergerc1908132016-07-15 10:28:16 -0400775void SkiaCanvas::drawRenderNode(uirenderer::RenderNode* renderNode) {
776 LOG_ALWAYS_FATAL("SkiaCanvas can't directly draw RenderNodes");
777}
Derek Sollenberger6f485562015-07-30 10:00:39 -0400778
John Reckcd1c3eb2016-04-14 10:38:54 -0700779void SkiaCanvas::callDrawGLFunction(Functor* functor,
Derek Sollenbergerc1908132016-07-15 10:28:16 -0400780 uirenderer::GlFunctorLifecycleListener* listener) {
781 LOG_ALWAYS_FATAL("SkiaCanvas can't directly draw GL Content");
782}
Derek Sollenberger6f485562015-07-30 10:00:39 -0400783
Derek Sollenberger8872b382014-06-23 14:13:53 -0400784} // namespace android