aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/animator/SkDrawTo.cpp
blob: ef084d12d009e9d810e68bc357363b6be553affc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

/*
 * Copyright 2006 The Android Open Source Project
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */


#include "SkDrawTo.h"
#include "SkAnimateMaker.h"
#include "SkCanvas.h"
#include "SkDrawBitmap.h"

#if SK_USE_CONDENSED_INFO == 0

const SkMemberInfo SkDrawTo::fInfo[] = {
    SK_MEMBER(drawOnce, Boolean),
    SK_MEMBER(use, Bitmap)
};

#endif

DEFINE_GET_MEMBER(SkDrawTo);

SkDrawTo::SkDrawTo() : drawOnce(false), use(NULL), fDrawnOnce(false) {
}

#if 0
SkDrawTo::~SkDrawTo() {
    SkASSERT(0);
}
#endif

bool SkDrawTo::draw(SkAnimateMaker& maker) {
    if (fDrawnOnce)
        return false;
    SkCanvas canvas(use->fBitmap);
    SkCanvas* save = maker.fCanvas;
    maker.fCanvas = &canvas;
    INHERITED::draw(maker);
    maker.fCanvas = save;
    fDrawnOnce = drawOnce;
    return false;
}

#ifdef SK_DUMP_ENABLED
void SkDrawTo::dump(SkAnimateMaker* maker) {
    dumpBase(maker);
    dumpAttrs(maker);
    if (use)
        SkDebugf("use=\"%s\" ", use->id);
    dumpDrawables(maker);
}
#endif