From 1db89dc9a5ffa52e2f4206e9a52b334451c37465 Mon Sep 17 00:00:00 2001 From: "reed@android.com" Date: Mon, 8 Mar 2010 22:00:55 +0000 Subject: [PATCH] update tests for blitrow git-svn-id: http://skia.googlecode.com/svn/trunk@524 2bbb7eff-a529-9590-31e7-b0007b416f81 --- tests/BlitRowTest.cpp | 24 +++++++++++++++++++----- tests/{testmain.cpp => skia_test.cpp} | 0 tests/tests_files.mk | 2 +- 3 files changed, 20 insertions(+), 6 deletions(-) rename tests/{testmain.cpp => skia_test.cpp} (100%) diff --git a/tests/BlitRowTest.cpp b/tests/BlitRowTest.cpp index 3b0c94e226..e191912e97 100644 --- a/tests/BlitRowTest.cpp +++ b/tests/BlitRowTest.cpp @@ -116,7 +116,10 @@ static void TestBlitRow(skiatest::Reporter* reporter) { { 0xFFFFFFFF, 0, SkPackARGB32(0xFF, 0xFF, 0xFF, 0xFF), 0xFFFF, 0xFF }, { 0xFFFFFFFF, 0xFFFFFFFF, SkPackARGB32(0xFF, 0xFF, 0xFF, 0xFF), 0xFFFF, 0xFF }, }; - + + SkPaint paint; + paint.setDither(true); + SkBitmap srcBM; srcBM.setConfig(SkBitmap::kARGB_8888_Config, W, 1); srcBM.allocPixels(); @@ -131,10 +134,21 @@ static void TestBlitRow(skiatest::Reporter* reporter) { srcBM.eraseColor(gSrcRec[j].fSrc); dstBM.eraseColor(gSrcRec[j].fDst); - canvas.drawBitmap(srcBM, 0, 0, NULL); - if (!check_color(dstBM, gSrcRec[j].fResult32, gSrcRec[j].fResult16, - gSrcRec[j].fResult8, reporter)) { - SkDebugf("--- src index %d\n", j); + for (int k = 0; k < 4; k++) { + bool dither = (k & 1) != 0; + bool blend = (k & 2) != 0; + if (gSrcRec[j].fSrc != 0 && blend) { + // can't make a numerical promise about blending anything + // but 0 + continue; + } + paint.setDither(dither); + paint.setAlpha(blend ? 0x80 : 0xFF); + canvas.drawBitmap(srcBM, 0, 0, &paint); + if (!check_color(dstBM, gSrcRec[j].fResult32, gSrcRec[j].fResult16, + gSrcRec[j].fResult8, reporter)) { + SkDebugf("--- src index %d dither %d blend %d\n", j, dither, blend); + } } } } diff --git a/tests/testmain.cpp b/tests/skia_test.cpp similarity index 100% rename from tests/testmain.cpp rename to tests/skia_test.cpp diff --git a/tests/tests_files.mk b/tests/tests_files.mk index c581536373..1850494b2f 100644 --- a/tests/tests_files.mk +++ b/tests/tests_files.mk @@ -20,4 +20,4 @@ SOURCE := \ PathMeasureTest.cpp \ TriangulationTest.cpp \ TestSize.cpp \ - testmain.cpp + skia_test.cpp -- 2.34.1