blob: 7ae9ca58d47955e6922ad1ac1071d58f7d449b61 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
2/*
3 * Copyright 2006 The Android Open Source Project
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
reed@android.com8a1c16f2008-12-17 15:59:43 +00009
10#include "SkDrawTo.h"
11#include "SkAnimateMaker.h"
12#include "SkCanvas.h"
13#include "SkDrawBitmap.h"
14
15#if SK_USE_CONDENSED_INFO == 0
16
17const SkMemberInfo SkDrawTo::fInfo[] = {
18 SK_MEMBER(drawOnce, Boolean),
19 SK_MEMBER(use, Bitmap)
20};
21
22#endif
23
24DEFINE_GET_MEMBER(SkDrawTo);
25
halcanary96fcdcc2015-08-27 07:41:13 -070026SkDrawTo::SkDrawTo() : drawOnce(false), use(nullptr), fDrawnOnce(false) {
reed@android.com8a1c16f2008-12-17 15:59:43 +000027}
28
29#if 0
30SkDrawTo::~SkDrawTo() {
31 SkASSERT(0);
32}
33#endif
34
35bool SkDrawTo::draw(SkAnimateMaker& maker) {
36 if (fDrawnOnce)
37 return false;
38 SkCanvas canvas(use->fBitmap);
39 SkCanvas* save = maker.fCanvas;
40 maker.fCanvas = &canvas;
41 INHERITED::draw(maker);
42 maker.fCanvas = save;
43 fDrawnOnce = drawOnce;
44 return false;
45}
46
47#ifdef SK_DUMP_ENABLED
48void SkDrawTo::dump(SkAnimateMaker* maker) {
49 dumpBase(maker);
50 dumpAttrs(maker);
51 if (use)
52 SkDebugf("use=\"%s\" ", use->id);
53 dumpDrawables(maker);
54}
55#endif