From 67f11b15aead838e7f52748ad3023bcabbefa9ef Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Fri, 28 Oct 2011 14:55:53 +0000 Subject: [PATCH] clean up, add test for soft-clip git-svn-id: http://skia.googlecode.com/svn/trunk@2550 2bbb7eff-a529-9590-31e7-b0007b416f81 --- samplecode/SamplePageFlip.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/samplecode/SamplePageFlip.cpp b/samplecode/SamplePageFlip.cpp index bf4b38cc94..1db0b2ad52 100644 --- a/samplecode/SamplePageFlip.cpp +++ b/samplecode/SamplePageFlip.cpp @@ -15,7 +15,7 @@ #include -#define WIDTH 200 +#define WIDTH 160 #define HEIGHT 200 static bool gDone; @@ -56,6 +56,9 @@ static void* draw_proc(void* context) { SkRect oval; oval.setEmpty(); + SkRect clipR = SkRect::MakeWH(SkIntToScalar(bm->width()), SkIntToScalar(bm->height())); + clipR.inset(SK_Scalar1/4, SK_Scalar1/4); + while (!gDone) { ref->inval(oval, true); oval.set(x, y, x + SkIntToScalar(OVALW), y + SkIntToScalar(OVALH)); @@ -67,8 +70,8 @@ static void* draw_proc(void* context) { // this must be local to the loop, since it needs to forget the pixels // its writing to after each iteration, since we do the swap SkCanvas canvas(update.bitmap()); + canvas.clipRect(clipR, SkRegion::kIntersect_Op, true); -// SkDebugf("----- dirty [%d %d %d %d]\n", dirty.getBounds().fLeft, dirty.getBounds().fTop, dirty.getBounds().width(), dirty.getBounds().height()); canvas.clipRegion(update.dirty()); canvas.drawColor(0, SkXfermode::kClear_Mode); @@ -76,25 +79,15 @@ static void* draw_proc(void* context) { } bounce(&x, &dx, WIDTH-OVALW); bounce(&y, &dy, HEIGHT-OVALH); - -#if 1 - for (int i = 0; i < 1000; i++) { - for (int j = 0; j < 10000; j++) { - SkFixedMul(j, 10); - } - } -#endif } return NULL; } static const SkBitmap::Config gConfigs[] = { SkBitmap::kARGB_8888_Config, -#if 1 SkBitmap::kRGB_565_Config, SkBitmap::kARGB_4444_Config, SkBitmap::kA8_Config -#endif }; class PageFlipView : public SampleView {