michael@0: michael@0: /* michael@0: * Copyright 2006 The Android Open Source Project michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: michael@0: #ifndef SkBoundable_DEFINED michael@0: #define SkBoundable_DEFINED michael@0: michael@0: #include "SkDrawable.h" michael@0: #include "SkRect.h" michael@0: michael@0: class SkBoundable : public SkDrawable { michael@0: public: michael@0: SkBoundable(); michael@0: virtual void clearBounder(); michael@0: virtual void enableBounder(); michael@0: virtual void getBounds(SkRect* ); michael@0: bool hasBounds() { return fBounds.fLeft != (int16_t)0x8000U; } michael@0: void setBounds(SkIRect& bounds) { fBounds = bounds; } michael@0: protected: michael@0: void clearBounds() { fBounds.fLeft = (int16_t) SkToU16(0x8000); }; // mark bounds as unset michael@0: SkIRect fBounds; michael@0: private: michael@0: typedef SkDrawable INHERITED; michael@0: }; michael@0: michael@0: class SkBoundableAuto { michael@0: public: michael@0: SkBoundableAuto(SkBoundable* boundable, SkAnimateMaker& maker); michael@0: ~SkBoundableAuto(); michael@0: private: michael@0: SkBoundable* fBoundable; michael@0: SkAnimateMaker& fMaker; michael@0: SkBoundableAuto& operator= (const SkBoundableAuto& ); michael@0: }; michael@0: michael@0: #endif // SkBoundable_DEFINED