blob: 9f649ead2b52cc8231038a23078066302ea61bcb [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 Sarettea70d222017-03-29 16:25:10 -040026#include <SkColorSpaceXformCanvas.h>
Derek Sollenberger6f485562015-07-30 10:00:39 -040027#include <SkDrawable.h>
John Reck849911a2015-01-20 07:51:14 -080028#include <SkDeque.h>
29#include <SkDrawFilter.h>
30#include <SkGraphics.h>
Derek Sollenberger6f485562015-07-30 10:00:39 -040031#include <SkImage.h>
Matt Sarett62feb3a2016-09-20 10:34:11 -040032#include <SkImagePriv.h>
Yuqian Liafc221492016-07-18 13:07:42 -040033#include <SkRSXform.h>
John Reck849911a2015-01-20 07:51:14 -080034#include <SkShader.h>
John Reck849911a2015-01-20 07:51:14 -080035#include <SkTemplates.h>
Stan Ilievf50806a2016-10-24 10:40:39 -040036#include <SkTextBlob.h>
Derek Sollenberger8872b382014-06-23 14:13:53 -040037
Ben Wagner60126ef2015-08-07 12:13:48 -040038#include <memory>
39
Derek Sollenberger8872b382014-06-23 14:13:53 -040040namespace android {
41
Stan Ilievf50806a2016-10-24 10:40:39 -040042using uirenderer::PaintUtils;
43
John Reckc1b33d62015-04-22 09:04:45 -070044Canvas* Canvas::create_canvas(const SkBitmap& bitmap) {
Derek Sollenberger8872b382014-06-23 14:13:53 -040045 return new SkiaCanvas(bitmap);
46}
47
Matt Sarettea70d222017-03-29 16:25:10 -040048Canvas* Canvas::create_canvas(SkCanvas* skiaCanvas, XformToSRGB xformToSRGB) {
49 return new SkiaCanvas(skiaCanvas, xformToSRGB);
Derek Sollenberger8872b382014-06-23 14:13:53 -040050}
51
Stan Ilievf50806a2016-10-24 10:40:39 -040052SkiaCanvas::SkiaCanvas() {}
53
Matt Sarettea70d222017-03-29 16:25:10 -040054SkiaCanvas::SkiaCanvas(SkCanvas* canvas, XformToSRGB xformToSRGB)
55 : mCanvas(canvas)
56{
57 LOG_ALWAYS_FATAL_IF(XformToSRGB::kImmediate == xformToSRGB);
58}
Stan Ilievf50806a2016-10-24 10:40:39 -040059
John Reckc1b33d62015-04-22 09:04:45 -070060SkiaCanvas::SkiaCanvas(const SkBitmap& bitmap) {
Romain Guy82426562017-04-04 19:38:50 -070061 sk_sp<SkColorSpace> cs = bitmap.refColorSpace();
Mike Reed6acfe162016-11-18 17:21:09 -050062 mCanvasOwned = std::unique_ptr<SkCanvas>(new SkCanvas(bitmap));
Romain Guy82426562017-04-04 19:38:50 -070063 mCanvasWrapper = SkCreateColorSpaceXformCanvas(mCanvasOwned.get(),
64 cs == nullptr ? SkColorSpace::MakeSRGB() : std::move(cs));
Matt Sarettea70d222017-03-29 16:25:10 -040065 mCanvas = mCanvasWrapper.get();
Derek Sollenberger8872b382014-06-23 14:13:53 -040066}
67
Stan Iliev021693b2016-10-17 16:26:15 -040068SkiaCanvas::~SkiaCanvas() {}
69
Derek Sollenbergerc1908132016-07-15 10:28:16 -040070void SkiaCanvas::reset(SkCanvas* skiaCanvas) {
Mike Reed6acfe162016-11-18 17:21:09 -050071 if (mCanvas != skiaCanvas) {
72 mCanvas = skiaCanvas;
73 mCanvasOwned.reset();
74 }
Derek Sollenbergerc1908132016-07-15 10:28:16 -040075 mSaveStack.reset(nullptr);
76 mHighContrastText = false;
77}
78
Derek Sollenberger8872b382014-06-23 14:13:53 -040079// ----------------------------------------------------------------------------
80// Canvas state operations: Replace Bitmap
81// ----------------------------------------------------------------------------
82
Tony Mantler4f641d12017-03-14 22:36:14 +000083class ClipCopier : public SkCanvas::ClipVisitor {
84public:
85 explicit ClipCopier(SkCanvas* dstCanvas) : m_dstCanvas(dstCanvas) {}
86
87 virtual void clipRect(const SkRect& rect, SkClipOp op, bool antialias) {
88 m_dstCanvas->clipRect(rect, op, antialias);
89 }
90 virtual void clipRRect(const SkRRect& rrect, SkClipOp op, bool antialias) {
91 m_dstCanvas->clipRRect(rrect, op, antialias);
92 }
93 virtual void clipPath(const SkPath& path, SkClipOp op, bool antialias) {
94 m_dstCanvas->clipPath(path, op, antialias);
95 }
96
97private:
98 SkCanvas* m_dstCanvas;
99};
100
John Reckc1b33d62015-04-22 09:04:45 -0700101void SkiaCanvas::setBitmap(const SkBitmap& bitmap) {
Romain Guy82426562017-04-04 19:38:50 -0700102 sk_sp<SkColorSpace> cs = bitmap.refColorSpace();
Matt Sarettea70d222017-03-29 16:25:10 -0400103 std::unique_ptr<SkCanvas> newCanvas = std::unique_ptr<SkCanvas>(new SkCanvas(bitmap));
Romain Guy82426562017-04-04 19:38:50 -0700104 std::unique_ptr<SkCanvas> newCanvasWrapper = SkCreateColorSpaceXformCanvas(newCanvas.get(),
105 cs == nullptr ? SkColorSpace::MakeSRGB() : std::move(cs));
Tony Mantler4f641d12017-03-14 22:36:14 +0000106
107 if (!bitmap.isNull()) {
108 // Copy the canvas matrix & clip state.
Matt Sarettea70d222017-03-29 16:25:10 -0400109 newCanvasWrapper->setMatrix(mCanvas->getTotalMatrix());
Tony Mantler4f641d12017-03-14 22:36:14 +0000110
Matt Sarettea70d222017-03-29 16:25:10 -0400111 ClipCopier copier(newCanvasWrapper.get());
Tony Mantler4f641d12017-03-14 22:36:14 +0000112 mCanvas->replayClips(&copier);
113 }
114
115 // deletes the previously owned canvas (if any)
Matt Sarettea70d222017-03-29 16:25:10 -0400116 mCanvasOwned = std::move(newCanvas);
117 mCanvasWrapper = std::move(newCanvasWrapper);
118 mCanvas = mCanvasWrapper.get();
Tony Mantler4f641d12017-03-14 22:36:14 +0000119
Derek Sollenberger8872b382014-06-23 14:13:53 -0400120 // clean up the old save stack
Stan Ilievf50806a2016-10-24 10:40:39 -0400121 mSaveStack.reset(nullptr);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400122}
123
124// ----------------------------------------------------------------------------
125// Canvas state operations
126// ----------------------------------------------------------------------------
127
128bool SkiaCanvas::isOpaque() {
Leon Scroggins IIIf35b9892015-07-31 10:38:40 -0400129 return mCanvas->imageInfo().isOpaque();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400130}
131
132int SkiaCanvas::width() {
Leon Scroggins IIIf35b9892015-07-31 10:38:40 -0400133 return mCanvas->imageInfo().width();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400134}
135
136int SkiaCanvas::height() {
Leon Scroggins IIIf35b9892015-07-31 10:38:40 -0400137 return mCanvas->imageInfo().height();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400138}
139
140// ----------------------------------------------------------------------------
141// Canvas state operations: Save (layer)
142// ----------------------------------------------------------------------------
143
144int SkiaCanvas::getSaveCount() const {
145 return mCanvas->getSaveCount();
146}
147
Florin Malitaeecff562015-12-21 10:43:01 -0500148int SkiaCanvas::save(SaveFlags::Flags flags) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400149 int count = mCanvas->save();
150 recordPartialSave(flags);
151 return count;
152}
153
Florin Malita5e271402015-11-04 14:36:02 -0500154// The SkiaCanvas::restore operation layers on the capability to preserve
155// either (or both) the matrix and/or clip state after a SkCanvas::restore
156// operation. It does this by explicitly saving off the clip & matrix state
157// when requested and playing it back after the SkCanvas::restore.
Derek Sollenberger8872b382014-06-23 14:13:53 -0400158void SkiaCanvas::restore() {
Stan Ilievf50806a2016-10-24 10:40:39 -0400159 const auto* rec = this->currentSaveRec();
160 if (!rec) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400161 // Fast path - no record for this frame.
162 mCanvas->restore();
163 return;
164 }
165
Florin Malitaeecff562015-12-21 10:43:01 -0500166 bool preserveMatrix = !(rec->saveFlags & SaveFlags::Matrix);
167 bool preserveClip = !(rec->saveFlags & SaveFlags::Clip);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400168
169 SkMatrix savedMatrix;
170 if (preserveMatrix) {
171 savedMatrix = mCanvas->getTotalMatrix();
172 }
173
Stan Ilievf50806a2016-10-24 10:40:39 -0400174 const size_t clipIndex = rec->clipIndex;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400175
176 mCanvas->restore();
Stan Ilievf50806a2016-10-24 10:40:39 -0400177 mSaveStack->pop_back();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400178
179 if (preserveMatrix) {
180 mCanvas->setMatrix(savedMatrix);
181 }
182
Stan Ilievf50806a2016-10-24 10:40:39 -0400183 if (preserveClip) {
184 this->applyPersistentClips(clipIndex);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400185 }
Derek Sollenberger8872b382014-06-23 14:13:53 -0400186}
187
188void SkiaCanvas::restoreToCount(int restoreCount) {
189 while (mCanvas->getSaveCount() > restoreCount) {
190 this->restore();
191 }
192}
193
Florin Malitaeecff562015-12-21 10:43:01 -0500194static inline SkCanvas::SaveLayerFlags layerFlags(SaveFlags::Flags flags) {
195 SkCanvas::SaveLayerFlags layerFlags = 0;
196
Yuqian Li83427ff2016-09-14 11:14:06 -0400197 // We intentionally ignore the SaveFlags::HasAlphaLayer and
198 // SkCanvas::kIsOpaque_SaveLayerFlag flags because HWUI ignores it
199 // and our Android client may use it incorrectly.
200 // In Skia, this flag is purely for performance optimization.
Florin Malitaeecff562015-12-21 10:43:01 -0500201
202 if (!(flags & SaveFlags::ClipToLayer)) {
203 layerFlags |= SkCanvas::kDontClipToLayer_Legacy_SaveLayerFlag;
204 }
205
206 return layerFlags;
207}
208
Derek Sollenberger8872b382014-06-23 14:13:53 -0400209int SkiaCanvas::saveLayer(float left, float top, float right, float bottom,
Florin Malitaeecff562015-12-21 10:43:01 -0500210 const SkPaint* paint, SaveFlags::Flags flags) {
211 const SkRect bounds = SkRect::MakeLTRB(left, top, right, bottom);
Derek Sollenbergerb8201192017-01-09 16:11:59 -0500212 const SkCanvas::SaveLayerRec rec(&bounds, paint, layerFlags(flags));
Florin Malitaeecff562015-12-21 10:43:01 -0500213
Stan Iliev68885e32016-12-14 11:18:34 -0500214 return mCanvas->saveLayer(rec);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400215}
216
217int SkiaCanvas::saveLayerAlpha(float left, float top, float right, float bottom,
Florin Malitaeecff562015-12-21 10:43:01 -0500218 int alpha, SaveFlags::Flags flags) {
Florin Malitaeecff562015-12-21 10:43:01 -0500219 if (static_cast<unsigned>(alpha) < 0xFF) {
Yuqian Lifd92ee42016-04-27 17:03:38 -0400220 SkPaint alphaPaint;
221 alphaPaint.setAlpha(alpha);
222 return this->saveLayer(left, top, right, bottom, &alphaPaint, flags);
Florin Malitaeecff562015-12-21 10:43:01 -0500223 }
Yuqian Lifd92ee42016-04-27 17:03:38 -0400224 return this->saveLayer(left, top, right, bottom, nullptr, flags);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400225}
226
Stan Ilievf50806a2016-10-24 10:40:39 -0400227class SkiaCanvas::Clip {
228public:
Mike Reed6e49c9f2016-12-02 15:36:59 -0500229 Clip(const SkRect& rect, SkClipOp op, const SkMatrix& m)
Stan Ilievf50806a2016-10-24 10:40:39 -0400230 : mType(Type::Rect), mOp(op), mMatrix(m), mRRect(SkRRect::MakeRect(rect)) {}
Mike Reed6e49c9f2016-12-02 15:36:59 -0500231 Clip(const SkRRect& rrect, SkClipOp op, const SkMatrix& m)
Stan Ilievf50806a2016-10-24 10:40:39 -0400232 : mType(Type::RRect), mOp(op), mMatrix(m), mRRect(rrect) {}
Mike Reed6e49c9f2016-12-02 15:36:59 -0500233 Clip(const SkPath& path, SkClipOp op, const SkMatrix& m)
Stan Ilievf50806a2016-10-24 10:40:39 -0400234 : mType(Type::Path), mOp(op), mMatrix(m), mPath(&path) {}
235
236 void apply(SkCanvas* canvas) const {
237 canvas->setMatrix(mMatrix);
238 switch (mType) {
239 case Type::Rect:
240 canvas->clipRect(mRRect.rect(), mOp);
241 break;
242 case Type::RRect:
243 canvas->clipRRect(mRRect, mOp);
244 break;
245 case Type::Path:
246 canvas->clipPath(*mPath.get(), mOp);
247 break;
248 }
249 }
250
251private:
252 enum class Type {
253 Rect,
254 RRect,
255 Path,
256 };
257
Mike Reed6e49c9f2016-12-02 15:36:59 -0500258 Type mType;
259 SkClipOp mOp;
260 SkMatrix mMatrix;
Stan Ilievf50806a2016-10-24 10:40:39 -0400261
262 // These are logically a union (tracked separately due to non-POD path).
263 SkTLazy<SkPath> mPath;
264 SkRRect mRRect;
265};
266
267const SkiaCanvas::SaveRec* SkiaCanvas::currentSaveRec() const {
268 const SaveRec* rec = mSaveStack
269 ? static_cast<const SaveRec*>(mSaveStack->back())
270 : nullptr;
271 int currentSaveCount = mCanvas->getSaveCount();
272 SkASSERT(!rec || currentSaveCount >= rec->saveCount);
273
274 return (rec && rec->saveCount == currentSaveCount) ? rec : nullptr;
275}
276
Derek Sollenberger8872b382014-06-23 14:13:53 -0400277// ----------------------------------------------------------------------------
278// functions to emulate legacy SaveFlags (i.e. independent matrix/clip flags)
279// ----------------------------------------------------------------------------
280
Florin Malitaeecff562015-12-21 10:43:01 -0500281void SkiaCanvas::recordPartialSave(SaveFlags::Flags flags) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400282 // A partial save is a save operation which doesn't capture the full canvas state.
Florin Malitaeecff562015-12-21 10:43:01 -0500283 // (either SaveFlags::Matrix or SaveFlags::Clip is missing).
Derek Sollenberger8872b382014-06-23 14:13:53 -0400284
285 // Mask-out non canvas state bits.
Florin Malitaeecff562015-12-21 10:43:01 -0500286 flags &= SaveFlags::MatrixClip;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400287
Florin Malitaeecff562015-12-21 10:43:01 -0500288 if (flags == SaveFlags::MatrixClip) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400289 // not a partial save.
290 return;
291 }
292
Stan Ilievf50806a2016-10-24 10:40:39 -0400293 if (!mSaveStack) {
Ben Wagnerd1cbc162015-08-19 12:45:09 -0400294 mSaveStack.reset(new SkDeque(sizeof(struct SaveRec), 8));
Derek Sollenberger8872b382014-06-23 14:13:53 -0400295 }
296
297 SaveRec* rec = static_cast<SaveRec*>(mSaveStack->push_back());
Florin Malita5e271402015-11-04 14:36:02 -0500298 rec->saveCount = mCanvas->getSaveCount();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400299 rec->saveFlags = flags;
Stan Ilievf50806a2016-10-24 10:40:39 -0400300 rec->clipIndex = mClipStack.size();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400301}
302
Stan Ilievf50806a2016-10-24 10:40:39 -0400303template <typename T>
Mike Reed6e49c9f2016-12-02 15:36:59 -0500304void SkiaCanvas::recordClip(const T& clip, SkClipOp op) {
Stan Ilievf50806a2016-10-24 10:40:39 -0400305 // Only need tracking when in a partial save frame which
306 // doesn't restore the clip.
307 const SaveRec* rec = this->currentSaveRec();
308 if (rec && !(rec->saveFlags & SaveFlags::Clip)) {
309 mClipStack.emplace_back(clip, op, mCanvas->getTotalMatrix());
Derek Sollenberger8872b382014-06-23 14:13:53 -0400310 }
311}
312
Stan Ilievf50806a2016-10-24 10:40:39 -0400313// Applies and optionally removes all clips >= index.
314void SkiaCanvas::applyPersistentClips(size_t clipStartIndex) {
315 SkASSERT(clipStartIndex <= mClipStack.size());
316 const auto begin = mClipStack.cbegin() + clipStartIndex;
317 const auto end = mClipStack.cend();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400318
Stan Ilievf50806a2016-10-24 10:40:39 -0400319 // Clip application mutates the CTM.
320 const SkMatrix saveMatrix = mCanvas->getTotalMatrix();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400321
Stan Ilievf50806a2016-10-24 10:40:39 -0400322 for (auto clip = begin; clip != end; ++clip) {
Mike Reed6acfe162016-11-18 17:21:09 -0500323 clip->apply(mCanvas);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400324 }
325
Stan Ilievf50806a2016-10-24 10:40:39 -0400326 mCanvas->setMatrix(saveMatrix);
327
328 // If the current/post-restore save rec is also persisting clips, we
329 // leave them on the stack to be reapplied part of the next restore().
330 // Otherwise we're done and just pop them.
331 const auto* rec = this->currentSaveRec();
332 if (!rec || (rec->saveFlags & SaveFlags::Clip)) {
333 mClipStack.erase(begin, end);
334 }
Derek Sollenberger8872b382014-06-23 14:13:53 -0400335}
336
337// ----------------------------------------------------------------------------
338// Canvas state operations: Matrix
339// ----------------------------------------------------------------------------
340
341void SkiaCanvas::getMatrix(SkMatrix* outMatrix) const {
342 *outMatrix = mCanvas->getTotalMatrix();
343}
344
345void SkiaCanvas::setMatrix(const SkMatrix& matrix) {
346 mCanvas->setMatrix(matrix);
347}
348
349void SkiaCanvas::concat(const SkMatrix& matrix) {
350 mCanvas->concat(matrix);
351}
352
353void SkiaCanvas::rotate(float degrees) {
354 mCanvas->rotate(degrees);
355}
356
357void SkiaCanvas::scale(float sx, float sy) {
358 mCanvas->scale(sx, sy);
359}
360
361void SkiaCanvas::skew(float sx, float sy) {
362 mCanvas->skew(sx, sy);
363}
364
365void SkiaCanvas::translate(float dx, float dy) {
366 mCanvas->translate(dx, dy);
367}
368
369// ----------------------------------------------------------------------------
370// Canvas state operations: Clips
371// ----------------------------------------------------------------------------
372
373// This function is a mirror of SkCanvas::getClipBounds except that it does
374// not outset the edge of the clip to account for anti-aliasing. There is
375// a skia bug to investigate pushing this logic into back into skia.
376// (see https://code.google.com/p/skia/issues/detail?id=1303)
377bool SkiaCanvas::getClipBounds(SkRect* outRect) const {
378 SkIRect ibounds;
Mike Reed5e438982017-01-25 08:23:25 -0500379 if (!mCanvas->getDeviceClipBounds(&ibounds)) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400380 return false;
381 }
382
383 SkMatrix inverse;
384 // if we can't invert the CTM, we can't return local clip bounds
385 if (!mCanvas->getTotalMatrix().invert(&inverse)) {
386 if (outRect) {
387 outRect->setEmpty();
388 }
389 return false;
390 }
391
392 if (NULL != outRect) {
393 SkRect r = SkRect::Make(ibounds);
394 inverse.mapRect(outRect, r);
395 }
396 return true;
397}
398
399bool SkiaCanvas::quickRejectRect(float left, float top, float right, float bottom) const {
400 SkRect bounds = SkRect::MakeLTRB(left, top, right, bottom);
401 return mCanvas->quickReject(bounds);
402}
403
404bool SkiaCanvas::quickRejectPath(const SkPath& path) const {
405 return mCanvas->quickReject(path);
406}
407
Mike Reed6e49c9f2016-12-02 15:36:59 -0500408bool SkiaCanvas::clipRect(float left, float top, float right, float bottom, SkClipOp op) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400409 SkRect rect = SkRect::MakeLTRB(left, top, right, bottom);
Stan Ilievf50806a2016-10-24 10:40:39 -0400410 this->recordClip(rect, op);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400411 mCanvas->clipRect(rect, op);
Chris Craik5ec6a282015-06-23 15:42:12 -0700412 return !mCanvas->isClipEmpty();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400413}
414
Mike Reed6e49c9f2016-12-02 15:36:59 -0500415bool SkiaCanvas::clipPath(const SkPath* path, SkClipOp op) {
Derek Sollenbergerc1908132016-07-15 10:28:16 -0400416 SkRRect roundRect;
417 if (path->isRRect(&roundRect)) {
Stan Ilievf50806a2016-10-24 10:40:39 -0400418 this->recordClip(roundRect, op);
Derek Sollenbergerc1908132016-07-15 10:28:16 -0400419 mCanvas->clipRRect(roundRect, op);
420 } else {
Stan Ilievf50806a2016-10-24 10:40:39 -0400421 this->recordClip(*path, op);
Derek Sollenbergerc1908132016-07-15 10:28:16 -0400422 mCanvas->clipPath(*path, op);
423 }
Chris Craik5ec6a282015-06-23 15:42:12 -0700424 return !mCanvas->isClipEmpty();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400425}
426
Derek Sollenberger8872b382014-06-23 14:13:53 -0400427// ----------------------------------------------------------------------------
428// Canvas state operations: Filters
429// ----------------------------------------------------------------------------
430
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400431SkDrawFilter* SkiaCanvas::getDrawFilter() {
432 return mCanvas->getDrawFilter();
433}
434
Derek Sollenberger8872b382014-06-23 14:13:53 -0400435void SkiaCanvas::setDrawFilter(SkDrawFilter* drawFilter) {
436 mCanvas->setDrawFilter(drawFilter);
437}
438
439// ----------------------------------------------------------------------------
440// Canvas draw operations
441// ----------------------------------------------------------------------------
442
Mike Reed260ab722016-10-07 15:59:20 -0400443void SkiaCanvas::drawColor(int color, SkBlendMode mode) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400444 mCanvas->drawColor(color, mode);
445}
446
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400447void SkiaCanvas::drawPaint(const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400448 mCanvas->drawPaint(paint);
449}
450
451// ----------------------------------------------------------------------------
452// Canvas draw operations: Geometry
453// ----------------------------------------------------------------------------
454
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400455void SkiaCanvas::drawPoints(const float* points, int count, const SkPaint& paint,
Derek Sollenberger8872b382014-06-23 14:13:53 -0400456 SkCanvas::PointMode mode) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500457 if (CC_UNLIKELY(count < 2 || paint.nothingToDraw())) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400458 // convert the floats into SkPoints
459 count >>= 1; // now it is the number of points
Ben Wagner6bbf68d2015-08-19 11:26:06 -0400460 std::unique_ptr<SkPoint[]> pts(new SkPoint[count]);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400461 for (int i = 0; i < count; i++) {
462 pts[i].set(points[0], points[1]);
463 points += 2;
464 }
Ben Wagner6bbf68d2015-08-19 11:26:06 -0400465 mCanvas->drawPoints(mode, count, pts.get(), paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400466}
467
468
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400469void SkiaCanvas::drawPoint(float x, float y, const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400470 mCanvas->drawPoint(x, y, paint);
471}
472
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400473void SkiaCanvas::drawPoints(const float* points, int count, const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400474 this->drawPoints(points, count, paint, SkCanvas::kPoints_PointMode);
475}
476
477void SkiaCanvas::drawLine(float startX, float startY, float stopX, float stopY,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400478 const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400479 mCanvas->drawLine(startX, startY, stopX, stopY, paint);
480}
481
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400482void SkiaCanvas::drawLines(const float* points, int count, const SkPaint& paint) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500483 if (CC_UNLIKELY(count < 4 || paint.nothingToDraw())) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400484 this->drawPoints(points, count, paint, SkCanvas::kLines_PointMode);
485}
486
487void SkiaCanvas::drawRect(float left, float top, float right, float bottom,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400488 const SkPaint& paint) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500489 if (CC_UNLIKELY(paint.nothingToDraw())) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400490 mCanvas->drawRectCoords(left, top, right, bottom, paint);
491
492}
493
Derek Sollenberger94394b32015-07-10 09:58:41 -0400494void SkiaCanvas::drawRegion(const SkRegion& region, const SkPaint& paint) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500495 if (CC_UNLIKELY(paint.nothingToDraw())) return;
Stan Ilievf50806a2016-10-24 10:40:39 -0400496 mCanvas->drawRegion(region, paint);
Derek Sollenberger94394b32015-07-10 09:58:41 -0400497}
498
Derek Sollenberger8872b382014-06-23 14:13:53 -0400499void SkiaCanvas::drawRoundRect(float left, float top, float right, float bottom,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400500 float rx, float ry, const SkPaint& paint) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500501 if (CC_UNLIKELY(paint.nothingToDraw())) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400502 SkRect rect = SkRect::MakeLTRB(left, top, right, bottom);
503 mCanvas->drawRoundRect(rect, rx, ry, paint);
504}
505
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400506void SkiaCanvas::drawCircle(float x, float y, float radius, const SkPaint& paint) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500507 if (CC_UNLIKELY(radius <= 0 || paint.nothingToDraw())) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400508 mCanvas->drawCircle(x, y, radius, paint);
509}
510
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400511void SkiaCanvas::drawOval(float left, float top, float right, float bottom, const SkPaint& paint) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500512 if (CC_UNLIKELY(paint.nothingToDraw())) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400513 SkRect oval = SkRect::MakeLTRB(left, top, right, bottom);
514 mCanvas->drawOval(oval, paint);
515}
516
517void SkiaCanvas::drawArc(float left, float top, float right, float bottom,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400518 float startAngle, float sweepAngle, bool useCenter, const SkPaint& paint) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500519 if (CC_UNLIKELY(paint.nothingToDraw())) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400520 SkRect arc = SkRect::MakeLTRB(left, top, right, bottom);
521 mCanvas->drawArc(arc, startAngle, sweepAngle, useCenter, paint);
522}
523
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400524void SkiaCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500525 if (CC_UNLIKELY(paint.nothingToDraw())) return;
Derek Sollenbergerd7f13f82017-03-09 13:08:27 -0500526 mCanvas->drawPath(path, paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400527}
528
529void SkiaCanvas::drawVertices(SkCanvas::VertexMode vertexMode, int vertexCount,
530 const float* verts, const float* texs, const int* colors,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400531 const uint16_t* indices, int indexCount, const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400532#ifndef SK_SCALAR_IS_FLOAT
533 SkDEBUGFAIL("SkScalar must be a float for these conversions to be valid");
534#endif
535 const int ptCount = vertexCount >> 1;
Mike Reed871cd2d2017-03-17 10:15:52 -0400536 mCanvas->drawVertices(SkVertices::MakeCopy(vertexMode, ptCount, (SkPoint*)verts,
537 (SkPoint*)texs, (SkColor*)colors,
538 indexCount, indices),
539 SkBlendMode::kModulate, paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400540}
541
542// ----------------------------------------------------------------------------
543// Canvas draw operations: Bitmaps
544// ----------------------------------------------------------------------------
545
sergeyvaed7f582016-10-14 16:30:21 -0700546void SkiaCanvas::drawBitmap(Bitmap& bitmap, float left, float top, const SkPaint* paint) {
547 SkBitmap skBitmap;
548 bitmap.getSkBitmap(&skBitmap);
549 mCanvas->drawBitmap(skBitmap, left, top, paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400550}
551
sergeyvfc9999502016-10-17 13:07:38 -0700552void SkiaCanvas::drawBitmap(Bitmap& hwuiBitmap, const SkMatrix& matrix, const SkPaint* paint) {
553 SkBitmap bitmap;
554 hwuiBitmap.getSkBitmap(&bitmap);
Mike Reed6acfe162016-11-18 17:21:09 -0500555 SkAutoCanvasRestore acr(mCanvas, true);
Mike Reed70ffbf92014-12-08 17:03:30 -0500556 mCanvas->concat(matrix);
557 mCanvas->drawBitmap(bitmap, 0, 0, paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400558}
559
sergeyvfc9999502016-10-17 13:07:38 -0700560void SkiaCanvas::drawBitmap(Bitmap& hwuiBitmap, float srcLeft, float srcTop,
Derek Sollenberger8872b382014-06-23 14:13:53 -0400561 float srcRight, float srcBottom, float dstLeft, float dstTop,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400562 float dstRight, float dstBottom, const SkPaint* paint) {
sergeyvfc9999502016-10-17 13:07:38 -0700563 SkBitmap bitmap;
564 hwuiBitmap.getSkBitmap(&bitmap);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400565 SkRect srcRect = SkRect::MakeLTRB(srcLeft, srcTop, srcRight, srcBottom);
566 SkRect dstRect = SkRect::MakeLTRB(dstLeft, dstTop, dstRight, dstBottom);
Leon Scroggins IIIf35b9892015-07-31 10:38:40 -0400567 mCanvas->drawBitmapRect(bitmap, srcRect, dstRect, paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400568}
569
sergeyv5fd2a1c2016-10-20 15:04:28 -0700570void SkiaCanvas::drawBitmapMesh(Bitmap& hwuiBitmap, int meshWidth, int meshHeight,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400571 const float* vertices, const int* colors, const SkPaint* paint) {
sergeyv5fd2a1c2016-10-20 15:04:28 -0700572 SkBitmap bitmap;
573 hwuiBitmap.getSkBitmap(&bitmap);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400574 const int ptCount = (meshWidth + 1) * (meshHeight + 1);
575 const int indexCount = meshWidth * meshHeight * 6;
Mike Reed871cd2d2017-03-17 10:15:52 -0400576 uint32_t flags = SkVertices::kHasTexCoords_BuilderFlag;
577 if (colors) {
578 flags |= SkVertices::kHasColors_BuilderFlag;
579 }
580 SkVertices::Builder builder(SkCanvas::kTriangles_VertexMode, ptCount, indexCount, flags);
581 memcpy(builder.positions(), vertices, ptCount * sizeof(SkPoint));
582 if (colors) {
583 memcpy(builder.colors(), colors, ptCount * sizeof(SkColor));
584 }
585 SkPoint* texs = builder.texCoords();
586 uint16_t* indices = builder.indices();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400587
588 // cons up texture coordinates and indices
589 {
590 const SkScalar w = SkIntToScalar(bitmap.width());
591 const SkScalar h = SkIntToScalar(bitmap.height());
592 const SkScalar dx = w / meshWidth;
593 const SkScalar dy = h / meshHeight;
594
595 SkPoint* texsPtr = texs;
596 SkScalar y = 0;
597 for (int i = 0; i <= meshHeight; i++) {
598 if (i == meshHeight) {
599 y = h; // to ensure numerically we hit h exactly
600 }
601 SkScalar x = 0;
602 for (int j = 0; j < meshWidth; j++) {
603 texsPtr->set(x, y);
604 texsPtr += 1;
605 x += dx;
606 }
607 texsPtr->set(w, y);
608 texsPtr += 1;
609 y += dy;
610 }
611 SkASSERT(texsPtr - texs == ptCount);
612 }
613
614 // cons up indices
615 {
616 uint16_t* indexPtr = indices;
617 int index = 0;
618 for (int i = 0; i < meshHeight; i++) {
619 for (int j = 0; j < meshWidth; j++) {
620 // lower-left triangle
621 *indexPtr++ = index;
622 *indexPtr++ = index + meshWidth + 1;
623 *indexPtr++ = index + meshWidth + 2;
624 // upper-right triangle
625 *indexPtr++ = index;
626 *indexPtr++ = index + meshWidth + 2;
627 *indexPtr++ = index + 1;
628 // bump to the next cell
629 index += 1;
630 }
631 // bump to the next row
632 index += 1;
633 }
634 SkASSERT(indexPtr - indices == indexCount);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400635 }
636
637 // double-check that we have legal indices
638#ifdef SK_DEBUG
639 {
640 for (int i = 0; i < indexCount; i++) {
641 SkASSERT((unsigned)indices[i] < (unsigned)ptCount);
642 }
643 }
644#endif
645
646 // cons-up a shader for the bitmap
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400647 SkPaint tmpPaint;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400648 if (paint) {
649 tmpPaint = *paint;
650 }
Stan Ilievf50806a2016-10-24 10:40:39 -0400651
652 sk_sp<SkImage> image = SkMakeImageFromRasterBitmap(bitmap, kNever_SkCopyPixelsMode);
653 tmpPaint.setShader(image->makeShader(SkShader::kClamp_TileMode, SkShader::kClamp_TileMode));
Derek Sollenberger8872b382014-06-23 14:13:53 -0400654
Mike Reed871cd2d2017-03-17 10:15:52 -0400655 mCanvas->drawVertices(builder.detach(), SkBlendMode::kModulate, tmpPaint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400656}
657
sergeyv5fd2a1c2016-10-20 15:04:28 -0700658void SkiaCanvas::drawNinePatch(Bitmap& hwuiBitmap, const Res_png_9patch& chunk,
Derek Sollenbergeredca3202015-07-10 13:56:39 -0400659 float dstLeft, float dstTop, float dstRight, float dstBottom, const SkPaint* paint) {
Stan Ilievf50806a2016-10-24 10:40:39 -0400660
sergeyv5fd2a1c2016-10-20 15:04:28 -0700661 SkBitmap bitmap;
662 hwuiBitmap.getSkBitmap(&bitmap);
Stan Ilievf50806a2016-10-24 10:40:39 -0400663
664 SkCanvas::Lattice lattice;
Matt Sarett7de73852016-10-25 18:36:39 -0400665 NinePatchUtils::SetLatticeDivs(&lattice, chunk, bitmap.width(), bitmap.height());
Stan Ilievf50806a2016-10-24 10:40:39 -0400666
667 lattice.fFlags = nullptr;
668 int numFlags = 0;
Stan Iliev021693b2016-10-17 16:26:15 -0400669 if (chunk.numColors > 0 && chunk.numColors == NinePatchUtils::NumDistinctRects(lattice)) {
Stan Ilievf50806a2016-10-24 10:40:39 -0400670 // We can expect the framework to give us a color for every distinct rect.
671 // Skia requires a flag for every rect.
672 numFlags = (lattice.fXCount + 1) * (lattice.fYCount + 1);
673 }
674
675 SkAutoSTMalloc<25, SkCanvas::Lattice::Flags> flags(numFlags);
676 if (numFlags > 0) {
Stan Iliev021693b2016-10-17 16:26:15 -0400677 NinePatchUtils::SetLatticeFlags(&lattice, flags.get(), numFlags, chunk);
Stan Ilievf50806a2016-10-24 10:40:39 -0400678 }
679
680 lattice.fBounds = nullptr;
681 SkRect dst = SkRect::MakeLTRB(dstLeft, dstTop, dstRight, dstBottom);
682 mCanvas->drawBitmapLattice(bitmap, lattice, dst, paint);
Derek Sollenbergeredca3202015-07-10 13:56:39 -0400683}
684
Doris Liu766431a2016-02-04 22:17:11 +0000685void SkiaCanvas::drawVectorDrawable(VectorDrawableRoot* vectorDrawable) {
Doris Liu1d8e1942016-03-02 15:16:28 -0800686 vectorDrawable->drawStaging(this);
Doris Liu766431a2016-02-04 22:17:11 +0000687}
688
Derek Sollenberger8872b382014-06-23 14:13:53 -0400689// ----------------------------------------------------------------------------
690// Canvas draw operations: Text
691// ----------------------------------------------------------------------------
692
sergeyvdccca442016-03-21 15:38:21 -0700693void SkiaCanvas::drawGlyphs(const uint16_t* text, const float* positions, int count,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400694 const SkPaint& paint, float x, float y,
Tom Hudson8dfaa492014-12-09 15:03:44 -0500695 float boundsLeft, float boundsTop, float boundsRight, float boundsBottom,
696 float totalAdvance) {
Derek Sollenberger792fb322017-03-03 14:02:09 -0500697 if (!text || !positions || count <= 0 || paint.nothingToDraw()) return;
Stan Ilievf50806a2016-10-24 10:40:39 -0400698 // Set align to left for drawing, as we don't want individual
699 // glyphs centered or right-aligned; the offset above takes
700 // care of all alignment.
701 SkPaint paintCopy(paint);
702 paintCopy.setTextAlign(SkPaint::kLeft_Align);
703
704 SkRect bounds = SkRect::MakeLTRB(boundsLeft + x, boundsTop + y,
705 boundsRight + x, boundsBottom + y);
706
707 SkTextBlobBuilder builder;
708 const SkTextBlobBuilder::RunBuffer& buffer = builder.allocRunPos(paintCopy, count, &bounds);
709 // TODO: we could reduce the number of memcpy's if the this were exposed further up
710 // in the architecture.
711 memcpy(buffer.glyphs, text, count * sizeof(uint16_t));
712 memcpy(buffer.pos, positions, (count << 1) * sizeof(float));
713
714 sk_sp<SkTextBlob> textBlob(builder.make());
715 mCanvas->drawTextBlob(textBlob, 0, 0, paintCopy);
716 drawTextDecorations(x, y, totalAdvance, paintCopy);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400717}
718
Yuqian Liafc221492016-07-18 13:07:42 -0400719void SkiaCanvas::drawLayoutOnPath(const minikin::Layout& layout, float hOffset, float vOffset,
720 const SkPaint& paint, const SkPath& path, size_t start, size_t end) {
721 const int N = end - start;
Derek Sollenbergere547dd02016-11-09 11:55:59 -0500722 SkAutoSTMalloc<1024, uint8_t> storage(N * (sizeof(uint16_t) + sizeof(SkRSXform)));
Yuqian Liafc221492016-07-18 13:07:42 -0400723 SkRSXform* xform = (SkRSXform*)storage.get();
724 uint16_t* glyphs = (uint16_t*)(xform + N);
725 SkPathMeasure meas(path, false);
726
727 for (size_t i = start; i < end; i++) {
728 glyphs[i - start] = layout.getGlyphId(i);
729 float x = hOffset + layout.getX(i);
730 float y = vOffset + layout.getY(i);
731
732 SkPoint pos;
733 SkVector tan;
734 if (!meas.getPosTan(x, &pos, &tan)) {
735 pos.set(x, y);
736 tan.set(1, 0);
737 }
738 xform[i - start].fSCos = tan.x();
739 xform[i - start].fSSin = tan.y();
740 xform[i - start].fTx = pos.x() - tan.y() * y;
741 xform[i - start].fTy = pos.y() + tan.x() * y;
742 }
743
744 this->asSkCanvas()->drawTextRSXform(glyphs, sizeof(uint16_t) * N, xform, nullptr, paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400745}
746
Derek Sollenberger6f485562015-07-30 10:00:39 -0400747// ----------------------------------------------------------------------------
748// Canvas draw operations: Animations
749// ----------------------------------------------------------------------------
750
Derek Sollenberger6f485562015-07-30 10:00:39 -0400751void SkiaCanvas::drawRoundRect(uirenderer::CanvasPropertyPrimitive* left,
752 uirenderer::CanvasPropertyPrimitive* top, uirenderer::CanvasPropertyPrimitive* right,
753 uirenderer::CanvasPropertyPrimitive* bottom, uirenderer::CanvasPropertyPrimitive* rx,
754 uirenderer::CanvasPropertyPrimitive* ry, uirenderer::CanvasPropertyPaint* paint) {
Stan Iliev021693b2016-10-17 16:26:15 -0400755 sk_sp<uirenderer::skiapipeline::AnimatedRoundRect> drawable(
756 new uirenderer::skiapipeline::AnimatedRoundRect(left, top, right, bottom, rx, ry, paint));
Derek Sollenberger6f485562015-07-30 10:00:39 -0400757 mCanvas->drawDrawable(drawable.get());
758}
759
760void SkiaCanvas::drawCircle(uirenderer::CanvasPropertyPrimitive* x, uirenderer::CanvasPropertyPrimitive* y,
761 uirenderer::CanvasPropertyPrimitive* radius, uirenderer::CanvasPropertyPaint* paint) {
Stan Iliev021693b2016-10-17 16:26:15 -0400762 sk_sp<uirenderer::skiapipeline::AnimatedCircle> drawable(new uirenderer::skiapipeline::AnimatedCircle(x, y, radius, paint));
Derek Sollenberger6f485562015-07-30 10:00:39 -0400763 mCanvas->drawDrawable(drawable.get());
764}
765
766// ----------------------------------------------------------------------------
767// Canvas draw operations: View System
768// ----------------------------------------------------------------------------
769
Stan Ilievf50806a2016-10-24 10:40:39 -0400770void SkiaCanvas::drawLayer(uirenderer::DeferredLayerUpdater* layerUpdater) {
Derek Sollenbergerc1908132016-07-15 10:28:16 -0400771 LOG_ALWAYS_FATAL("SkiaCanvas can't directly draw Layers");
772}
Derek Sollenberger6f485562015-07-30 10:00:39 -0400773
Derek Sollenbergerc1908132016-07-15 10:28:16 -0400774void SkiaCanvas::drawRenderNode(uirenderer::RenderNode* renderNode) {
775 LOG_ALWAYS_FATAL("SkiaCanvas can't directly draw RenderNodes");
776}
Derek Sollenberger6f485562015-07-30 10:00:39 -0400777
John Reckcd1c3eb2016-04-14 10:38:54 -0700778void SkiaCanvas::callDrawGLFunction(Functor* functor,
Derek Sollenbergerc1908132016-07-15 10:28:16 -0400779 uirenderer::GlFunctorLifecycleListener* listener) {
780 LOG_ALWAYS_FATAL("SkiaCanvas can't directly draw GL Content");
781}
Derek Sollenberger6f485562015-07-30 10:00:39 -0400782
Derek Sollenberger8872b382014-06-23 14:13:53 -0400783} // namespace android