blob: 5d24fa009f0457bd102aad458014860efce7d609 [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 Sollenberger6f485562015-07-30 10:00:39 -040017#include "CanvasProperty.h"
18#include "Layer.h"
19#include "RenderNode.h"
sergeyvdccca442016-03-21 15:38:21 -070020#include "hwui/Canvas.h"
Derek Sollenberger8872b382014-06-23 14:13:53 -040021
John Reck849911a2015-01-20 07:51:14 -080022#include <SkCanvas.h>
23#include <SkClipStack.h>
Derek Sollenberger6f485562015-07-30 10:00:39 -040024#include <SkDrawable.h>
John Reck849911a2015-01-20 07:51:14 -080025#include <SkDevice.h>
26#include <SkDeque.h>
27#include <SkDrawFilter.h>
28#include <SkGraphics.h>
Derek Sollenberger6f485562015-07-30 10:00:39 -040029#include <SkImage.h>
John Reck849911a2015-01-20 07:51:14 -080030#include <SkShader.h>
31#include <SkTArray.h>
Florin Malitaeecff562015-12-21 10:43:01 -050032#include <SkTLazy.h>
John Reck849911a2015-01-20 07:51:14 -080033#include <SkTemplates.h>
Derek Sollenberger8872b382014-06-23 14:13:53 -040034
Doris Liu766431a2016-02-04 22:17:11 +000035#include "VectorDrawable.h"
36
Ben Wagner60126ef2015-08-07 12:13:48 -040037#include <memory>
38
Derek Sollenberger8872b382014-06-23 14:13:53 -040039namespace android {
40
41// Holds an SkCanvas reference plus additional native data.
42class SkiaCanvas : public Canvas {
43public:
John Reckc1b33d62015-04-22 09:04:45 -070044 explicit SkiaCanvas(const SkBitmap& bitmap);
Derek Sollenberger8872b382014-06-23 14:13:53 -040045
Leon Scroggins III18981292014-12-17 11:30:31 -050046 /**
47 * Create a new SkiaCanvas.
48 *
49 * @param canvas SkCanvas to handle calls made to this SkiaCanvas. Must
50 * not be NULL. This constructor will ref() the SkCanvas, and unref()
51 * it in its destructor.
52 */
53 explicit SkiaCanvas(SkCanvas* canvas) : mCanvas(canvas) {
Derek Sollenberger8872b382014-06-23 14:13:53 -040054 SkASSERT(canvas);
Leon Scroggins III18981292014-12-17 11:30:31 -050055 canvas->ref();
Derek Sollenberger8872b382014-06-23 14:13:53 -040056 }
57
Derek Sollenbergerb3d50e02015-01-29 11:19:31 -050058 virtual SkCanvas* asSkCanvas() override {
Derek Sollenberger8872b382014-06-23 14:13:53 -040059 return mCanvas.get();
60 }
61
Derek Sollenberger6f485562015-07-30 10:00:39 -040062 virtual void resetRecording(int width, int height) override {
63 LOG_ALWAYS_FATAL("SkiaCanvas cannot be reset as a recording canvas");
64 }
65
66 virtual uirenderer::DisplayList* finishRecording() override {
67 LOG_ALWAYS_FATAL("SkiaCanvas does not produce a DisplayList");
68 return nullptr;
69 }
70 virtual void insertReorderBarrier(bool enableReorder) override {
71 LOG_ALWAYS_FATAL("SkiaCanvas does not support reordering barriers");
72 }
73
John Reckc1b33d62015-04-22 09:04:45 -070074 virtual void setBitmap(const SkBitmap& bitmap) override;
Derek Sollenberger8872b382014-06-23 14:13:53 -040075
Derek Sollenbergerb3d50e02015-01-29 11:19:31 -050076 virtual bool isOpaque() override;
77 virtual int width() override;
78 virtual int height() override;
Derek Sollenberger8872b382014-06-23 14:13:53 -040079
Derek Sollenberger6578a982015-07-13 13:24:29 -040080 virtual void setHighContrastText(bool highContrastText) override {
81 mHighContrastText = highContrastText;
82 }
83 virtual bool isHighContrastText() override { return mHighContrastText; }
84
Derek Sollenbergerb3d50e02015-01-29 11:19:31 -050085 virtual int getSaveCount() const override;
Florin Malitaeecff562015-12-21 10:43:01 -050086 virtual int save(SaveFlags::Flags flags) override;
Derek Sollenbergerb3d50e02015-01-29 11:19:31 -050087 virtual void restore() override;
88 virtual void restoreToCount(int saveCount) override;
Derek Sollenberger8872b382014-06-23 14:13:53 -040089
90 virtual int saveLayer(float left, float top, float right, float bottom,
Florin Malitaeecff562015-12-21 10:43:01 -050091 const SkPaint* paint, SaveFlags::Flags flags) override;
Derek Sollenberger8872b382014-06-23 14:13:53 -040092 virtual int saveLayerAlpha(float left, float top, float right, float bottom,
Florin Malitaeecff562015-12-21 10:43:01 -050093 int alpha, SaveFlags::Flags flags) override;
Derek Sollenberger8872b382014-06-23 14:13:53 -040094
Derek Sollenbergerb3d50e02015-01-29 11:19:31 -050095 virtual void getMatrix(SkMatrix* outMatrix) const override;
96 virtual void setMatrix(const SkMatrix& matrix) override;
97 virtual void concat(const SkMatrix& matrix) override;
98 virtual void rotate(float degrees) override;
99 virtual void scale(float sx, float sy) override;
100 virtual void skew(float sx, float sy) override;
101 virtual void translate(float dx, float dy) override;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400102
Derek Sollenbergerb3d50e02015-01-29 11:19:31 -0500103 virtual bool getClipBounds(SkRect* outRect) const override;
104 virtual bool quickRejectRect(float left, float top, float right, float bottom) const override;
105 virtual bool quickRejectPath(const SkPath& path) const override;
106 virtual bool clipRect(float left, float top, float right, float bottom,
107 SkRegion::Op op) override;
108 virtual bool clipPath(const SkPath* path, SkRegion::Op op) override;
109 virtual bool clipRegion(const SkRegion* region, SkRegion::Op op) override;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400110
Derek Sollenbergerb3d50e02015-01-29 11:19:31 -0500111 virtual SkDrawFilter* getDrawFilter() override;
112 virtual void setDrawFilter(SkDrawFilter* drawFilter) override;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400113
Derek Sollenbergerb3d50e02015-01-29 11:19:31 -0500114 virtual void drawColor(int color, SkXfermode::Mode mode) override;
115 virtual void drawPaint(const SkPaint& paint) override;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400116
Derek Sollenbergerb3d50e02015-01-29 11:19:31 -0500117 virtual void drawPoint(float x, float y, const SkPaint& paint) override;
118 virtual void drawPoints(const float* points, int count, const SkPaint& paint) override;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400119 virtual void drawLine(float startX, float startY, float stopX, float stopY,
Derek Sollenbergerb3d50e02015-01-29 11:19:31 -0500120 const SkPaint& paint) override;
121 virtual void drawLines(const float* points, int count, const SkPaint& paint) override;
122 virtual void drawRect(float left, float top, float right, float bottom,
123 const SkPaint& paint) override;
Derek Sollenberger94394b32015-07-10 09:58:41 -0400124 virtual void drawRegion(const SkRegion& region, const SkPaint& paint) override;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400125 virtual void drawRoundRect(float left, float top, float right, float bottom,
Derek Sollenbergerb3d50e02015-01-29 11:19:31 -0500126 float rx, float ry, const SkPaint& paint) override;
127 virtual void drawCircle(float x, float y, float radius, const SkPaint& paint) override;
128 virtual void drawOval(float left, float top, float right, float bottom,
129 const SkPaint& paint) override;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400130 virtual void drawArc(float left, float top, float right, float bottom,
Derek Sollenbergerb3d50e02015-01-29 11:19:31 -0500131 float startAngle, float sweepAngle, bool useCenter, const SkPaint& paint) override;
132 virtual void drawPath(const SkPath& path, const SkPaint& paint) override;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400133 virtual void drawVertices(SkCanvas::VertexMode vertexMode, int vertexCount,
134 const float* verts, const float* tex, const int* colors,
Derek Sollenbergerb3d50e02015-01-29 11:19:31 -0500135 const uint16_t* indices, int indexCount, const SkPaint& paint) override;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400136
Derek Sollenbergerb3d50e02015-01-29 11:19:31 -0500137 virtual void drawBitmap(const SkBitmap& bitmap, float left, float top,
138 const SkPaint* paint) override;
139 virtual void drawBitmap(const SkBitmap& bitmap, const SkMatrix& matrix,
140 const SkPaint* paint) override;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400141 virtual void drawBitmap(const SkBitmap& bitmap, float srcLeft, float srcTop,
142 float srcRight, float srcBottom, float dstLeft, float dstTop,
Derek Sollenbergerb3d50e02015-01-29 11:19:31 -0500143 float dstRight, float dstBottom, const SkPaint* paint) override;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400144 virtual void drawBitmapMesh(const SkBitmap& bitmap, int meshWidth, int meshHeight,
Derek Sollenbergerb3d50e02015-01-29 11:19:31 -0500145 const float* vertices, const int* colors, const SkPaint* paint) override;
Derek Sollenbergeredca3202015-07-10 13:56:39 -0400146 virtual void drawNinePatch(const SkBitmap& bitmap, const android::Res_png_9patch& chunk,
147 float dstLeft, float dstTop, float dstRight, float dstBottom,
148 const SkPaint* paint) override;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400149
Derek Sollenbergerb3d50e02015-01-29 11:19:31 -0500150 virtual bool drawTextAbsolutePos() const override { return true; }
Doris Liu766431a2016-02-04 22:17:11 +0000151 virtual void drawVectorDrawable(VectorDrawableRoot* vectorDrawable) override;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400152
Derek Sollenberger6f485562015-07-30 10:00:39 -0400153 virtual void drawRoundRect(uirenderer::CanvasPropertyPrimitive* left,
154 uirenderer::CanvasPropertyPrimitive* top, uirenderer::CanvasPropertyPrimitive* right,
155 uirenderer::CanvasPropertyPrimitive* bottom, uirenderer::CanvasPropertyPrimitive* rx,
156 uirenderer::CanvasPropertyPrimitive* ry, uirenderer::CanvasPropertyPaint* paint) override;
157 virtual void drawCircle(uirenderer::CanvasPropertyPrimitive* x,
158 uirenderer::CanvasPropertyPrimitive* y, uirenderer::CanvasPropertyPrimitive* radius,
159 uirenderer::CanvasPropertyPaint* paint) override;
160
161 virtual void drawLayer(uirenderer::DeferredLayerUpdater* layerHandle) override;
162 virtual void drawRenderNode(uirenderer::RenderNode* renderNode) override;
163 virtual void callDrawGLFunction(Functor* functor) override;
164
Derek Sollenberger79abbf22016-03-24 11:07:19 -0400165protected:
166 virtual void drawGlyphs(const uint16_t* text, const float* positions, int count,
167 const SkPaint& paint, float x, float y,
168 float boundsLeft, float boundsTop, float boundsRight, float boundsBottom,
169 float totalAdvance) override;
170 virtual void drawGlyphsOnPath(const uint16_t* glyphs, int count, const SkPath& path,
171 float hOffset, float vOffset, const SkPaint& paint) override;
172
Derek Sollenberger8872b382014-06-23 14:13:53 -0400173private:
174 struct SaveRec {
Florin Malitaeecff562015-12-21 10:43:01 -0500175 int saveCount;
176 SaveFlags::Flags saveFlags;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400177 };
178
Derek Sollenberger6578a982015-07-13 13:24:29 -0400179 bool mHighContrastText = false;
180
Florin Malitaeecff562015-12-21 10:43:01 -0500181 void recordPartialSave(SaveFlags::Flags flags);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400182 void saveClipsForFrame(SkTArray<SkClipStack::Element>& clips, int frameSaveCount);
183 void applyClips(const SkTArray<SkClipStack::Element>& clips);
184
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400185 void drawPoints(const float* points, int count, const SkPaint& paint,
Derek Sollenberger8872b382014-06-23 14:13:53 -0400186 SkCanvas::PointMode mode);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400187
188 SkAutoTUnref<SkCanvas> mCanvas;
Ben Wagner60126ef2015-08-07 12:13:48 -0400189 std::unique_ptr<SkDeque> mSaveStack; // lazily allocated, tracks partial saves.
Derek Sollenberger8872b382014-06-23 14:13:53 -0400190};
191
John Reckc1b33d62015-04-22 09:04:45 -0700192Canvas* Canvas::create_canvas(const SkBitmap& bitmap) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400193 return new SkiaCanvas(bitmap);
194}
195
196Canvas* Canvas::create_canvas(SkCanvas* skiaCanvas) {
197 return new SkiaCanvas(skiaCanvas);
198}
199
John Reckc1b33d62015-04-22 09:04:45 -0700200SkiaCanvas::SkiaCanvas(const SkBitmap& bitmap) {
201 mCanvas.reset(new SkCanvas(bitmap));
Derek Sollenberger8872b382014-06-23 14:13:53 -0400202}
203
204// ----------------------------------------------------------------------------
205// Canvas state operations: Replace Bitmap
206// ----------------------------------------------------------------------------
207
208class ClipCopier : public SkCanvas::ClipVisitor {
209public:
210 ClipCopier(SkCanvas* dstCanvas) : m_dstCanvas(dstCanvas) {}
211
212 virtual void clipRect(const SkRect& rect, SkRegion::Op op, bool antialias) {
213 m_dstCanvas->clipRect(rect, op, antialias);
214 }
215 virtual void clipRRect(const SkRRect& rrect, SkRegion::Op op, bool antialias) {
216 m_dstCanvas->clipRRect(rrect, op, antialias);
217 }
218 virtual void clipPath(const SkPath& path, SkRegion::Op op, bool antialias) {
219 m_dstCanvas->clipPath(path, op, antialias);
220 }
221
222private:
223 SkCanvas* m_dstCanvas;
224};
225
John Reckc1b33d62015-04-22 09:04:45 -0700226void SkiaCanvas::setBitmap(const SkBitmap& bitmap) {
227 SkCanvas* newCanvas = new SkCanvas(bitmap);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400228
John Reckc1b33d62015-04-22 09:04:45 -0700229 if (!bitmap.isNull()) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400230 // Copy the canvas matrix & clip state.
231 newCanvas->setMatrix(mCanvas->getTotalMatrix());
Leon Scroggins IIIf35b9892015-07-31 10:38:40 -0400232
233 ClipCopier copier(newCanvas);
234 mCanvas->replayClips(&copier);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400235 }
236
237 // unrefs the existing canvas
238 mCanvas.reset(newCanvas);
239
240 // clean up the old save stack
241 mSaveStack.reset(NULL);
242}
243
244// ----------------------------------------------------------------------------
245// Canvas state operations
246// ----------------------------------------------------------------------------
247
248bool SkiaCanvas::isOpaque() {
Leon Scroggins IIIf35b9892015-07-31 10:38:40 -0400249 return mCanvas->imageInfo().isOpaque();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400250}
251
252int SkiaCanvas::width() {
Leon Scroggins IIIf35b9892015-07-31 10:38:40 -0400253 return mCanvas->imageInfo().width();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400254}
255
256int SkiaCanvas::height() {
Leon Scroggins IIIf35b9892015-07-31 10:38:40 -0400257 return mCanvas->imageInfo().height();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400258}
259
260// ----------------------------------------------------------------------------
261// Canvas state operations: Save (layer)
262// ----------------------------------------------------------------------------
263
264int SkiaCanvas::getSaveCount() const {
265 return mCanvas->getSaveCount();
266}
267
Florin Malitaeecff562015-12-21 10:43:01 -0500268int SkiaCanvas::save(SaveFlags::Flags flags) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400269 int count = mCanvas->save();
270 recordPartialSave(flags);
271 return count;
272}
273
Florin Malita5e271402015-11-04 14:36:02 -0500274// The SkiaCanvas::restore operation layers on the capability to preserve
275// either (or both) the matrix and/or clip state after a SkCanvas::restore
276// operation. It does this by explicitly saving off the clip & matrix state
277// when requested and playing it back after the SkCanvas::restore.
Derek Sollenberger8872b382014-06-23 14:13:53 -0400278void SkiaCanvas::restore() {
279 const SaveRec* rec = (NULL == mSaveStack.get())
280 ? NULL
281 : static_cast<SaveRec*>(mSaveStack->back());
Florin Malita5e271402015-11-04 14:36:02 -0500282 int currentSaveCount = mCanvas->getSaveCount();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400283 SkASSERT(NULL == rec || currentSaveCount >= rec->saveCount);
284
285 if (NULL == rec || rec->saveCount != currentSaveCount) {
286 // Fast path - no record for this frame.
287 mCanvas->restore();
288 return;
289 }
290
Florin Malitaeecff562015-12-21 10:43:01 -0500291 bool preserveMatrix = !(rec->saveFlags & SaveFlags::Matrix);
292 bool preserveClip = !(rec->saveFlags & SaveFlags::Clip);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400293
294 SkMatrix savedMatrix;
295 if (preserveMatrix) {
296 savedMatrix = mCanvas->getTotalMatrix();
297 }
298
299 SkTArray<SkClipStack::Element> savedClips;
Florin Malita5e271402015-11-04 14:36:02 -0500300 int topClipStackFrame = mCanvas->getClipStack()->getSaveCount();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400301 if (preserveClip) {
Florin Malita5e271402015-11-04 14:36:02 -0500302 saveClipsForFrame(savedClips, topClipStackFrame);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400303 }
304
305 mCanvas->restore();
306
307 if (preserveMatrix) {
308 mCanvas->setMatrix(savedMatrix);
309 }
310
Florin Malita5e271402015-11-04 14:36:02 -0500311 if (preserveClip && !savedClips.empty() &&
312 topClipStackFrame != mCanvas->getClipStack()->getSaveCount()) {
313 // Only reapply the saved clips if the top clip stack frame was actually
314 // popped by restore(). If it wasn't, it means it doesn't belong to the
315 // restored canvas frame (SkCanvas lazy save/restore kicked in).
Derek Sollenberger8872b382014-06-23 14:13:53 -0400316 applyClips(savedClips);
317 }
318
319 mSaveStack->pop_back();
320}
321
322void SkiaCanvas::restoreToCount(int restoreCount) {
323 while (mCanvas->getSaveCount() > restoreCount) {
324 this->restore();
325 }
326}
327
Florin Malitaeecff562015-12-21 10:43:01 -0500328static inline SkCanvas::SaveLayerFlags layerFlags(SaveFlags::Flags flags) {
329 SkCanvas::SaveLayerFlags layerFlags = 0;
330
331 if (!(flags & SaveFlags::HasAlphaLayer)) {
332 layerFlags |= SkCanvas::kIsOpaque_SaveLayerFlag;
333 }
334
335 if (!(flags & SaveFlags::ClipToLayer)) {
336 layerFlags |= SkCanvas::kDontClipToLayer_Legacy_SaveLayerFlag;
337 }
338
339 return layerFlags;
340}
341
Derek Sollenberger8872b382014-06-23 14:13:53 -0400342int SkiaCanvas::saveLayer(float left, float top, float right, float bottom,
Florin Malitaeecff562015-12-21 10:43:01 -0500343 const SkPaint* paint, SaveFlags::Flags flags) {
344 const SkRect bounds = SkRect::MakeLTRB(left, top, right, bottom);
345 const SkCanvas::SaveLayerRec rec(&bounds, paint, layerFlags(flags));
346
347 int count = mCanvas->saveLayer(rec);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400348 recordPartialSave(flags);
349 return count;
350}
351
352int SkiaCanvas::saveLayerAlpha(float left, float top, float right, float bottom,
Florin Malitaeecff562015-12-21 10:43:01 -0500353 int alpha, SaveFlags::Flags flags) {
354 SkTLazy<SkPaint> alphaPaint;
355 if (static_cast<unsigned>(alpha) < 0xFF) {
356 alphaPaint.init()->setAlpha(alpha);
357 }
358
359 return this->saveLayer(left, top, right, bottom, alphaPaint.getMaybeNull(),
360 flags);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400361}
362
363// ----------------------------------------------------------------------------
364// functions to emulate legacy SaveFlags (i.e. independent matrix/clip flags)
365// ----------------------------------------------------------------------------
366
Florin Malitaeecff562015-12-21 10:43:01 -0500367void SkiaCanvas::recordPartialSave(SaveFlags::Flags flags) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400368 // A partial save is a save operation which doesn't capture the full canvas state.
Florin Malitaeecff562015-12-21 10:43:01 -0500369 // (either SaveFlags::Matrix or SaveFlags::Clip is missing).
Derek Sollenberger8872b382014-06-23 14:13:53 -0400370
371 // Mask-out non canvas state bits.
Florin Malitaeecff562015-12-21 10:43:01 -0500372 flags &= SaveFlags::MatrixClip;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400373
Florin Malitaeecff562015-12-21 10:43:01 -0500374 if (flags == SaveFlags::MatrixClip) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400375 // not a partial save.
376 return;
377 }
378
379 if (NULL == mSaveStack.get()) {
Ben Wagnerd1cbc162015-08-19 12:45:09 -0400380 mSaveStack.reset(new SkDeque(sizeof(struct SaveRec), 8));
Derek Sollenberger8872b382014-06-23 14:13:53 -0400381 }
382
383 SaveRec* rec = static_cast<SaveRec*>(mSaveStack->push_back());
Florin Malita5e271402015-11-04 14:36:02 -0500384 rec->saveCount = mCanvas->getSaveCount();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400385 rec->saveFlags = flags;
386}
387
Florin Malita5e271402015-11-04 14:36:02 -0500388void SkiaCanvas::saveClipsForFrame(SkTArray<SkClipStack::Element>& clips,
389 int saveCountToBackup) {
390 // Each SkClipStack::Element stores the index of the canvas save
391 // with which it is associated. Backup only those Elements that
392 // are associated with 'saveCountToBackup'
Derek Sollenberger8872b382014-06-23 14:13:53 -0400393 SkClipStack::Iter clipIterator(*mCanvas->getClipStack(),
394 SkClipStack::Iter::kTop_IterStart);
Florin Malita5e271402015-11-04 14:36:02 -0500395 while (const SkClipStack::Element* elem = clipIterator.prev()) {
396 if (elem->getSaveCount() < saveCountToBackup) {
397 // done with the target save count.
Derek Sollenberger8872b382014-06-23 14:13:53 -0400398 break;
399 }
Florin Malita5e271402015-11-04 14:36:02 -0500400 SkASSERT(elem->getSaveCount() == saveCountToBackup);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400401 clips.push_back(*elem);
402 }
403}
404
405void SkiaCanvas::applyClips(const SkTArray<SkClipStack::Element>& clips) {
406 ClipCopier clipCopier(mCanvas);
407
408 // The clip stack stores clips in device space.
409 SkMatrix origMatrix = mCanvas->getTotalMatrix();
410 mCanvas->resetMatrix();
411
412 // We pushed the clips in reverse order.
413 for (int i = clips.count() - 1; i >= 0; --i) {
414 clips[i].replay(&clipCopier);
415 }
416
417 mCanvas->setMatrix(origMatrix);
418}
419
420// ----------------------------------------------------------------------------
421// Canvas state operations: Matrix
422// ----------------------------------------------------------------------------
423
424void SkiaCanvas::getMatrix(SkMatrix* outMatrix) const {
425 *outMatrix = mCanvas->getTotalMatrix();
426}
427
428void SkiaCanvas::setMatrix(const SkMatrix& matrix) {
429 mCanvas->setMatrix(matrix);
430}
431
432void SkiaCanvas::concat(const SkMatrix& matrix) {
433 mCanvas->concat(matrix);
434}
435
436void SkiaCanvas::rotate(float degrees) {
437 mCanvas->rotate(degrees);
438}
439
440void SkiaCanvas::scale(float sx, float sy) {
441 mCanvas->scale(sx, sy);
442}
443
444void SkiaCanvas::skew(float sx, float sy) {
445 mCanvas->skew(sx, sy);
446}
447
448void SkiaCanvas::translate(float dx, float dy) {
449 mCanvas->translate(dx, dy);
450}
451
452// ----------------------------------------------------------------------------
453// Canvas state operations: Clips
454// ----------------------------------------------------------------------------
455
456// This function is a mirror of SkCanvas::getClipBounds except that it does
457// not outset the edge of the clip to account for anti-aliasing. There is
458// a skia bug to investigate pushing this logic into back into skia.
459// (see https://code.google.com/p/skia/issues/detail?id=1303)
460bool SkiaCanvas::getClipBounds(SkRect* outRect) const {
461 SkIRect ibounds;
462 if (!mCanvas->getClipDeviceBounds(&ibounds)) {
463 return false;
464 }
465
466 SkMatrix inverse;
467 // if we can't invert the CTM, we can't return local clip bounds
468 if (!mCanvas->getTotalMatrix().invert(&inverse)) {
469 if (outRect) {
470 outRect->setEmpty();
471 }
472 return false;
473 }
474
475 if (NULL != outRect) {
476 SkRect r = SkRect::Make(ibounds);
477 inverse.mapRect(outRect, r);
478 }
479 return true;
480}
481
482bool SkiaCanvas::quickRejectRect(float left, float top, float right, float bottom) const {
483 SkRect bounds = SkRect::MakeLTRB(left, top, right, bottom);
484 return mCanvas->quickReject(bounds);
485}
486
487bool SkiaCanvas::quickRejectPath(const SkPath& path) const {
488 return mCanvas->quickReject(path);
489}
490
491bool SkiaCanvas::clipRect(float left, float top, float right, float bottom, SkRegion::Op op) {
492 SkRect rect = SkRect::MakeLTRB(left, top, right, bottom);
493 mCanvas->clipRect(rect, op);
Chris Craik5ec6a282015-06-23 15:42:12 -0700494 return !mCanvas->isClipEmpty();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400495}
496
497bool SkiaCanvas::clipPath(const SkPath* path, SkRegion::Op op) {
498 mCanvas->clipPath(*path, op);
Chris Craik5ec6a282015-06-23 15:42:12 -0700499 return !mCanvas->isClipEmpty();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400500}
501
502bool SkiaCanvas::clipRegion(const SkRegion* region, SkRegion::Op op) {
503 SkPath rgnPath;
504 if (region->getBoundaryPath(&rgnPath)) {
505 // The region is specified in device space.
506 SkMatrix savedMatrix = mCanvas->getTotalMatrix();
507 mCanvas->resetMatrix();
508 mCanvas->clipPath(rgnPath, op);
509 mCanvas->setMatrix(savedMatrix);
510 } else {
511 mCanvas->clipRect(SkRect::MakeEmpty(), op);
512 }
Chris Craik5ec6a282015-06-23 15:42:12 -0700513 return !mCanvas->isClipEmpty();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400514}
515
516// ----------------------------------------------------------------------------
517// Canvas state operations: Filters
518// ----------------------------------------------------------------------------
519
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400520SkDrawFilter* SkiaCanvas::getDrawFilter() {
521 return mCanvas->getDrawFilter();
522}
523
Derek Sollenberger8872b382014-06-23 14:13:53 -0400524void SkiaCanvas::setDrawFilter(SkDrawFilter* drawFilter) {
525 mCanvas->setDrawFilter(drawFilter);
526}
527
528// ----------------------------------------------------------------------------
529// Canvas draw operations
530// ----------------------------------------------------------------------------
531
532void SkiaCanvas::drawColor(int color, SkXfermode::Mode mode) {
533 mCanvas->drawColor(color, mode);
534}
535
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400536void SkiaCanvas::drawPaint(const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400537 mCanvas->drawPaint(paint);
538}
539
540// ----------------------------------------------------------------------------
541// Canvas draw operations: Geometry
542// ----------------------------------------------------------------------------
543
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400544void SkiaCanvas::drawPoints(const float* points, int count, const SkPaint& paint,
Derek Sollenberger8872b382014-06-23 14:13:53 -0400545 SkCanvas::PointMode mode) {
546 // convert the floats into SkPoints
547 count >>= 1; // now it is the number of points
Ben Wagner6bbf68d2015-08-19 11:26:06 -0400548 std::unique_ptr<SkPoint[]> pts(new SkPoint[count]);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400549 for (int i = 0; i < count; i++) {
550 pts[i].set(points[0], points[1]);
551 points += 2;
552 }
Ben Wagner6bbf68d2015-08-19 11:26:06 -0400553 mCanvas->drawPoints(mode, count, pts.get(), paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400554}
555
556
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400557void SkiaCanvas::drawPoint(float x, float y, const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400558 mCanvas->drawPoint(x, y, paint);
559}
560
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400561void SkiaCanvas::drawPoints(const float* points, int count, const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400562 this->drawPoints(points, count, paint, SkCanvas::kPoints_PointMode);
563}
564
565void SkiaCanvas::drawLine(float startX, float startY, float stopX, float stopY,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400566 const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400567 mCanvas->drawLine(startX, startY, stopX, stopY, paint);
568}
569
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400570void SkiaCanvas::drawLines(const float* points, int count, const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400571 this->drawPoints(points, count, paint, SkCanvas::kLines_PointMode);
572}
573
574void SkiaCanvas::drawRect(float left, float top, float right, float bottom,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400575 const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400576 mCanvas->drawRectCoords(left, top, right, bottom, paint);
577
578}
579
Derek Sollenberger94394b32015-07-10 09:58:41 -0400580void SkiaCanvas::drawRegion(const SkRegion& region, const SkPaint& paint) {
581 SkRegion::Iterator it(region);
582 while (!it.done()) {
583 mCanvas->drawRect(SkRect::Make(it.rect()), paint);
584 it.next();
585 }
586}
587
Derek Sollenberger8872b382014-06-23 14:13:53 -0400588void SkiaCanvas::drawRoundRect(float left, float top, float right, float bottom,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400589 float rx, float ry, const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400590 SkRect rect = SkRect::MakeLTRB(left, top, right, bottom);
591 mCanvas->drawRoundRect(rect, rx, ry, paint);
592}
593
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400594void SkiaCanvas::drawCircle(float x, float y, float radius, const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400595 mCanvas->drawCircle(x, y, radius, paint);
596}
597
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400598void SkiaCanvas::drawOval(float left, float top, float right, float bottom, const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400599 SkRect oval = SkRect::MakeLTRB(left, top, right, bottom);
600 mCanvas->drawOval(oval, paint);
601}
602
603void SkiaCanvas::drawArc(float left, float top, float right, float bottom,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400604 float startAngle, float sweepAngle, bool useCenter, const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400605 SkRect arc = SkRect::MakeLTRB(left, top, right, bottom);
606 mCanvas->drawArc(arc, startAngle, sweepAngle, useCenter, paint);
607}
608
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400609void SkiaCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400610 mCanvas->drawPath(path, paint);
611}
612
613void SkiaCanvas::drawVertices(SkCanvas::VertexMode vertexMode, int vertexCount,
614 const float* verts, const float* texs, const int* colors,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400615 const uint16_t* indices, int indexCount, const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400616#ifndef SK_SCALAR_IS_FLOAT
617 SkDEBUGFAIL("SkScalar must be a float for these conversions to be valid");
618#endif
619 const int ptCount = vertexCount >> 1;
620 mCanvas->drawVertices(vertexMode, ptCount, (SkPoint*)verts, (SkPoint*)texs,
621 (SkColor*)colors, NULL, indices, indexCount, paint);
622}
623
624// ----------------------------------------------------------------------------
625// Canvas draw operations: Bitmaps
626// ----------------------------------------------------------------------------
627
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400628void SkiaCanvas::drawBitmap(const SkBitmap& bitmap, float left, float top, const SkPaint* paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400629 mCanvas->drawBitmap(bitmap, left, top, paint);
630}
631
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400632void SkiaCanvas::drawBitmap(const SkBitmap& bitmap, const SkMatrix& matrix, const SkPaint* paint) {
Mike Reed70ffbf92014-12-08 17:03:30 -0500633 SkAutoCanvasRestore acr(mCanvas, true);
634 mCanvas->concat(matrix);
635 mCanvas->drawBitmap(bitmap, 0, 0, paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400636}
637
638void SkiaCanvas::drawBitmap(const SkBitmap& bitmap, float srcLeft, float srcTop,
639 float srcRight, float srcBottom, float dstLeft, float dstTop,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400640 float dstRight, float dstBottom, const SkPaint* paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400641 SkRect srcRect = SkRect::MakeLTRB(srcLeft, srcTop, srcRight, srcBottom);
642 SkRect dstRect = SkRect::MakeLTRB(dstLeft, dstTop, dstRight, dstBottom);
Leon Scroggins IIIf35b9892015-07-31 10:38:40 -0400643 mCanvas->drawBitmapRect(bitmap, srcRect, dstRect, paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400644}
645
646void SkiaCanvas::drawBitmapMesh(const SkBitmap& bitmap, int meshWidth, int meshHeight,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400647 const float* vertices, const int* colors, const SkPaint* paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400648
649 const int ptCount = (meshWidth + 1) * (meshHeight + 1);
650 const int indexCount = meshWidth * meshHeight * 6;
651
652 /* Our temp storage holds 2 or 3 arrays.
653 texture points [ptCount * sizeof(SkPoint)]
654 optionally vertex points [ptCount * sizeof(SkPoint)] if we need a
655 copy to convert from float to fixed
656 indices [ptCount * sizeof(uint16_t)]
657 */
658 ssize_t storageSize = ptCount * sizeof(SkPoint); // texs[]
659 storageSize += indexCount * sizeof(uint16_t); // indices[]
660
661
662#ifndef SK_SCALAR_IS_FLOAT
663 SkDEBUGFAIL("SkScalar must be a float for these conversions to be valid");
664#endif
Ben Wagner6bbf68d2015-08-19 11:26:06 -0400665 std::unique_ptr<char[]> storage(new char[storageSize]);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400666 SkPoint* texs = (SkPoint*)storage.get();
667 uint16_t* indices = (uint16_t*)(texs + ptCount);
668
669 // cons up texture coordinates and indices
670 {
671 const SkScalar w = SkIntToScalar(bitmap.width());
672 const SkScalar h = SkIntToScalar(bitmap.height());
673 const SkScalar dx = w / meshWidth;
674 const SkScalar dy = h / meshHeight;
675
676 SkPoint* texsPtr = texs;
677 SkScalar y = 0;
678 for (int i = 0; i <= meshHeight; i++) {
679 if (i == meshHeight) {
680 y = h; // to ensure numerically we hit h exactly
681 }
682 SkScalar x = 0;
683 for (int j = 0; j < meshWidth; j++) {
684 texsPtr->set(x, y);
685 texsPtr += 1;
686 x += dx;
687 }
688 texsPtr->set(w, y);
689 texsPtr += 1;
690 y += dy;
691 }
692 SkASSERT(texsPtr - texs == ptCount);
693 }
694
695 // cons up indices
696 {
697 uint16_t* indexPtr = indices;
698 int index = 0;
699 for (int i = 0; i < meshHeight; i++) {
700 for (int j = 0; j < meshWidth; j++) {
701 // lower-left triangle
702 *indexPtr++ = index;
703 *indexPtr++ = index + meshWidth + 1;
704 *indexPtr++ = index + meshWidth + 2;
705 // upper-right triangle
706 *indexPtr++ = index;
707 *indexPtr++ = index + meshWidth + 2;
708 *indexPtr++ = index + 1;
709 // bump to the next cell
710 index += 1;
711 }
712 // bump to the next row
713 index += 1;
714 }
715 SkASSERT(indexPtr - indices == indexCount);
716 SkASSERT((char*)indexPtr - (char*)storage.get() == storageSize);
717 }
718
719 // double-check that we have legal indices
720#ifdef SK_DEBUG
721 {
722 for (int i = 0; i < indexCount; i++) {
723 SkASSERT((unsigned)indices[i] < (unsigned)ptCount);
724 }
725 }
726#endif
727
728 // cons-up a shader for the bitmap
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400729 SkPaint tmpPaint;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400730 if (paint) {
731 tmpPaint = *paint;
732 }
733 SkShader* shader = SkShader::CreateBitmapShader(bitmap,
734 SkShader::kClamp_TileMode,
735 SkShader::kClamp_TileMode);
736 SkSafeUnref(tmpPaint.setShader(shader));
737
738 mCanvas->drawVertices(SkCanvas::kTriangles_VertexMode, ptCount, (SkPoint*)vertices,
739 texs, (const SkColor*)colors, NULL, indices,
740 indexCount, tmpPaint);
741}
742
Derek Sollenbergeredca3202015-07-10 13:56:39 -0400743void SkiaCanvas::drawNinePatch(const SkBitmap& bitmap, const Res_png_9patch& chunk,
744 float dstLeft, float dstTop, float dstRight, float dstBottom, const SkPaint* paint) {
745 SkRect bounds = SkRect::MakeLTRB(dstLeft, dstTop, dstRight, dstBottom);
746 NinePatch::Draw(mCanvas, bounds, bitmap, chunk, paint, nullptr);
747}
748
Doris Liu766431a2016-02-04 22:17:11 +0000749void SkiaCanvas::drawVectorDrawable(VectorDrawableRoot* vectorDrawable) {
750 const SkBitmap& bitmap = vectorDrawable->getBitmapUpdateIfDirty();
751 SkRect bounds = vectorDrawable->getBounds();
752 drawBitmap(bitmap, 0, 0, bitmap.width(), bitmap.height(),
753 bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom,
754 vectorDrawable->getPaint());
755}
756
Derek Sollenberger8872b382014-06-23 14:13:53 -0400757// ----------------------------------------------------------------------------
758// Canvas draw operations: Text
759// ----------------------------------------------------------------------------
760
sergeyvdccca442016-03-21 15:38:21 -0700761void SkiaCanvas::drawGlyphs(const uint16_t* text, const float* positions, int count,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400762 const SkPaint& paint, float x, float y,
Tom Hudson8dfaa492014-12-09 15:03:44 -0500763 float boundsLeft, float boundsTop, float boundsRight, float boundsBottom,
764 float totalAdvance) {
Ben Wagnere3a40ea2015-08-19 15:49:37 -0400765 static_assert(sizeof(SkPoint) == sizeof(float)*2, "SkPoint is no longer two floats");
Derek Sollenberger79abbf22016-03-24 11:07:19 -0400766 mCanvas->drawPosText(text, count << 1, reinterpret_cast<const SkPoint*>(positions), paint);
Chris Craika1717272015-11-19 13:02:43 -0800767 drawTextDecorations(x, y, totalAdvance, paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400768}
769
sergeyvdccca442016-03-21 15:38:21 -0700770void SkiaCanvas::drawGlyphsOnPath(const uint16_t* glyphs, int count, const SkPath& path,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400771 float hOffset, float vOffset, const SkPaint& paint) {
Tom Hudson34e79c12015-04-14 11:34:39 -0400772 mCanvas->drawTextOnPathHV(glyphs, count << 1, path, hOffset, vOffset, paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400773}
774
Derek Sollenberger6f485562015-07-30 10:00:39 -0400775// ----------------------------------------------------------------------------
776// Canvas draw operations: Animations
777// ----------------------------------------------------------------------------
778
779class AnimatedRoundRect : public SkDrawable {
780 public:
781 AnimatedRoundRect(uirenderer::CanvasPropertyPrimitive* left,
782 uirenderer::CanvasPropertyPrimitive* top, uirenderer::CanvasPropertyPrimitive* right,
783 uirenderer::CanvasPropertyPrimitive* bottom, uirenderer::CanvasPropertyPrimitive* rx,
784 uirenderer::CanvasPropertyPrimitive* ry, uirenderer::CanvasPropertyPaint* p) :
785 mLeft(left), mTop(top), mRight(right), mBottom(bottom), mRx(rx), mRy(ry), mPaint(p) {}
786
787 protected:
788 virtual SkRect onGetBounds() override {
789 return SkRect::MakeLTRB(mLeft->value, mTop->value, mRight->value, mBottom->value);
790 }
791 virtual void onDraw(SkCanvas* canvas) override {
792 SkRect rect = SkRect::MakeLTRB(mLeft->value, mTop->value, mRight->value, mBottom->value);
793 canvas->drawRoundRect(rect, mRx->value, mRy->value, mPaint->value);
794 }
795
796 private:
797 sp<uirenderer::CanvasPropertyPrimitive> mLeft;
798 sp<uirenderer::CanvasPropertyPrimitive> mTop;
799 sp<uirenderer::CanvasPropertyPrimitive> mRight;
800 sp<uirenderer::CanvasPropertyPrimitive> mBottom;
801 sp<uirenderer::CanvasPropertyPrimitive> mRx;
802 sp<uirenderer::CanvasPropertyPrimitive> mRy;
803 sp<uirenderer::CanvasPropertyPaint> mPaint;
804};
805
806class AnimatedCircle : public SkDrawable {
807 public:
808 AnimatedCircle(uirenderer::CanvasPropertyPrimitive* x, uirenderer::CanvasPropertyPrimitive* y,
809 uirenderer::CanvasPropertyPrimitive* radius, uirenderer::CanvasPropertyPaint* paint) :
810 mX(x), mY(y), mRadius(radius), mPaint(paint) {}
811
812 protected:
813 virtual SkRect onGetBounds() override {
814 const float x = mX->value;
815 const float y = mY->value;
816 const float radius = mRadius->value;
817 return SkRect::MakeLTRB(x - radius, y - radius, x + radius, y + radius);
818 }
819 virtual void onDraw(SkCanvas* canvas) override {
820 canvas->drawCircle(mX->value, mY->value, mRadius->value, mPaint->value);
821 }
822
823 private:
824 sp<uirenderer::CanvasPropertyPrimitive> mX;
825 sp<uirenderer::CanvasPropertyPrimitive> mY;
826 sp<uirenderer::CanvasPropertyPrimitive> mRadius;
827 sp<uirenderer::CanvasPropertyPaint> mPaint;
828};
829
830void SkiaCanvas::drawRoundRect(uirenderer::CanvasPropertyPrimitive* left,
831 uirenderer::CanvasPropertyPrimitive* top, uirenderer::CanvasPropertyPrimitive* right,
832 uirenderer::CanvasPropertyPrimitive* bottom, uirenderer::CanvasPropertyPrimitive* rx,
833 uirenderer::CanvasPropertyPrimitive* ry, uirenderer::CanvasPropertyPaint* paint) {
834 SkAutoTUnref<AnimatedRoundRect> drawable(
835 new AnimatedRoundRect(left, top, right, bottom, rx, ry, paint));
836 mCanvas->drawDrawable(drawable.get());
837}
838
839void SkiaCanvas::drawCircle(uirenderer::CanvasPropertyPrimitive* x, uirenderer::CanvasPropertyPrimitive* y,
840 uirenderer::CanvasPropertyPrimitive* radius, uirenderer::CanvasPropertyPaint* paint) {
841 SkAutoTUnref<AnimatedCircle> drawable(new AnimatedCircle(x, y, radius, paint));
842 mCanvas->drawDrawable(drawable.get());
843}
844
845// ----------------------------------------------------------------------------
846// Canvas draw operations: View System
847// ----------------------------------------------------------------------------
848
849void SkiaCanvas::drawLayer(uirenderer::DeferredLayerUpdater* layer) { }
850
851void SkiaCanvas::drawRenderNode(uirenderer::RenderNode* renderNode) { }
852
853void SkiaCanvas::callDrawGLFunction(Functor* functor) { }
854
Derek Sollenberger8872b382014-06-23 14:13:53 -0400855} // namespace android