Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(752)

Unified Diff: bench/GameBench.cpp

Issue 15167005: Add aligned case to game bench (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)); )
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698