1
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
9
10#ifndef SkBoundable_DEFINED
11#define SkBoundable_DEFINED
12
13#include "SkDrawable.h"
14#include "SkRect.h"
15
16class SkBoundable : public SkDrawable {
17public:
18    SkBoundable();
19    virtual void clearBounder();
20    virtual void enableBounder();
21    virtual void getBounds(SkRect* );
22    bool hasBounds() { return fBounds.fLeft != (int16_t)0x8000U; }
23    void setBounds(SkIRect& bounds) { fBounds = bounds; }
24protected:
25    void clearBounds() { fBounds.fLeft = (int16_t) SkToU16(0x8000); }; // mark bounds as unset
26    SkIRect fBounds;
27private:
28    typedef SkDrawable INHERITED;
29};
30
31class SkBoundableAuto {
32public:
33    SkBoundableAuto(SkBoundable* boundable, SkAnimateMaker& maker);
34    ~SkBoundableAuto();
35private:
36    SkBoundable* fBoundable;
37    SkAnimateMaker& fMaker;
38    SkBoundableAuto& operator= (const SkBoundableAuto& );
39};
40
41#endif // SkBoundable_DEFINED
42