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

Unified Diff: gm/downsamplebitmap.cpp

Issue 20373002: clean up printf usage in gm (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Clean up printf usage in recent gms Created 7 years, 5 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 | gm/filterbitmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/downsamplebitmap.cpp
diff --git a/gm/downsamplebitmap.cpp b/gm/downsamplebitmap.cpp
index b2cf0a93a60e94f877b1148c90523c679a0cbfdc..034538c15c08bbe8864f5820a66b3be34d9a7e38 100644
--- a/gm/downsamplebitmap.cpp
+++ b/gm/downsamplebitmap.cpp
@@ -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:
« no previous file with comments | « no previous file | gm/filterbitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698