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