180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/*
380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Copyright 2006 The Android Open Source Project
480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *
580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Use of this source code is governed by a BSD-style license that can be
680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * found in the LICENSE file.
780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifndef SkBoundable_DEFINED
1180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define SkBoundable_DEFINED
1280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkDrawable.h"
1480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkRect.h"
1580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass SkBoundable : public SkDrawable {
1780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic:
1880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkBoundable();
1980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void clearBounder();
2080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void enableBounder();
2180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void getBounds(SkRect* );
2280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    bool hasBounds() { return fBounds.fLeft != (int16_t)0x8000U; }
2380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void setBounds(SkIRect& bounds) { fBounds = bounds; }
2480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprotected:
2580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void clearBounds() { fBounds.fLeft = (int16_t) SkToU16(0x8000); }; // mark bounds as unset
2680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkIRect fBounds;
2780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprivate:
2880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef SkDrawable INHERITED;
2980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru};
3080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
3180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass SkBoundableAuto {
3280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic:
3380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkBoundableAuto(SkBoundable* boundable, SkAnimateMaker& maker);
3480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    ~SkBoundableAuto();
3580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprivate:
3680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkBoundable* fBoundable;
3780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkAnimateMaker& fMaker;
3880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkBoundableAuto& operator= (const SkBoundableAuto& );
3980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru};
4080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
4180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif // SkBoundable_DEFINED
42