aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects/Sk2DPathEffect.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-09 19:18:02 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-09 19:18:02 +0000
commit6db9375b4f695c68a4e56e38bcd70f983440c2d5 (patch)
treeff612a51a52e5e9f8dd72d649597c8563638c04e /src/effects/Sk2DPathEffect.cpp
parent59823f7f3ba43c7c6bc1fa8c600b093ecb4236aa (diff)
use SkRegion instead of SkScan/SkBlitter, as we want to privatize the latter
git-svn-id: http://skia.googlecode.com/svn/trunk@5037 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/effects/Sk2DPathEffect.cpp')
-rw-r--r--src/effects/Sk2DPathEffect.cpp35
1 files changed, 14 insertions, 21 deletions
diff --git a/src/effects/Sk2DPathEffect.cpp b/src/effects/Sk2DPathEffect.cpp
index 1a09a92d6b..a9a239f3c1 100644
--- a/src/effects/Sk2DPathEffect.cpp
+++ b/src/effects/Sk2DPathEffect.cpp
@@ -8,25 +8,9 @@
#include "Sk2DPathEffect.h"
-#include "SkBlitter.h"
#include "SkFlattenableBuffers.h"
#include "SkPath.h"
-#include "SkScan.h"
-
-class Sk2DPathEffectBlitter : public SkBlitter {
-public:
- Sk2DPathEffectBlitter(Sk2DPathEffect* pe, SkPath* dst)
- : fPE(pe), fDst(dst) {}
-
- virtual void blitH(int x, int y, int count) {
- fPE->nextSpan(x, y, count, fDst);
- }
-private:
- Sk2DPathEffect* fPE;
- SkPath* fDst;
-};
-
-///////////////////////////////////////////////////////////////////////////////
+#include "SkRegion.h"
Sk2DPathEffect::Sk2DPathEffect(const SkMatrix& mat) : fMatrix(mat) {
fMatrixIsInvertible = mat.invert(&fInverse);
@@ -37,15 +21,24 @@ bool Sk2DPathEffect::filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*) {
return false;
}
- Sk2DPathEffectBlitter blitter(this, dst);
- SkPath tmp;
- SkIRect ir;
+ SkPath tmp;
+ SkIRect ir;
src.transform(fInverse, &tmp);
tmp.getBounds().round(&ir);
if (!ir.isEmpty()) {
this->begin(ir, dst);
- SkScan::FillPath(tmp, ir, &blitter);
+
+ SkRegion rgn;
+ rgn.setPath(tmp, SkRegion(ir));
+ SkRegion::Iterator iter(rgn);
+ for (; !iter.done(); iter.next()) {
+ const SkIRect& rect = iter.rect();
+ for (int y = rect.fTop; y < rect.fBottom; ++y) {
+ this->nextSpan(rect.fLeft, y, rect.width(), dst);
+ }
+ }
+
this->end(dst);
}
return true;