blob: e54bc36fb0a4b59e81cf305d4b29c6cca653ca6c [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
Derek Sollenberger6f485562015-07-30 10:00:39 -040026#include <SkDrawable.h>
John Reck849911a2015-01-20 07:51:14 -080027#include <SkDeque.h>
28#include <SkDrawFilter.h>
29#include <SkGraphics.h>
Derek Sollenberger6f485562015-07-30 10:00:39 -040030#include <SkImage.h>
Matt Sarett62feb3a2016-09-20 10:34:11 -040031#include <SkImagePriv.h>
Yuqian Liafc221492016-07-18 13:07:42 -040032#include <SkRSXform.h>
John Reck849911a2015-01-20 07:51:14 -080033#include <SkShader.h>
John Reck849911a2015-01-20 07:51:14 -080034#include <SkTemplates.h>
Stan Ilievf50806a2016-10-24 10:40:39 -040035#include <SkTextBlob.h>
Derek Sollenberger8872b382014-06-23 14:13:53 -040036
Ben Wagner60126ef2015-08-07 12:13:48 -040037#include <memory>
38
Derek Sollenberger8872b382014-06-23 14:13:53 -040039namespace android {
40
Stan Ilievf50806a2016-10-24 10:40:39 -040041using uirenderer::PaintUtils;
42
John Reckc1b33d62015-04-22 09:04:45 -070043Canvas* Canvas::create_canvas(const SkBitmap& bitmap) {
Derek Sollenberger8872b382014-06-23 14:13:53 -040044 return new SkiaCanvas(bitmap);
45}
46
47Canvas* Canvas::create_canvas(SkCanvas* skiaCanvas) {
48 return new SkiaCanvas(skiaCanvas);
49}
50
Stan Ilievf50806a2016-10-24 10:40:39 -040051SkiaCanvas::SkiaCanvas() {}
52
53SkiaCanvas::SkiaCanvas(SkCanvas* canvas)
Mike Reed6acfe162016-11-18 17:21:09 -050054 : mCanvas(canvas) {}
Stan Ilievf50806a2016-10-24 10:40:39 -040055
John Reckc1b33d62015-04-22 09:04:45 -070056SkiaCanvas::SkiaCanvas(const SkBitmap& bitmap) {
Mike Reed6acfe162016-11-18 17:21:09 -050057 mCanvasOwned = std::unique_ptr<SkCanvas>(new SkCanvas(bitmap));
58 mCanvas = mCanvasOwned.get();
Derek Sollenberger8872b382014-06-23 14:13:53 -040059}
60
Stan Iliev021693b2016-10-17 16:26:15 -040061SkiaCanvas::~SkiaCanvas() {}
62
Derek Sollenbergerc1908132016-07-15 10:28:16 -040063void SkiaCanvas::reset(SkCanvas* skiaCanvas) {
Mike Reed6acfe162016-11-18 17:21:09 -050064 if (mCanvas != skiaCanvas) {
65 mCanvas = skiaCanvas;
66 mCanvasOwned.reset();
67 }
Derek Sollenbergerc1908132016-07-15 10:28:16 -040068 mSaveStack.reset(nullptr);
69 mHighContrastText = false;
70}
71
Derek Sollenberger8872b382014-06-23 14:13:53 -040072// ----------------------------------------------------------------------------
73// Canvas state operations: Replace Bitmap
74// ----------------------------------------------------------------------------
75
76class ClipCopier : public SkCanvas::ClipVisitor {
77public:
Chih-Hung Hsiehc6baf562016-04-27 11:29:23 -070078 explicit ClipCopier(SkCanvas* dstCanvas) : m_dstCanvas(dstCanvas) {}
Derek Sollenberger8872b382014-06-23 14:13:53 -040079
Mike Reed6e49c9f2016-12-02 15:36:59 -050080 virtual void clipRect(const SkRect& rect, SkClipOp op, bool antialias) {
Derek Sollenberger8872b382014-06-23 14:13:53 -040081 m_dstCanvas->clipRect(rect, op, antialias);
82 }
Mike Reed6e49c9f2016-12-02 15:36:59 -050083 virtual void clipRRect(const SkRRect& rrect, SkClipOp op, bool antialias) {
Derek Sollenberger8872b382014-06-23 14:13:53 -040084 m_dstCanvas->clipRRect(rrect, op, antialias);
85 }
Mike Reed6e49c9f2016-12-02 15:36:59 -050086 virtual void clipPath(const SkPath& path, SkClipOp op, bool antialias) {
Derek Sollenberger8872b382014-06-23 14:13:53 -040087 m_dstCanvas->clipPath(path, op, antialias);
88 }
89
90private:
91 SkCanvas* m_dstCanvas;
92};
93
John Reckc1b33d62015-04-22 09:04:45 -070094void SkiaCanvas::setBitmap(const SkBitmap& bitmap) {
Stan Ilievf50806a2016-10-24 10:40:39 -040095 SkCanvas* newCanvas = new SkCanvas(bitmap);
Derek Sollenberger8872b382014-06-23 14:13:53 -040096
John Reckc1b33d62015-04-22 09:04:45 -070097 if (!bitmap.isNull()) {
Derek Sollenberger8872b382014-06-23 14:13:53 -040098 // Copy the canvas matrix & clip state.
99 newCanvas->setMatrix(mCanvas->getTotalMatrix());
Leon Scroggins IIIf35b9892015-07-31 10:38:40 -0400100
Stan Ilievf50806a2016-10-24 10:40:39 -0400101 ClipCopier copier(newCanvas);
Leon Scroggins IIIf35b9892015-07-31 10:38:40 -0400102 mCanvas->replayClips(&copier);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400103 }
104
Mike Reed6acfe162016-11-18 17:21:09 -0500105 // deletes the previously owned canvas (if any)
106 mCanvasOwned = std::unique_ptr<SkCanvas>(newCanvas);
107 mCanvas = newCanvas;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400108
109 // clean up the old save stack
Stan Ilievf50806a2016-10-24 10:40:39 -0400110 mSaveStack.reset(nullptr);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400111}
112
113// ----------------------------------------------------------------------------
114// Canvas state operations
115// ----------------------------------------------------------------------------
116
117bool SkiaCanvas::isOpaque() {
Leon Scroggins IIIf35b9892015-07-31 10:38:40 -0400118 return mCanvas->imageInfo().isOpaque();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400119}
120
121int SkiaCanvas::width() {
Leon Scroggins IIIf35b9892015-07-31 10:38:40 -0400122 return mCanvas->imageInfo().width();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400123}
124
125int SkiaCanvas::height() {
Leon Scroggins IIIf35b9892015-07-31 10:38:40 -0400126 return mCanvas->imageInfo().height();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400127}
128
129// ----------------------------------------------------------------------------
130// Canvas state operations: Save (layer)
131// ----------------------------------------------------------------------------
132
133int SkiaCanvas::getSaveCount() const {
134 return mCanvas->getSaveCount();
135}
136
Florin Malitaeecff562015-12-21 10:43:01 -0500137int SkiaCanvas::save(SaveFlags::Flags flags) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400138 int count = mCanvas->save();
139 recordPartialSave(flags);
140 return count;
141}
142
Florin Malita5e271402015-11-04 14:36:02 -0500143// The SkiaCanvas::restore operation layers on the capability to preserve
144// either (or both) the matrix and/or clip state after a SkCanvas::restore
145// operation. It does this by explicitly saving off the clip & matrix state
146// when requested and playing it back after the SkCanvas::restore.
Derek Sollenberger8872b382014-06-23 14:13:53 -0400147void SkiaCanvas::restore() {
Stan Ilievf50806a2016-10-24 10:40:39 -0400148 const auto* rec = this->currentSaveRec();
149 if (!rec) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400150 // Fast path - no record for this frame.
151 mCanvas->restore();
152 return;
153 }
154
Florin Malitaeecff562015-12-21 10:43:01 -0500155 bool preserveMatrix = !(rec->saveFlags & SaveFlags::Matrix);
156 bool preserveClip = !(rec->saveFlags & SaveFlags::Clip);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400157
158 SkMatrix savedMatrix;
159 if (preserveMatrix) {
160 savedMatrix = mCanvas->getTotalMatrix();
161 }
162
Stan Ilievf50806a2016-10-24 10:40:39 -0400163 const size_t clipIndex = rec->clipIndex;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400164
165 mCanvas->restore();
Stan Ilievf50806a2016-10-24 10:40:39 -0400166 mSaveStack->pop_back();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400167
168 if (preserveMatrix) {
169 mCanvas->setMatrix(savedMatrix);
170 }
171
Stan Ilievf50806a2016-10-24 10:40:39 -0400172 if (preserveClip) {
173 this->applyPersistentClips(clipIndex);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400174 }
Derek Sollenberger8872b382014-06-23 14:13:53 -0400175}
176
177void SkiaCanvas::restoreToCount(int restoreCount) {
178 while (mCanvas->getSaveCount() > restoreCount) {
179 this->restore();
180 }
181}
182
Florin Malitaeecff562015-12-21 10:43:01 -0500183static inline SkCanvas::SaveLayerFlags layerFlags(SaveFlags::Flags flags) {
184 SkCanvas::SaveLayerFlags layerFlags = 0;
185
Yuqian Li83427ff2016-09-14 11:14:06 -0400186 // We intentionally ignore the SaveFlags::HasAlphaLayer and
187 // SkCanvas::kIsOpaque_SaveLayerFlag flags because HWUI ignores it
188 // and our Android client may use it incorrectly.
189 // In Skia, this flag is purely for performance optimization.
Florin Malitaeecff562015-12-21 10:43:01 -0500190
191 if (!(flags & SaveFlags::ClipToLayer)) {
192 layerFlags |= SkCanvas::kDontClipToLayer_Legacy_SaveLayerFlag;
193 }
194
195 return layerFlags;
196}
197
Derek Sollenberger8872b382014-06-23 14:13:53 -0400198int SkiaCanvas::saveLayer(float left, float top, float right, float bottom,
Florin Malitaeecff562015-12-21 10:43:01 -0500199 const SkPaint* paint, SaveFlags::Flags flags) {
200 const SkRect bounds = SkRect::MakeLTRB(left, top, right, bottom);
Stan Iliev68885e32016-12-14 11:18:34 -0500201 //always save matrix and clip to match the behaviour of Skia and HWUI pipelines and to ensure
202 //android state tracking behavior matches that of the Skia API (partial save is not supported)
203 const SkCanvas::SaveLayerRec rec(&bounds, paint, layerFlags(flags | SaveFlags::MatrixClip));
Florin Malitaeecff562015-12-21 10:43:01 -0500204
Stan Iliev68885e32016-12-14 11:18:34 -0500205 return mCanvas->saveLayer(rec);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400206}
207
208int SkiaCanvas::saveLayerAlpha(float left, float top, float right, float bottom,
Florin Malitaeecff562015-12-21 10:43:01 -0500209 int alpha, SaveFlags::Flags flags) {
Florin Malitaeecff562015-12-21 10:43:01 -0500210 if (static_cast<unsigned>(alpha) < 0xFF) {
Yuqian Lifd92ee42016-04-27 17:03:38 -0400211 SkPaint alphaPaint;
212 alphaPaint.setAlpha(alpha);
213 return this->saveLayer(left, top, right, bottom, &alphaPaint, flags);
Florin Malitaeecff562015-12-21 10:43:01 -0500214 }
Yuqian Lifd92ee42016-04-27 17:03:38 -0400215 return this->saveLayer(left, top, right, bottom, nullptr, flags);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400216}
217
Stan Ilievf50806a2016-10-24 10:40:39 -0400218class SkiaCanvas::Clip {
219public:
Mike Reed6e49c9f2016-12-02 15:36:59 -0500220 Clip(const SkRect& rect, SkClipOp op, const SkMatrix& m)
Stan Ilievf50806a2016-10-24 10:40:39 -0400221 : mType(Type::Rect), mOp(op), mMatrix(m), mRRect(SkRRect::MakeRect(rect)) {}
Mike Reed6e49c9f2016-12-02 15:36:59 -0500222 Clip(const SkRRect& rrect, SkClipOp op, const SkMatrix& m)
Stan Ilievf50806a2016-10-24 10:40:39 -0400223 : mType(Type::RRect), mOp(op), mMatrix(m), mRRect(rrect) {}
Mike Reed6e49c9f2016-12-02 15:36:59 -0500224 Clip(const SkPath& path, SkClipOp op, const SkMatrix& m)
Stan Ilievf50806a2016-10-24 10:40:39 -0400225 : mType(Type::Path), mOp(op), mMatrix(m), mPath(&path) {}
226
227 void apply(SkCanvas* canvas) const {
228 canvas->setMatrix(mMatrix);
229 switch (mType) {
230 case Type::Rect:
231 canvas->clipRect(mRRect.rect(), mOp);
232 break;
233 case Type::RRect:
234 canvas->clipRRect(mRRect, mOp);
235 break;
236 case Type::Path:
237 canvas->clipPath(*mPath.get(), mOp);
238 break;
239 }
240 }
241
242private:
243 enum class Type {
244 Rect,
245 RRect,
246 Path,
247 };
248
Mike Reed6e49c9f2016-12-02 15:36:59 -0500249 Type mType;
250 SkClipOp mOp;
251 SkMatrix mMatrix;
Stan Ilievf50806a2016-10-24 10:40:39 -0400252
253 // These are logically a union (tracked separately due to non-POD path).
254 SkTLazy<SkPath> mPath;
255 SkRRect mRRect;
256};
257
258const SkiaCanvas::SaveRec* SkiaCanvas::currentSaveRec() const {
259 const SaveRec* rec = mSaveStack
260 ? static_cast<const SaveRec*>(mSaveStack->back())
261 : nullptr;
262 int currentSaveCount = mCanvas->getSaveCount();
263 SkASSERT(!rec || currentSaveCount >= rec->saveCount);
264
265 return (rec && rec->saveCount == currentSaveCount) ? rec : nullptr;
266}
267
Derek Sollenberger8872b382014-06-23 14:13:53 -0400268// ----------------------------------------------------------------------------
269// functions to emulate legacy SaveFlags (i.e. independent matrix/clip flags)
270// ----------------------------------------------------------------------------
271
Florin Malitaeecff562015-12-21 10:43:01 -0500272void SkiaCanvas::recordPartialSave(SaveFlags::Flags flags) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400273 // A partial save is a save operation which doesn't capture the full canvas state.
Florin Malitaeecff562015-12-21 10:43:01 -0500274 // (either SaveFlags::Matrix or SaveFlags::Clip is missing).
Derek Sollenberger8872b382014-06-23 14:13:53 -0400275
276 // Mask-out non canvas state bits.
Florin Malitaeecff562015-12-21 10:43:01 -0500277 flags &= SaveFlags::MatrixClip;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400278
Florin Malitaeecff562015-12-21 10:43:01 -0500279 if (flags == SaveFlags::MatrixClip) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400280 // not a partial save.
281 return;
282 }
283
Stan Ilievf50806a2016-10-24 10:40:39 -0400284 if (!mSaveStack) {
Ben Wagnerd1cbc162015-08-19 12:45:09 -0400285 mSaveStack.reset(new SkDeque(sizeof(struct SaveRec), 8));
Derek Sollenberger8872b382014-06-23 14:13:53 -0400286 }
287
288 SaveRec* rec = static_cast<SaveRec*>(mSaveStack->push_back());
Florin Malita5e271402015-11-04 14:36:02 -0500289 rec->saveCount = mCanvas->getSaveCount();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400290 rec->saveFlags = flags;
Stan Ilievf50806a2016-10-24 10:40:39 -0400291 rec->clipIndex = mClipStack.size();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400292}
293
Stan Ilievf50806a2016-10-24 10:40:39 -0400294template <typename T>
Mike Reed6e49c9f2016-12-02 15:36:59 -0500295void SkiaCanvas::recordClip(const T& clip, SkClipOp op) {
Stan Ilievf50806a2016-10-24 10:40:39 -0400296 // Only need tracking when in a partial save frame which
297 // doesn't restore the clip.
298 const SaveRec* rec = this->currentSaveRec();
299 if (rec && !(rec->saveFlags & SaveFlags::Clip)) {
300 mClipStack.emplace_back(clip, op, mCanvas->getTotalMatrix());
Derek Sollenberger8872b382014-06-23 14:13:53 -0400301 }
302}
303
Stan Ilievf50806a2016-10-24 10:40:39 -0400304// Applies and optionally removes all clips >= index.
305void SkiaCanvas::applyPersistentClips(size_t clipStartIndex) {
306 SkASSERT(clipStartIndex <= mClipStack.size());
307 const auto begin = mClipStack.cbegin() + clipStartIndex;
308 const auto end = mClipStack.cend();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400309
Stan Ilievf50806a2016-10-24 10:40:39 -0400310 // Clip application mutates the CTM.
311 const SkMatrix saveMatrix = mCanvas->getTotalMatrix();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400312
Stan Ilievf50806a2016-10-24 10:40:39 -0400313 for (auto clip = begin; clip != end; ++clip) {
Mike Reed6acfe162016-11-18 17:21:09 -0500314 clip->apply(mCanvas);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400315 }
316
Stan Ilievf50806a2016-10-24 10:40:39 -0400317 mCanvas->setMatrix(saveMatrix);
318
319 // If the current/post-restore save rec is also persisting clips, we
320 // leave them on the stack to be reapplied part of the next restore().
321 // Otherwise we're done and just pop them.
322 const auto* rec = this->currentSaveRec();
323 if (!rec || (rec->saveFlags & SaveFlags::Clip)) {
324 mClipStack.erase(begin, end);
325 }
Derek Sollenberger8872b382014-06-23 14:13:53 -0400326}
327
328// ----------------------------------------------------------------------------
329// Canvas state operations: Matrix
330// ----------------------------------------------------------------------------
331
332void SkiaCanvas::getMatrix(SkMatrix* outMatrix) const {
333 *outMatrix = mCanvas->getTotalMatrix();
334}
335
336void SkiaCanvas::setMatrix(const SkMatrix& matrix) {
337 mCanvas->setMatrix(matrix);
338}
339
340void SkiaCanvas::concat(const SkMatrix& matrix) {
341 mCanvas->concat(matrix);
342}
343
344void SkiaCanvas::rotate(float degrees) {
345 mCanvas->rotate(degrees);
346}
347
348void SkiaCanvas::scale(float sx, float sy) {
349 mCanvas->scale(sx, sy);
350}
351
352void SkiaCanvas::skew(float sx, float sy) {
353 mCanvas->skew(sx, sy);
354}
355
356void SkiaCanvas::translate(float dx, float dy) {
357 mCanvas->translate(dx, dy);
358}
359
360// ----------------------------------------------------------------------------
361// Canvas state operations: Clips
362// ----------------------------------------------------------------------------
363
364// This function is a mirror of SkCanvas::getClipBounds except that it does
365// not outset the edge of the clip to account for anti-aliasing. There is
366// a skia bug to investigate pushing this logic into back into skia.
367// (see https://code.google.com/p/skia/issues/detail?id=1303)
368bool SkiaCanvas::getClipBounds(SkRect* outRect) const {
369 SkIRect ibounds;
Mike Reed5e438982017-01-25 08:23:25 -0500370 if (!mCanvas->getDeviceClipBounds(&ibounds)) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400371 return false;
372 }
373
374 SkMatrix inverse;
375 // if we can't invert the CTM, we can't return local clip bounds
376 if (!mCanvas->getTotalMatrix().invert(&inverse)) {
377 if (outRect) {
378 outRect->setEmpty();
379 }
380 return false;
381 }
382
383 if (NULL != outRect) {
384 SkRect r = SkRect::Make(ibounds);
385 inverse.mapRect(outRect, r);
386 }
387 return true;
388}
389
390bool SkiaCanvas::quickRejectRect(float left, float top, float right, float bottom) const {
391 SkRect bounds = SkRect::MakeLTRB(left, top, right, bottom);
392 return mCanvas->quickReject(bounds);
393}
394
395bool SkiaCanvas::quickRejectPath(const SkPath& path) const {
396 return mCanvas->quickReject(path);
397}
398
Mike Reed6e49c9f2016-12-02 15:36:59 -0500399bool SkiaCanvas::clipRect(float left, float top, float right, float bottom, SkClipOp op) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400400 SkRect rect = SkRect::MakeLTRB(left, top, right, bottom);
Stan Ilievf50806a2016-10-24 10:40:39 -0400401 this->recordClip(rect, op);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400402 mCanvas->clipRect(rect, op);
Chris Craik5ec6a282015-06-23 15:42:12 -0700403 return !mCanvas->isClipEmpty();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400404}
405
Mike Reed6e49c9f2016-12-02 15:36:59 -0500406bool SkiaCanvas::clipPath(const SkPath* path, SkClipOp op) {
Derek Sollenbergerc1908132016-07-15 10:28:16 -0400407 SkRRect roundRect;
408 if (path->isRRect(&roundRect)) {
Stan Ilievf50806a2016-10-24 10:40:39 -0400409 this->recordClip(roundRect, op);
Derek Sollenbergerc1908132016-07-15 10:28:16 -0400410 mCanvas->clipRRect(roundRect, op);
411 } else {
Stan Ilievf50806a2016-10-24 10:40:39 -0400412 this->recordClip(*path, op);
Derek Sollenbergerc1908132016-07-15 10:28:16 -0400413 mCanvas->clipPath(*path, op);
414 }
Chris Craik5ec6a282015-06-23 15:42:12 -0700415 return !mCanvas->isClipEmpty();
Derek Sollenberger8872b382014-06-23 14:13:53 -0400416}
417
Derek Sollenberger8872b382014-06-23 14:13:53 -0400418// ----------------------------------------------------------------------------
419// Canvas state operations: Filters
420// ----------------------------------------------------------------------------
421
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400422SkDrawFilter* SkiaCanvas::getDrawFilter() {
423 return mCanvas->getDrawFilter();
424}
425
Derek Sollenberger8872b382014-06-23 14:13:53 -0400426void SkiaCanvas::setDrawFilter(SkDrawFilter* drawFilter) {
427 mCanvas->setDrawFilter(drawFilter);
428}
429
430// ----------------------------------------------------------------------------
431// Canvas draw operations
432// ----------------------------------------------------------------------------
433
Mike Reed260ab722016-10-07 15:59:20 -0400434void SkiaCanvas::drawColor(int color, SkBlendMode mode) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400435 mCanvas->drawColor(color, mode);
436}
437
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400438void SkiaCanvas::drawPaint(const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400439 mCanvas->drawPaint(paint);
440}
441
442// ----------------------------------------------------------------------------
443// Canvas draw operations: Geometry
444// ----------------------------------------------------------------------------
445
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400446void SkiaCanvas::drawPoints(const float* points, int count, const SkPaint& paint,
Derek Sollenberger8872b382014-06-23 14:13:53 -0400447 SkCanvas::PointMode mode) {
Stan Ilievf50806a2016-10-24 10:40:39 -0400448 if (CC_UNLIKELY(count < 2 || PaintUtils::paintWillNotDraw(paint))) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400449 // convert the floats into SkPoints
450 count >>= 1; // now it is the number of points
Ben Wagner6bbf68d2015-08-19 11:26:06 -0400451 std::unique_ptr<SkPoint[]> pts(new SkPoint[count]);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400452 for (int i = 0; i < count; i++) {
453 pts[i].set(points[0], points[1]);
454 points += 2;
455 }
Ben Wagner6bbf68d2015-08-19 11:26:06 -0400456 mCanvas->drawPoints(mode, count, pts.get(), paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400457}
458
459
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400460void SkiaCanvas::drawPoint(float x, float y, const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400461 mCanvas->drawPoint(x, y, paint);
462}
463
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400464void SkiaCanvas::drawPoints(const float* points, int count, const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400465 this->drawPoints(points, count, paint, SkCanvas::kPoints_PointMode);
466}
467
468void SkiaCanvas::drawLine(float startX, float startY, float stopX, float stopY,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400469 const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400470 mCanvas->drawLine(startX, startY, stopX, stopY, paint);
471}
472
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400473void SkiaCanvas::drawLines(const float* points, int count, const SkPaint& paint) {
Stan Ilievf50806a2016-10-24 10:40:39 -0400474 if (CC_UNLIKELY(count < 4 || PaintUtils::paintWillNotDraw(paint))) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400475 this->drawPoints(points, count, paint, SkCanvas::kLines_PointMode);
476}
477
478void SkiaCanvas::drawRect(float left, float top, float right, float bottom,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400479 const SkPaint& paint) {
Stan Ilievf50806a2016-10-24 10:40:39 -0400480 if (CC_UNLIKELY(PaintUtils::paintWillNotDraw(paint))) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400481 mCanvas->drawRectCoords(left, top, right, bottom, paint);
482
483}
484
Derek Sollenberger94394b32015-07-10 09:58:41 -0400485void SkiaCanvas::drawRegion(const SkRegion& region, const SkPaint& paint) {
Stan Ilievf50806a2016-10-24 10:40:39 -0400486 if (CC_UNLIKELY(PaintUtils::paintWillNotDraw(paint))) return;
487 mCanvas->drawRegion(region, paint);
Derek Sollenberger94394b32015-07-10 09:58:41 -0400488}
489
Derek Sollenberger8872b382014-06-23 14:13:53 -0400490void SkiaCanvas::drawRoundRect(float left, float top, float right, float bottom,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400491 float rx, float ry, const SkPaint& paint) {
Stan Ilievf50806a2016-10-24 10:40:39 -0400492 if (CC_UNLIKELY(PaintUtils::paintWillNotDraw(paint))) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400493 SkRect rect = SkRect::MakeLTRB(left, top, right, bottom);
494 mCanvas->drawRoundRect(rect, rx, ry, paint);
495}
496
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400497void SkiaCanvas::drawCircle(float x, float y, float radius, const SkPaint& paint) {
Stan Ilievf50806a2016-10-24 10:40:39 -0400498 if (CC_UNLIKELY(radius <= 0 || PaintUtils::paintWillNotDraw(paint))) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400499 mCanvas->drawCircle(x, y, radius, paint);
500}
501
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400502void SkiaCanvas::drawOval(float left, float top, float right, float bottom, const SkPaint& paint) {
Stan Ilievf50806a2016-10-24 10:40:39 -0400503 if (CC_UNLIKELY(PaintUtils::paintWillNotDraw(paint))) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400504 SkRect oval = SkRect::MakeLTRB(left, top, right, bottom);
505 mCanvas->drawOval(oval, paint);
506}
507
508void SkiaCanvas::drawArc(float left, float top, float right, float bottom,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400509 float startAngle, float sweepAngle, bool useCenter, const SkPaint& paint) {
Stan Ilievf50806a2016-10-24 10:40:39 -0400510 if (CC_UNLIKELY(PaintUtils::paintWillNotDraw(paint))) return;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400511 SkRect arc = SkRect::MakeLTRB(left, top, right, bottom);
512 mCanvas->drawArc(arc, startAngle, sweepAngle, useCenter, paint);
513}
514
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400515void SkiaCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
Stan Ilievf50806a2016-10-24 10:40:39 -0400516 if (CC_UNLIKELY(PaintUtils::paintWillNotDraw(paint))) return;
Derek Sollenbergerc1908132016-07-15 10:28:16 -0400517 SkRect rect;
518 SkRRect roundRect;
519 if (path.isOval(&rect)) {
520 mCanvas->drawOval(rect, paint);
521 } else if (path.isRRect(&roundRect)) {
522 mCanvas->drawRRect(roundRect, paint);
523 } else {
524 mCanvas->drawPath(path, paint);
525 }
Derek Sollenberger8872b382014-06-23 14:13:53 -0400526}
527
528void SkiaCanvas::drawVertices(SkCanvas::VertexMode vertexMode, int vertexCount,
529 const float* verts, const float* texs, const int* colors,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400530 const uint16_t* indices, int indexCount, const SkPaint& paint) {
Derek Sollenberger8872b382014-06-23 14:13:53 -0400531#ifndef SK_SCALAR_IS_FLOAT
532 SkDEBUGFAIL("SkScalar must be a float for these conversions to be valid");
533#endif
534 const int ptCount = vertexCount >> 1;
535 mCanvas->drawVertices(vertexMode, ptCount, (SkPoint*)verts, (SkPoint*)texs,
Mike Reedc2f31df2016-10-28 17:21:45 -0400536 (SkColor*)colors, indices, indexCount, paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400537}
538
539// ----------------------------------------------------------------------------
540// Canvas draw operations: Bitmaps
541// ----------------------------------------------------------------------------
542
sergeyvaed7f582016-10-14 16:30:21 -0700543void SkiaCanvas::drawBitmap(Bitmap& bitmap, float left, float top, const SkPaint* paint) {
544 SkBitmap skBitmap;
545 bitmap.getSkBitmap(&skBitmap);
546 mCanvas->drawBitmap(skBitmap, left, top, paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400547}
548
sergeyvfc9999502016-10-17 13:07:38 -0700549void SkiaCanvas::drawBitmap(Bitmap& hwuiBitmap, const SkMatrix& matrix, const SkPaint* paint) {
550 SkBitmap bitmap;
551 hwuiBitmap.getSkBitmap(&bitmap);
Mike Reed6acfe162016-11-18 17:21:09 -0500552 SkAutoCanvasRestore acr(mCanvas, true);
Mike Reed70ffbf92014-12-08 17:03:30 -0500553 mCanvas->concat(matrix);
554 mCanvas->drawBitmap(bitmap, 0, 0, paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400555}
556
sergeyvfc9999502016-10-17 13:07:38 -0700557void SkiaCanvas::drawBitmap(Bitmap& hwuiBitmap, float srcLeft, float srcTop,
Derek Sollenberger8872b382014-06-23 14:13:53 -0400558 float srcRight, float srcBottom, float dstLeft, float dstTop,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400559 float dstRight, float dstBottom, const SkPaint* paint) {
sergeyvfc9999502016-10-17 13:07:38 -0700560 SkBitmap bitmap;
561 hwuiBitmap.getSkBitmap(&bitmap);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400562 SkRect srcRect = SkRect::MakeLTRB(srcLeft, srcTop, srcRight, srcBottom);
563 SkRect dstRect = SkRect::MakeLTRB(dstLeft, dstTop, dstRight, dstBottom);
Leon Scroggins IIIf35b9892015-07-31 10:38:40 -0400564 mCanvas->drawBitmapRect(bitmap, srcRect, dstRect, paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400565}
566
sergeyv5fd2a1c2016-10-20 15:04:28 -0700567void SkiaCanvas::drawBitmapMesh(Bitmap& hwuiBitmap, int meshWidth, int meshHeight,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400568 const float* vertices, const int* colors, const SkPaint* paint) {
sergeyv5fd2a1c2016-10-20 15:04:28 -0700569 SkBitmap bitmap;
570 hwuiBitmap.getSkBitmap(&bitmap);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400571 const int ptCount = (meshWidth + 1) * (meshHeight + 1);
572 const int indexCount = meshWidth * meshHeight * 6;
573
574 /* Our temp storage holds 2 or 3 arrays.
575 texture points [ptCount * sizeof(SkPoint)]
576 optionally vertex points [ptCount * sizeof(SkPoint)] if we need a
577 copy to convert from float to fixed
578 indices [ptCount * sizeof(uint16_t)]
579 */
580 ssize_t storageSize = ptCount * sizeof(SkPoint); // texs[]
581 storageSize += indexCount * sizeof(uint16_t); // indices[]
582
583
584#ifndef SK_SCALAR_IS_FLOAT
585 SkDEBUGFAIL("SkScalar must be a float for these conversions to be valid");
586#endif
Ben Wagner6bbf68d2015-08-19 11:26:06 -0400587 std::unique_ptr<char[]> storage(new char[storageSize]);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400588 SkPoint* texs = (SkPoint*)storage.get();
589 uint16_t* indices = (uint16_t*)(texs + ptCount);
590
591 // cons up texture coordinates and indices
592 {
593 const SkScalar w = SkIntToScalar(bitmap.width());
594 const SkScalar h = SkIntToScalar(bitmap.height());
595 const SkScalar dx = w / meshWidth;
596 const SkScalar dy = h / meshHeight;
597
598 SkPoint* texsPtr = texs;
599 SkScalar y = 0;
600 for (int i = 0; i <= meshHeight; i++) {
601 if (i == meshHeight) {
602 y = h; // to ensure numerically we hit h exactly
603 }
604 SkScalar x = 0;
605 for (int j = 0; j < meshWidth; j++) {
606 texsPtr->set(x, y);
607 texsPtr += 1;
608 x += dx;
609 }
610 texsPtr->set(w, y);
611 texsPtr += 1;
612 y += dy;
613 }
614 SkASSERT(texsPtr - texs == ptCount);
615 }
616
617 // cons up indices
618 {
619 uint16_t* indexPtr = indices;
620 int index = 0;
621 for (int i = 0; i < meshHeight; i++) {
622 for (int j = 0; j < meshWidth; j++) {
623 // lower-left triangle
624 *indexPtr++ = index;
625 *indexPtr++ = index + meshWidth + 1;
626 *indexPtr++ = index + meshWidth + 2;
627 // upper-right triangle
628 *indexPtr++ = index;
629 *indexPtr++ = index + meshWidth + 2;
630 *indexPtr++ = index + 1;
631 // bump to the next cell
632 index += 1;
633 }
634 // bump to the next row
635 index += 1;
636 }
637 SkASSERT(indexPtr - indices == indexCount);
638 SkASSERT((char*)indexPtr - (char*)storage.get() == storageSize);
639 }
640
641 // double-check that we have legal indices
642#ifdef SK_DEBUG
643 {
644 for (int i = 0; i < indexCount; i++) {
645 SkASSERT((unsigned)indices[i] < (unsigned)ptCount);
646 }
647 }
648#endif
649
650 // cons-up a shader for the bitmap
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400651 SkPaint tmpPaint;
Derek Sollenberger8872b382014-06-23 14:13:53 -0400652 if (paint) {
653 tmpPaint = *paint;
654 }
Stan Ilievf50806a2016-10-24 10:40:39 -0400655
656 sk_sp<SkImage> image = SkMakeImageFromRasterBitmap(bitmap, kNever_SkCopyPixelsMode);
657 tmpPaint.setShader(image->makeShader(SkShader::kClamp_TileMode, SkShader::kClamp_TileMode));
Derek Sollenberger8872b382014-06-23 14:13:53 -0400658
659 mCanvas->drawVertices(SkCanvas::kTriangles_VertexMode, ptCount, (SkPoint*)vertices,
Mike Reedc2f31df2016-10-28 17:21:45 -0400660 texs, (const SkColor*)colors, indices,
Derek Sollenberger8872b382014-06-23 14:13:53 -0400661 indexCount, tmpPaint);
662}
663
sergeyv5fd2a1c2016-10-20 15:04:28 -0700664void SkiaCanvas::drawNinePatch(Bitmap& hwuiBitmap, const Res_png_9patch& chunk,
Derek Sollenbergeredca3202015-07-10 13:56:39 -0400665 float dstLeft, float dstTop, float dstRight, float dstBottom, const SkPaint* paint) {
Stan Ilievf50806a2016-10-24 10:40:39 -0400666
sergeyv5fd2a1c2016-10-20 15:04:28 -0700667 SkBitmap bitmap;
668 hwuiBitmap.getSkBitmap(&bitmap);
Stan Ilievf50806a2016-10-24 10:40:39 -0400669
670 SkCanvas::Lattice lattice;
Matt Sarett7de73852016-10-25 18:36:39 -0400671 NinePatchUtils::SetLatticeDivs(&lattice, chunk, bitmap.width(), bitmap.height());
Stan Ilievf50806a2016-10-24 10:40:39 -0400672
673 lattice.fFlags = nullptr;
674 int numFlags = 0;
Stan Iliev021693b2016-10-17 16:26:15 -0400675 if (chunk.numColors > 0 && chunk.numColors == NinePatchUtils::NumDistinctRects(lattice)) {
Stan Ilievf50806a2016-10-24 10:40:39 -0400676 // We can expect the framework to give us a color for every distinct rect.
677 // Skia requires a flag for every rect.
678 numFlags = (lattice.fXCount + 1) * (lattice.fYCount + 1);
679 }
680
681 SkAutoSTMalloc<25, SkCanvas::Lattice::Flags> flags(numFlags);
682 if (numFlags > 0) {
Stan Iliev021693b2016-10-17 16:26:15 -0400683 NinePatchUtils::SetLatticeFlags(&lattice, flags.get(), numFlags, chunk);
Stan Ilievf50806a2016-10-24 10:40:39 -0400684 }
685
686 lattice.fBounds = nullptr;
687 SkRect dst = SkRect::MakeLTRB(dstLeft, dstTop, dstRight, dstBottom);
688 mCanvas->drawBitmapLattice(bitmap, lattice, dst, paint);
Derek Sollenbergeredca3202015-07-10 13:56:39 -0400689}
690
Doris Liu766431a2016-02-04 22:17:11 +0000691void SkiaCanvas::drawVectorDrawable(VectorDrawableRoot* vectorDrawable) {
Doris Liu1d8e1942016-03-02 15:16:28 -0800692 vectorDrawable->drawStaging(this);
Doris Liu766431a2016-02-04 22:17:11 +0000693}
694
Derek Sollenberger8872b382014-06-23 14:13:53 -0400695// ----------------------------------------------------------------------------
696// Canvas draw operations: Text
697// ----------------------------------------------------------------------------
698
sergeyvdccca442016-03-21 15:38:21 -0700699void SkiaCanvas::drawGlyphs(const uint16_t* text, const float* positions, int count,
Derek Sollenbergeracb40992014-07-21 15:22:10 -0400700 const SkPaint& paint, float x, float y,
Tom Hudson8dfaa492014-12-09 15:03:44 -0500701 float boundsLeft, float boundsTop, float boundsRight, float boundsBottom,
702 float totalAdvance) {
Stan Ilievf50806a2016-10-24 10:40:39 -0400703 if (!text || !positions || count <= 0 || PaintUtils::paintWillNotDrawText(paint)) return;
704 // Set align to left for drawing, as we don't want individual
705 // glyphs centered or right-aligned; the offset above takes
706 // care of all alignment.
707 SkPaint paintCopy(paint);
708 paintCopy.setTextAlign(SkPaint::kLeft_Align);
709
710 SkRect bounds = SkRect::MakeLTRB(boundsLeft + x, boundsTop + y,
711 boundsRight + x, boundsBottom + y);
712
713 SkTextBlobBuilder builder;
714 const SkTextBlobBuilder::RunBuffer& buffer = builder.allocRunPos(paintCopy, count, &bounds);
715 // TODO: we could reduce the number of memcpy's if the this were exposed further up
716 // in the architecture.
717 memcpy(buffer.glyphs, text, count * sizeof(uint16_t));
718 memcpy(buffer.pos, positions, (count << 1) * sizeof(float));
719
720 sk_sp<SkTextBlob> textBlob(builder.make());
721 mCanvas->drawTextBlob(textBlob, 0, 0, paintCopy);
722 drawTextDecorations(x, y, totalAdvance, paintCopy);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400723}
724
Yuqian Liafc221492016-07-18 13:07:42 -0400725void SkiaCanvas::drawLayoutOnPath(const minikin::Layout& layout, float hOffset, float vOffset,
726 const SkPaint& paint, const SkPath& path, size_t start, size_t end) {
727 const int N = end - start;
Derek Sollenbergere547dd02016-11-09 11:55:59 -0500728 SkAutoSTMalloc<1024, uint8_t> storage(N * (sizeof(uint16_t) + sizeof(SkRSXform)));
Yuqian Liafc221492016-07-18 13:07:42 -0400729 SkRSXform* xform = (SkRSXform*)storage.get();
730 uint16_t* glyphs = (uint16_t*)(xform + N);
731 SkPathMeasure meas(path, false);
732
733 for (size_t i = start; i < end; i++) {
734 glyphs[i - start] = layout.getGlyphId(i);
735 float x = hOffset + layout.getX(i);
736 float y = vOffset + layout.getY(i);
737
738 SkPoint pos;
739 SkVector tan;
740 if (!meas.getPosTan(x, &pos, &tan)) {
741 pos.set(x, y);
742 tan.set(1, 0);
743 }
744 xform[i - start].fSCos = tan.x();
745 xform[i - start].fSSin = tan.y();
746 xform[i - start].fTx = pos.x() - tan.y() * y;
747 xform[i - start].fTy = pos.y() + tan.x() * y;
748 }
749
750 this->asSkCanvas()->drawTextRSXform(glyphs, sizeof(uint16_t) * N, xform, nullptr, paint);
Derek Sollenberger8872b382014-06-23 14:13:53 -0400751}
752
Derek Sollenberger6f485562015-07-30 10:00:39 -0400753// ----------------------------------------------------------------------------
754// Canvas draw operations: Animations
755// ----------------------------------------------------------------------------
756
Derek Sollenberger6f485562015-07-30 10:00:39 -0400757void SkiaCanvas::drawRoundRect(uirenderer::CanvasPropertyPrimitive* left,
758 uirenderer::CanvasPropertyPrimitive* top, uirenderer::CanvasPropertyPrimitive* right,
759 uirenderer::CanvasPropertyPrimitive* bottom, uirenderer::CanvasPropertyPrimitive* rx,
760 uirenderer::CanvasPropertyPrimitive* ry, uirenderer::CanvasPropertyPaint* paint) {
Stan Iliev021693b2016-10-17 16:26:15 -0400761 sk_sp<uirenderer::skiapipeline::AnimatedRoundRect> drawable(
762 new uirenderer::skiapipeline::AnimatedRoundRect(left, top, right, bottom, rx, ry, paint));
Derek Sollenberger6f485562015-07-30 10:00:39 -0400763 mCanvas->drawDrawable(drawable.get());
764}
765
766void SkiaCanvas::drawCircle(uirenderer::CanvasPropertyPrimitive* x, uirenderer::CanvasPropertyPrimitive* y,
767 uirenderer::CanvasPropertyPrimitive* radius, uirenderer::CanvasPropertyPaint* paint) {
Stan Iliev021693b2016-10-17 16:26:15 -0400768 sk_sp<uirenderer::skiapipeline::AnimatedCircle> drawable(new uirenderer::skiapipeline::AnimatedCircle(x, y, radius, paint));
Derek Sollenberger6f485562015-07-30 10:00:39 -0400769 mCanvas->drawDrawable(drawable.get());
770}
771
772// ----------------------------------------------------------------------------
773// Canvas draw operations: View System
774// ----------------------------------------------------------------------------
775
Stan Ilievf50806a2016-10-24 10:40:39 -0400776void SkiaCanvas::drawLayer(uirenderer::DeferredLayerUpdater* layerUpdater) {
Derek Sollenbergerc1908132016-07-15 10:28:16 -0400777 LOG_ALWAYS_FATAL("SkiaCanvas can't directly draw Layers");
778}
Derek Sollenberger6f485562015-07-30 10:00:39 -0400779
Derek Sollenbergerc1908132016-07-15 10:28:16 -0400780void SkiaCanvas::drawRenderNode(uirenderer::RenderNode* renderNode) {
781 LOG_ALWAYS_FATAL("SkiaCanvas can't directly draw RenderNodes");
782}
Derek Sollenberger6f485562015-07-30 10:00:39 -0400783
John Reckcd1c3eb2016-04-14 10:38:54 -0700784void SkiaCanvas::callDrawGLFunction(Functor* functor,
Derek Sollenbergerc1908132016-07-15 10:28:16 -0400785 uirenderer::GlFunctorLifecycleListener* listener) {
786 LOG_ALWAYS_FATAL("SkiaCanvas can't directly draw GL Content");
787}
Derek Sollenberger6f485562015-07-30 10:00:39 -0400788
Derek Sollenberger8872b382014-06-23 14:13:53 -0400789} // namespace android