Index: bench/GameBench.cpp |
=================================================================== |
--- bench/GameBench.cpp (revision 9137) |
+++ bench/GameBench.cpp (working copy) |
@@ -22,10 +22,11 @@ |
kRotate_Type |
}; |
- GameBench(void* param, Type type, bool partialClear) |
+ GameBench(void* param, Type type, bool partialClear, bool aligned = false) |
: INHERITED(param) |
, fType(type) |
, fPartialClear(partialClear) |
+ , fAligned(aligned) |
, fName("game") |
, fNumSaved(0) |
, fInitialized(false) { |
@@ -42,6 +43,10 @@ |
break; |
}; |
+ if (aligned) { |
+ fName.append("_aligned"); |
+ } |
+ |
if (partialClear) { |
fName.append("_partial"); |
} else { |
@@ -130,6 +135,11 @@ |
fSaved[fNumSaved][0] = transRand.nextRangeScalar(0.0f, maxTransX); |
fSaved[fNumSaved][1] = transRand.nextRangeScalar(0.0f, maxTransY); |
+ if (fAligned) { |
+ // make the translations integer aligned |
+ fSaved[fNumSaved][0] = SkScalarFloorToScalar(fSaved[fNumSaved][0]); |
+ fSaved[fNumSaved][1] = SkScalarFloorToScalar(fSaved[fNumSaved][1]); |
+ } |
mat.setTranslate(fSaved[fNumSaved][0], fSaved[fNumSaved][1]); |
@@ -160,6 +170,7 @@ |
Type fType; |
bool fPartialClear; |
+ bool fAligned; |
SkString fName; |
int fNumSaved; // num draws stored in 'fSaved' |
bool fInitialized; |
@@ -197,9 +208,11 @@ |
// Partial clear |
DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kScale_Type, false)); ) |
DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kTranslate_Type, false)); ) |
+DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kTranslate_Type, false, true)); ) |
DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kRotate_Type, false)); ) |
// Full clear |
DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kScale_Type, true)); ) |
DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kTranslate_Type, true)); ) |
+DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kTranslate_Type, true, true)); ) |
DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kRotate_Type, true)); ) |