diff options
author | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-10-19 19:01:45 +0000 |
---|---|---|
committer | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-10-19 19:01:45 +0000 |
commit | 11ec186bfc67545d69d95f327b288390301cbc5e (patch) | |
tree | a4ce057f2a7db75047d6ad044e15220079b04636 | |
parent | a98a21e4ba31afaf5338a2e31b73f045027a3f13 (diff) |
add opaque -vs- alpha bitmap cases
git-svn-id: http://skia.googlecode.com/svn/trunk@393 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | bench/BitmapBench.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/bench/BitmapBench.cpp b/bench/BitmapBench.cpp index 89dfa74bc4..77e7adef59 100644 --- a/bench/BitmapBench.cpp +++ b/bench/BitmapBench.cpp @@ -92,12 +92,14 @@ static void convertToIndex666(const SkBitmap& src, SkBitmap* dst) { class BitmapBench : public SkBenchmark { SkBitmap fBitmap; SkPaint fPaint; + bool fIsOpaque; int fTileX, fTileY; // -1 means don't use shader SkString fName; enum { N = 300 }; public: - BitmapBench(void* param, SkBitmap::Config c, int tx = -1, int ty = -1) - : INHERITED(param), fTileX(tx), fTileY(ty) { + BitmapBench(void* param, bool isOpaque, SkBitmap::Config c, + int tx = -1, int ty = -1) + : INHERITED(param), fIsOpaque(isOpaque), fTileX(tx), fTileY(ty) { const int w = 128; const int h = 128; SkBitmap bm; @@ -108,7 +110,7 @@ public: bm.setConfig(c, w, h); } bm.allocPixels(); - bm.eraseColor(0); + bm.eraseColor(isOpaque ? SK_ColorBLACK : 0); drawIntoBitmap(bm); @@ -117,6 +119,11 @@ public: } else { fBitmap = bm; } + + if (fBitmap.getColorTable()) { + fBitmap.getColorTable()->setIsOpaque(isOpaque); + } + fBitmap.setIsOpaque(isOpaque); } protected: @@ -128,7 +135,8 @@ protected: fName.appendf("_%s", gTileName[fTileY]); } } - fName.appendf("_%s", gConfigName[fBitmap.config()]); + fName.appendf("_%s%s", gConfigName[fBitmap.config()], + fIsOpaque ? "" : "_A"); return fName.c_str(); } @@ -154,12 +162,18 @@ private: typedef SkBenchmark INHERITED; }; -static SkBenchmark* Fact0(void* p) { return new BitmapBench(p, SkBitmap::kARGB_8888_Config); } -static SkBenchmark* Fact1(void* p) { return new BitmapBench(p, SkBitmap::kRGB_565_Config); } -static SkBenchmark* Fact2(void* p) { return new BitmapBench(p, SkBitmap::kARGB_4444_Config); } -static SkBenchmark* Fact3(void* p) { return new BitmapBench(p, SkBitmap::kIndex8_Config); } +static SkBenchmark* Fact0(void* p) { return new BitmapBench(p, false, SkBitmap::kARGB_8888_Config); } +static SkBenchmark* Fact1(void* p) { return new BitmapBench(p, true, SkBitmap::kARGB_8888_Config); } +static SkBenchmark* Fact2(void* p) { return new BitmapBench(p, true, SkBitmap::kRGB_565_Config); } +static SkBenchmark* Fact3(void* p) { return new BitmapBench(p, false, SkBitmap::kARGB_4444_Config); } +static SkBenchmark* Fact4(void* p) { return new BitmapBench(p, true, SkBitmap::kARGB_4444_Config); } +static SkBenchmark* Fact5(void* p) { return new BitmapBench(p, false, SkBitmap::kIndex8_Config); } +static SkBenchmark* Fact6(void* p) { return new BitmapBench(p, true, SkBitmap::kIndex8_Config); } static BenchRegistry gReg0(Fact0); static BenchRegistry gReg1(Fact1); static BenchRegistry gReg2(Fact2); static BenchRegistry gReg3(Fact3); +static BenchRegistry gReg4(Fact4); +static BenchRegistry gReg5(Fact5); +static BenchRegistry gReg6(Fact6); |