aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/BitmapRectBench.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-15 20:21:19 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-15 20:21:19 +0000
commit93182311781e79a6883b356bf2669c389878f9e5 (patch)
tree0c454c0993d4c805f1ffd5ebf2d4eef911837bb0 /bench/BitmapRectBench.cpp
parent76f9e938df0b5826fd4c80b854ceafaf385cfbe1 (diff)
add benches for drawBitmapRectToRect with slight scale/translate
git-svn-id: http://skia.googlecode.com/svn/trunk@7202 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'bench/BitmapRectBench.cpp')
-rw-r--r--bench/BitmapRectBench.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/bench/BitmapRectBench.cpp b/bench/BitmapRectBench.cpp
index f2f9e4c395..0b2154dc1f 100644
--- a/bench/BitmapRectBench.cpp
+++ b/bench/BitmapRectBench.cpp
@@ -41,14 +41,16 @@ static void drawIntoBitmap(const SkBitmap& bm) {
class BitmapRectBench : public SkBenchmark {
SkBitmap fBitmap;
bool fDoFilter;
+ bool fSlightMatrix;
uint8_t fAlpha;
SkString fName;
SkRect fSrcR, fDstR;
enum { N = SkBENCHLOOP(300) };
public:
- BitmapRectBench(void* param, U8CPU alpha, bool doFilter) : INHERITED(param) {
+ BitmapRectBench(void* param, U8CPU alpha, bool doFilter, bool slightMatrix) : INHERITED(param) {
fAlpha = SkToU8(alpha);
fDoFilter = doFilter;
+ fSlightMatrix = slightMatrix;
const int w = 128;
const int h = 128;
@@ -61,11 +63,22 @@ public:
fSrcR.iset(0, 0, w, h);
fDstR.iset(0, 0, w, h);
+
+ if (slightMatrix) {
+ // want fractional translate
+ fDstR.offset(SK_Scalar1 / 3, SK_Scalar1 * 5 / 7);
+ // want enough to create a scale matrix, but not enough to scare
+ // off our sniffer which tries to see if the matrix is "effectively"
+ // translate-only.
+ fDstR.fRight += SK_Scalar1 / (w * 60);
+ }
}
protected:
virtual const char* onGetName() {
- fName.printf("bitmaprect_%02X_%sfilter", fAlpha, fDoFilter ? "" : "no");
+ fName.printf("bitmaprect_%02X_%sfilter_%s",
+ fAlpha, fDoFilter ? "" : "no",
+ fSlightMatrix ? "trans" : "identity");
return fName.c_str();
}
@@ -86,8 +99,11 @@ private:
typedef SkBenchmark INHERITED;
};
-DEF_BENCH(return new BitmapRectBench(p, 0xFF, false))
-DEF_BENCH(return new BitmapRectBench(p, 0x80, false))
-DEF_BENCH(return new BitmapRectBench(p, 0xFF, true))
-DEF_BENCH(return new BitmapRectBench(p, 0x80, true))
+DEF_BENCH(return new BitmapRectBench(p, 0xFF, false, false))
+DEF_BENCH(return new BitmapRectBench(p, 0x80, false, false))
+DEF_BENCH(return new BitmapRectBench(p, 0xFF, true, false))
+DEF_BENCH(return new BitmapRectBench(p, 0x80, true, false))
+
+DEF_BENCH(return new BitmapRectBench(p, 0xFF, false, true))
+DEF_BENCH(return new BitmapRectBench(p, 0xFF, true, true))