aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/animator/SkDisplayBounds.cpp
blob: 69ec47ed3c902fb1c3022082d2568ae2d7b3b405 (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

/*
 * 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 "SkDisplayBounds.h"
#include "SkAnimateMaker.h"

#if SK_USE_CONDENSED_INFO == 0

const SkMemberInfo SkDisplayBounds::fInfo[] = {
    SK_MEMBER_INHERITED,
    SK_MEMBER(inval, Boolean)
};

#endif

DEFINE_GET_MEMBER(SkDisplayBounds);

SkDisplayBounds::SkDisplayBounds() : inval(false) {
}

bool SkDisplayBounds::draw(SkAnimateMaker& maker) {
    maker.fDisplayList.fUnionBounds = SkToBool(inval);
    maker.fDisplayList.fDrawBounds = false;
    fBounds.setEmpty();
    bool result = INHERITED::draw(maker);
    maker.fDisplayList.fUnionBounds = false;
    maker.fDisplayList.fDrawBounds = true;
    if (inval && fBounds.isEmpty() == false) {
        SkIRect& rect = maker.fDisplayList.fInvalBounds;
        maker.fDisplayList.fHasUnion = true;
        if (rect.isEmpty())
            rect = fBounds;
        else 
            rect.join(fBounds);
    }
    return result;
}