add unittest for IntersectLine, used by hairlines
git-svn-id: http://skia.googlecode.com/svn/trunk@447 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/samplecode/SampleHairline.cpp b/samplecode/SampleHairline.cpp
index 9b6bcd5..6c2fc43 100644
--- a/samplecode/SampleHairline.cpp
+++ b/samplecode/SampleHairline.cpp
@@ -181,12 +181,14 @@
}
class HairlineView : public SkView {
+ SkMSec fNow;
int fProcIndex;
bool fDoAA;
public:
HairlineView() {
fProcIndex = 0;
fDoAA = true;
+ fNow = 0;
}
protected:
@@ -218,7 +220,9 @@
virtual void onDraw(SkCanvas* canvas) {
this->drawBG(canvas);
- if (true) {
+ gRand.setSeed(fNow);
+
+ if (false) {
test_chromium_9005();
}
@@ -242,15 +246,19 @@
bm2.eraseColor(0);
gProcs[fProcIndex].fProc(&c2, paint, bm);
canvas->drawBitmap(bm2, SkIntToScalar(10), SkIntToScalar(10), NULL);
-
- fCounter += 1;
- fDoAA = !fDoAA;
- if (fCounter > 50) {
- fProcIndex = cycle_hairproc_index(fProcIndex);
- // todo: signal that we want to rebuild our TITLE
- fCounter = 0;
+
+ SkMSec now = SampleCode::GetAnimTime();
+ if (fNow != now) {
+ fNow = now;
+ fCounter += 1;
+ fDoAA = !fDoAA;
+ if (fCounter > 50) {
+ fProcIndex = cycle_hairproc_index(fProcIndex);
+ // todo: signal that we want to rebuild our TITLE
+ fCounter = 0;
+ }
+ this->inval(NULL);
}
- this->inval(NULL);
}
virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y) {