Chromium Code Reviews| Index: bench/BitmapRectBench.cpp |
| =================================================================== |
| --- bench/BitmapRectBench.cpp (revision 10404) |
| +++ bench/BitmapRectBench.cpp (working copy) |
| @@ -45,6 +45,8 @@ |
| uint8_t fAlpha; |
| SkString fName; |
| SkRect fSrcR, fDstR; |
|
robertphillips
2013/07/29 11:57:10
kWidth, kHeight
|
| + static const int w = 128; |
| + static const int h = 128; |
| enum { N = SkBENCHLOOP(300) }; |
| public: |
| BitmapRectBench(void* param, U8CPU alpha, bool doFilter, bool slightMatrix) : INHERITED(param) { |
| @@ -52,10 +54,18 @@ |
| fDoFilter = doFilter; |
| fSlightMatrix = slightMatrix; |
| - const int w = 128; |
| - const int h = 128; |
| + fBitmap.setConfig(SkBitmap::kARGB_8888_Config, w, h); |
| + } |
| - fBitmap.setConfig(SkBitmap::kARGB_8888_Config, w, h); |
| +protected: |
|
robertphillips
2013/07/29 11:57:10
SK_OVERRIDE
|
| + virtual const char* onGetName() { |
| + fName.printf("bitmaprect_%02X_%sfilter_%s", |
| + fAlpha, fDoFilter ? "" : "no", |
| + fSlightMatrix ? "trans" : "identity"); |
| + return fName.c_str(); |
| + } |
| + |
|
robertphillips
2013/07/29 11:57:10
SK_OVERRIDE
|
| + virtual void onPreDraw() { |
| fBitmap.allocPixels(); |
| fBitmap.setIsOpaque(true); |
| fBitmap.eraseColor(SK_ColorBLACK); |
|
robertphillips
2013/07/29 11:57:10
rename to draw_into_bitmap
|
| @@ -64,7 +74,7 @@ |
| fSrcR.iset(0, 0, w, h); |
| fDstR.iset(0, 0, w, h); |
| - if (slightMatrix) { |
| + if (fSlightMatrix) { |
| // want fractional translate |
| fDstR.offset(SK_Scalar1 / 3, SK_Scalar1 * 5 / 7); |
| // want enough to create a scale matrix, but not enough to scare |
| @@ -74,13 +84,6 @@ |
| } |
| } |
| -protected: |
| - virtual const char* onGetName() { |
| - fName.printf("bitmaprect_%02X_%sfilter_%s", |
| - fAlpha, fDoFilter ? "" : "no", |
| - fSlightMatrix ? "trans" : "identity"); |
| - return fName.c_str(); |
| - } |
|
robertphillips
2013/07/29 11:57:10
SK_OVERRIDE
|
| virtual void onDraw(SkCanvas* canvas) { |
| SkRandom rand; |