clean up printf usage in gm

BUG=
R=reed@google.com

Review URL: https://codereview.chromium.org/20373002

git-svn-id: http://skia.googlecode.com/svn/trunk@10370 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
humper@google.com 2013-07-25 19:14:37 +00:00
parent f9ed6fe6c5
commit e2cf805e9a
2 changed files with 11 additions and 39 deletions

View File

@ -32,23 +32,11 @@ public:
fBitmapMade = false;
}
void setName(const char name[]) {
fName.set(name);
}
const char *filterLevelToString() {
switch(fFilterLevel) {
case SkPaint::kNone_FilterLevel:
return "none";
case SkPaint::kLow_FilterLevel:
return "low";
case SkPaint::kMedium_FilterLevel:
return "medium";
case SkPaint::kHigh_FilterLevel:
return "high";
default:
return "unknown";
}
const char* filterLevelToString() {
static const char *filterLevelNames[] = {
"none", "low", "medium", "high"
};
return filterLevelNames[fFilterLevel];
}
protected:
@ -104,9 +92,7 @@ class DownsampleBitmapTextGM: public DownsampleBitmapGM {
DownsampleBitmapTextGM(float textSize, SkPaint::FilterLevel filterLevel)
: INHERITED(filterLevel), fTextSize(textSize)
{
char name[1024];
sprintf(name, "downsamplebitmap_text_%s_%.2fpt", this->filterLevelToString(), fTextSize);
setName(name);
fName.printf("downsamplebitmap_text_%s_%.2fpt", this->filterLevelToString(), fTextSize);
}
protected:
@ -141,9 +127,7 @@ class DownsampleBitmapCheckerboardGM: public DownsampleBitmapGM {
DownsampleBitmapCheckerboardGM(int size, int numChecks, SkPaint::FilterLevel filterLevel)
: INHERITED(filterLevel), fSize(size), fNumChecks(numChecks)
{
char name[1024];
sprintf(name, "downsamplebitmap_checkerboard_%s_%d_%d", this->filterLevelToString(), fSize, fNumChecks);
setName(name);
fName.printf("downsamplebitmap_checkerboard_%s_%d_%d", this->filterLevelToString(), fSize, fNumChecks);
}
protected:
@ -176,9 +160,7 @@ class DownsampleBitmapImageGM: public DownsampleBitmapGM {
DownsampleBitmapImageGM(const char filename[], SkPaint::FilterLevel filterLevel)
: INHERITED(filterLevel), fFilename(filename)
{
char name[1024];
sprintf(name, "downsamplebitmap_image_%s_%s", this->filterLevelToString(), filename);
setName(name);
fName.printf("downsamplebitmap_image_%s_%s", this->filterLevelToString(), filename);
}
protected:

View File

@ -64,10 +64,6 @@ public:
this->setBGColor(0xFFDDDDDD);
}
void setName(const char name[]) {
fName.set(name);
}
protected:
virtual SkString onShortName() SK_OVERRIDE {
return fName;
@ -102,9 +98,7 @@ class FilterBitmapTextGM: public FilterBitmapGM {
FilterBitmapTextGM(float textSize)
: fTextSize(textSize)
{
char name[1024];
sprintf(name, "filterbitmap_text_%.2fpt", fTextSize);
setName(name);
fName.printf("filterbitmap_text_%.2fpt", fTextSize);
}
protected:
@ -143,9 +137,7 @@ class FilterBitmapCheckerboardGM: public FilterBitmapGM {
FilterBitmapCheckerboardGM(int size, int num_checks)
: fSize(size), fNumChecks(num_checks)
{
char name[1024];
sprintf(name, "filterbitmap_checkerboard_%d_%d", fSize, fNumChecks);
setName(name);
fName.printf("filterbitmap_checkerboard_%d_%d", fSize, fNumChecks);
}
protected:
@ -182,9 +174,7 @@ class FilterBitmapImageGM: public FilterBitmapGM {
FilterBitmapImageGM(const char filename[])
: fFilename(filename)
{
char name[1024];
sprintf(name, "filterbitmap_image_%s", filename);
setName(name);
fName.printf("filterbitmap_image_%s", filename);
}
protected: