00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef SkScan_DEFINED
00019 #define SkScan_DEFINED
00020
00021 #include "SkRect.h"
00022
00023 class SkRegion;
00024 class SkBlitter;
00025 class SkPath;
00026
00030 typedef SkIRect SkXRect;
00031
00032 class SkScan {
00033 public:
00034 static void FillIRect(const SkIRect&, const SkRegion* clip, SkBlitter*);
00035 static void FillXRect(const SkXRect&, const SkRegion* clip, SkBlitter*);
00036
00037 #ifdef SK_SCALAR_IS_FIXED
00038 static void FillRect(const SkRect& rect, const SkRegion* clip,
00039 SkBlitter* blitter) {
00040 SkScan::FillXRect(*(const SkXRect*)&rect, clip, blitter);
00041 }
00042 #else
00043 static void FillRect(const SkRect&, const SkRegion* clip, SkBlitter*);
00044 #endif
00045
00046 static void FillTriangle(const SkPoint pts[], const SkRegion*, SkBlitter*);
00047 static void FillPath(const SkPath&, const SkRegion& clip, SkBlitter*);
00048
00049 static void FillTriangle(const SkPoint& a, const SkPoint& b,
00050 const SkPoint& c, const SkRegion* clip,
00051 SkBlitter* blitter) {
00052 SkPoint pts[3];
00053 pts[0] = a;
00054 pts[1] = b;
00055 pts[2] = c;
00056 FillTriangle(pts, clip, blitter);
00057 }
00058
00059 static void HairLine(const SkPoint&, const SkPoint&, const SkRegion* clip, SkBlitter*);
00060 static void HairRect(const SkRect&, const SkRegion* clip, SkBlitter*);
00061 static void HairPath(const SkPath&, const SkRegion* clip, SkBlitter*);
00062
00063 static void FrameRect(const SkRect&, SkScalar width, const SkRegion* clip, SkBlitter*);
00064
00065 static void AntiFillXRect(const SkXRect&, const SkRegion* clip, SkBlitter*);
00066 #ifdef SK_SCALAR_IS_FIXED
00067 static void AntiFillRect(const SkRect& rect, const SkRegion* clip,
00068 SkBlitter* blitter) {
00069 SkScan::AntiFillXRect(*(const SkXRect*)&rect, clip, blitter);
00070 }
00071 #else
00072 static void AntiFillRect(const SkRect&, const SkRegion* clip, SkBlitter*);
00073 #endif
00074
00075 static void AntiFillPath(const SkPath&, const SkRegion& clip, SkBlitter*);
00076
00077 static void AntiHairLine(const SkPoint&, const SkPoint&, const SkRegion* clip, SkBlitter*);
00078 static void AntiHairRect(const SkRect&, const SkRegion* clip, SkBlitter*);
00079 static void AntiHairPath(const SkPath&, const SkRegion* clip, SkBlitter*);
00080 };
00081
00086 static inline void XRect_set(SkXRect* xr, const SkIRect& src) {
00087 xr->fLeft = SkIntToFixed(src.fLeft);
00088 xr->fTop = SkIntToFixed(src.fTop);
00089 xr->fRight = SkIntToFixed(src.fRight);
00090 xr->fBottom = SkIntToFixed(src.fBottom);
00091 }
00092
00097 static inline void XRect_set(SkXRect* xr, const SkRect& src) {
00098 xr->fLeft = SkScalarToFixed(src.fLeft);
00099 xr->fTop = SkScalarToFixed(src.fTop);
00100 xr->fRight = SkScalarToFixed(src.fRight);
00101 xr->fBottom = SkScalarToFixed(src.fBottom);
00102 }
00103
00106 static inline void XRect_round(const SkXRect& xr, SkIRect* dst) {
00107 dst->fLeft = SkFixedRound(xr.fLeft);
00108 dst->fTop = SkFixedRound(xr.fTop);
00109 dst->fRight = SkFixedRound(xr.fRight);
00110 dst->fBottom = SkFixedRound(xr.fBottom);
00111 }
00112
00116 static inline void XRect_roundOut(const SkXRect& xr, SkIRect* dst) {
00117 dst->fLeft = SkFixedFloor(xr.fLeft);
00118 dst->fTop = SkFixedFloor(xr.fTop);
00119 dst->fRight = SkFixedCeil(xr.fRight);
00120 dst->fBottom = SkFixedCeil(xr.fBottom);
00121 }
00122
00123 #endif