| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 The Android Open Source Project | 3 * Copyright 2011 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #ifndef SkScan_DEFINED | 10 #ifndef SkScan_DEFINED |
| 11 #define SkScan_DEFINED | 11 #define SkScan_DEFINED |
| 12 | 12 |
| 13 #include "SkRect.h" | 13 #include "SkRect.h" |
| 14 | 14 |
| 15 class SkRasterClip; | 15 class SkRasterClip; |
| 16 class SkRegion; | 16 class SkRegion; |
| 17 class SkBlitter; | 17 class SkBlitter; |
| 18 class SkPath; | 18 class SkPath; |
| 19 | 19 |
| 20 /** Defines a fixed-point rectangle, identical to the integer SkIRect, but its | 20 /** Defines a fixed-point rectangle, identical to the integer SkIRect, but its |
| 21 coordinates are treated as SkFixed rather than int32_t. | 21 coordinates are treated as SkFixed rather than int32_t. |
| 22 */ | 22 */ |
| 23 typedef SkIRect SkXRect; | 23 typedef SkIRect SkXRect; |
| 24 | 24 |
| 25 class SkScan { | 25 class SkScan { |
| 26 public: | 26 public: |
| 27 /* |
| 28 * Draws count-1 line segments, one at a time: |
| 29 * line(pts[0], pts[1]) |
| 30 * line(pts[1], pts[2]) |
| 31 * line(......, pts[count - 1]) |
| 32 */ |
| 33 typedef void (*HairRgnProc)(const SkPoint[], int count, const SkRegion*, SkB
litter*); |
| 34 typedef void (*HairRCProc)(const SkPoint[], int count, const SkRasterClip&,
SkBlitter*); |
| 35 |
| 27 static void FillPath(const SkPath&, const SkIRect&, SkBlitter*); | 36 static void FillPath(const SkPath&, const SkIRect&, SkBlitter*); |
| 28 | 37 |
| 29 /////////////////////////////////////////////////////////////////////////// | 38 /////////////////////////////////////////////////////////////////////////// |
| 30 // rasterclip | 39 // rasterclip |
| 31 | 40 |
| 32 static void FillIRect(const SkIRect&, const SkRasterClip&, SkBlitter*); | 41 static void FillIRect(const SkIRect&, const SkRasterClip&, SkBlitter*); |
| 33 static void FillXRect(const SkXRect&, const SkRasterClip&, SkBlitter*); | 42 static void FillXRect(const SkXRect&, const SkRasterClip&, SkBlitter*); |
| 34 static void FillRect(const SkRect&, const SkRasterClip&, SkBlitter*); | 43 static void FillRect(const SkRect&, const SkRasterClip&, SkBlitter*); |
| 35 static void AntiFillRect(const SkRect&, const SkRasterClip&, SkBlitter*); | 44 static void AntiFillRect(const SkRect&, const SkRasterClip&, SkBlitter*); |
| 36 static void AntiFillXRect(const SkXRect&, const SkRasterClip&, SkBlitter*); | 45 static void AntiFillXRect(const SkXRect&, const SkRasterClip&, SkBlitter*); |
| 37 static void FillPath(const SkPath&, const SkRasterClip&, SkBlitter*); | 46 static void FillPath(const SkPath&, const SkRasterClip&, SkBlitter*); |
| 38 static void AntiFillPath(const SkPath&, const SkRasterClip&, SkBlitter*); | 47 static void AntiFillPath(const SkPath&, const SkRasterClip&, SkBlitter*); |
| 39 static void FrameRect(const SkRect&, const SkPoint& strokeSize, | 48 static void FrameRect(const SkRect&, const SkPoint& strokeSize, |
| 40 const SkRasterClip&, SkBlitter*); | 49 const SkRasterClip&, SkBlitter*); |
| 41 static void AntiFrameRect(const SkRect&, const SkPoint& strokeSize, | 50 static void AntiFrameRect(const SkRect&, const SkPoint& strokeSize, |
| 42 const SkRasterClip&, SkBlitter*); | 51 const SkRasterClip&, SkBlitter*); |
| 43 static void FillTriangle(const SkPoint pts[], const SkRasterClip&, SkBlitter
*); | 52 static void FillTriangle(const SkPoint pts[], const SkRasterClip&, SkBlitter
*); |
| 44 static void HairLine(SkPoint, SkPoint, const SkRasterClip&, SkBlitter*); | 53 static void HairLine(const SkPoint[], int count, const SkRasterClip&, SkBlit
ter*); |
| 45 static void AntiHairLine(SkPoint, SkPoint, const SkRasterClip&, SkBlitter*); | 54 static void AntiHairLine(const SkPoint[], int count, const SkRasterClip&, Sk
Blitter*); |
| 46 static void HairRect(const SkRect&, const SkRasterClip&, SkBlitter*); | 55 static void HairRect(const SkRect&, const SkRasterClip&, SkBlitter*); |
| 47 static void AntiHairRect(const SkRect&, const SkRasterClip&, SkBlitter*); | 56 static void AntiHairRect(const SkRect&, const SkRasterClip&, SkBlitter*); |
| 48 static void HairPath(const SkPath&, const SkRasterClip&, SkBlitter*); | 57 static void HairPath(const SkPath&, const SkRasterClip&, SkBlitter*); |
| 49 static void AntiHairPath(const SkPath&, const SkRasterClip&, SkBlitter*); | 58 static void AntiHairPath(const SkPath&, const SkRasterClip&, SkBlitter*); |
| 50 | 59 |
| 51 private: | 60 private: |
| 52 friend class SkAAClip; | 61 friend class SkAAClip; |
| 53 friend class SkRegion; | 62 friend class SkRegion; |
| 54 | 63 |
| 55 static void FillIRect(const SkIRect&, const SkRegion* clip, SkBlitter*); | 64 static void FillIRect(const SkIRect&, const SkRegion* clip, SkBlitter*); |
| 56 static void FillXRect(const SkXRect&, const SkRegion* clip, SkBlitter*); | 65 static void FillXRect(const SkXRect&, const SkRegion* clip, SkBlitter*); |
| 57 static void FillRect(const SkRect&, const SkRegion* clip, SkBlitter*); | 66 static void FillRect(const SkRect&, const SkRegion* clip, SkBlitter*); |
| 58 static void AntiFillRect(const SkRect&, const SkRegion* clip, SkBlitter*); | 67 static void AntiFillRect(const SkRect&, const SkRegion* clip, SkBlitter*); |
| 59 static void AntiFillXRect(const SkXRect&, const SkRegion*, SkBlitter*); | 68 static void AntiFillXRect(const SkXRect&, const SkRegion*, SkBlitter*); |
| 60 static void FillPath(const SkPath&, const SkRegion& clip, SkBlitter*); | 69 static void FillPath(const SkPath&, const SkRegion& clip, SkBlitter*); |
| 61 static void AntiFillPath(const SkPath&, const SkRegion& clip, SkBlitter*, | 70 static void AntiFillPath(const SkPath&, const SkRegion& clip, SkBlitter*, |
| 62 bool forceRLE = false); | 71 bool forceRLE = false); |
| 63 static void FillTriangle(const SkPoint pts[], const SkRegion*, SkBlitter*); | 72 static void FillTriangle(const SkPoint pts[], const SkRegion*, SkBlitter*); |
| 64 | 73 |
| 65 static void AntiFrameRect(const SkRect&, const SkPoint& strokeSize, | 74 static void AntiFrameRect(const SkRect&, const SkPoint& strokeSize, |
| 66 const SkRegion*, SkBlitter*); | 75 const SkRegion*, SkBlitter*); |
| 67 static void HairLineRgn(SkPoint, SkPoint, const SkRegion*, SkBlitter*); | 76 static void HairLineRgn(const SkPoint[], int count, const SkRegion*, SkBlitt
er*); |
| 68 static void AntiHairLineRgn(SkPoint, SkPoint, const SkRegion*, SkBlitter*); | 77 static void AntiHairLineRgn(const SkPoint[], int count, const SkRegion*, SkB
litter*); |
| 69 }; | 78 }; |
| 70 | 79 |
| 71 /** Assign an SkXRect from a SkIRect, by promoting the src rect's coordinates | 80 /** Assign an SkXRect from a SkIRect, by promoting the src rect's coordinates |
| 72 from int to SkFixed. Does not check for overflow if the src coordinates | 81 from int to SkFixed. Does not check for overflow if the src coordinates |
| 73 exceed 32K | 82 exceed 32K |
| 74 */ | 83 */ |
| 75 static inline void XRect_set(SkXRect* xr, const SkIRect& src) { | 84 static inline void XRect_set(SkXRect* xr, const SkIRect& src) { |
| 76 xr->fLeft = SkIntToFixed(src.fLeft); | 85 xr->fLeft = SkIntToFixed(src.fLeft); |
| 77 xr->fTop = SkIntToFixed(src.fTop); | 86 xr->fTop = SkIntToFixed(src.fTop); |
| 78 xr->fRight = SkIntToFixed(src.fRight); | 87 xr->fRight = SkIntToFixed(src.fRight); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 103 for right/bottom), and store the result in the SkIRect. | 112 for right/bottom), and store the result in the SkIRect. |
| 104 */ | 113 */ |
| 105 static inline void XRect_roundOut(const SkXRect& xr, SkIRect* dst) { | 114 static inline void XRect_roundOut(const SkXRect& xr, SkIRect* dst) { |
| 106 dst->fLeft = SkFixedFloorToInt(xr.fLeft); | 115 dst->fLeft = SkFixedFloorToInt(xr.fLeft); |
| 107 dst->fTop = SkFixedFloorToInt(xr.fTop); | 116 dst->fTop = SkFixedFloorToInt(xr.fTop); |
| 108 dst->fRight = SkFixedCeilToInt(xr.fRight); | 117 dst->fRight = SkFixedCeilToInt(xr.fRight); |
| 109 dst->fBottom = SkFixedCeilToInt(xr.fBottom); | 118 dst->fBottom = SkFixedCeilToInt(xr.fBottom); |
| 110 } | 119 } |
| 111 | 120 |
| 112 #endif | 121 #endif |
| OLD | NEW |