00001 /* 00002 * Copyright (C) 2006 The Android Open Source Project 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef SkBounder_DEFINED 00018 #define SkBounder_DEFINED 00019 00020 #include "SkTypes.h" 00021 #include "SkRefCnt.h" 00022 00023 struct SkIRect; 00024 struct SkPoint; 00025 struct SkRect; 00026 class SkPaint; 00027 class SkPath; 00028 class SkRegion; 00029 00035 class SkBounder : public SkRefCnt { 00036 public: 00037 /* Call to perform a clip test before calling onIRect. 00038 Returns the result from onIRect. 00039 */ 00040 bool doIRect(const SkIRect&); 00041 00042 protected: 00049 virtual bool onIRect(const SkIRect&) = 0; 00050 00055 virtual void commit(); 00056 00057 private: 00058 bool doHairline(const SkPoint&, const SkPoint&, const SkPaint&); 00059 bool doRect(const SkRect&, const SkPaint&); 00060 bool doPath(const SkPath&, const SkPaint&, bool doFill); 00061 void setClip(const SkRegion* clip) { fClip = clip; } 00062 00063 const SkRegion* fClip; 00064 friend class SkAutoBounderCommit; 00065 friend class SkDraw; 00066 friend class SkDrawIter; 00067 friend struct Draw1Glyph; 00068 friend class SkMaskFilter; 00069 }; 00070 00071 #endif 00072