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:
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:
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:
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:
this->setBGColor(0xFFDDDDDD);
}
- void setName(const char name[]) {
- fName.set(name);
- }
-
protected:
virtual SkString onShortName() SK_OVERRIDE {
return fName;
FilterBitmapTextGM(float textSize)
: fTextSize(textSize)
{
- char name[1024];
- sprintf(name, "filterbitmap_text_%.2fpt", fTextSize);
- setName(name);
+ fName.printf("filterbitmap_text_%.2fpt", fTextSize);
}
protected:
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:
FilterBitmapImageGM(const char filename[])
: fFilename(filename)
{
- char name[1024];
- sprintf(name, "filterbitmap_image_%s", filename);
- setName(name);
+ fName.printf("filterbitmap_image_%s", filename);
}
protected: