2009-01-05 03:34:50 +00:00
|
|
|
#include "SkCanvas.h"
|
2009-01-26 23:15:37 +00:00
|
|
|
#include "SkColorPriv.h"
|
2009-01-28 00:56:29 +00:00
|
|
|
#include "SkGraphics.h"
|
2009-01-07 11:47:57 +00:00
|
|
|
#include "SkImageEncoder.h"
|
2009-03-31 03:48:49 +00:00
|
|
|
#include "SkNWayCanvas.h"
|
|
|
|
#include "SkPicture.h"
|
2009-01-05 03:34:50 +00:00
|
|
|
#include "SkString.h"
|
2009-01-19 20:08:35 +00:00
|
|
|
#include "SkTime.h"
|
2011-05-17 02:25:05 +00:00
|
|
|
#include "GrContext.h"
|
|
|
|
#include "SkGpuDevice.h"
|
|
|
|
#include "SkEGLContext.h"
|
2009-01-05 03:34:50 +00:00
|
|
|
|
|
|
|
#include "SkBenchmark.h"
|
|
|
|
|
2009-08-04 18:17:15 +00:00
|
|
|
#ifdef ANDROID
|
|
|
|
static void log_error(const char msg[]) { SkDebugf("%s", msg); }
|
|
|
|
static void log_progress(const char msg[]) { SkDebugf("%s", msg); }
|
|
|
|
#else
|
|
|
|
static void log_error(const char msg[]) { fprintf(stderr, "%s", msg); }
|
|
|
|
static void log_progress(const char msg[]) { printf("%s", msg); }
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static void log_error(const SkString& str) { log_error(str.c_str()); }
|
|
|
|
static void log_progress(const SkString& str) { log_progress(str.c_str()); }
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2009-03-31 03:48:49 +00:00
|
|
|
static void erase(SkBitmap& bm) {
|
|
|
|
if (bm.config() == SkBitmap::kA8_Config) {
|
|
|
|
bm.eraseColor(0);
|
|
|
|
} else {
|
|
|
|
bm.eraseColor(SK_ColorWHITE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-05-17 02:25:05 +00:00
|
|
|
#if 0
|
2009-03-31 03:48:49 +00:00
|
|
|
static bool equal(const SkBitmap& bm1, const SkBitmap& bm2) {
|
|
|
|
if (bm1.width() != bm2.width() ||
|
|
|
|
bm1.height() != bm2.height() ||
|
|
|
|
bm1.config() != bm2.config()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t pixelBytes = bm1.width() * bm1.bytesPerPixel();
|
|
|
|
for (int y = 0; y < bm1.height(); y++) {
|
|
|
|
if (memcmp(bm1.getAddr(0, y), bm2.getAddr(0, y), pixelBytes)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2011-05-17 02:25:05 +00:00
|
|
|
#endif
|
2009-03-31 03:48:49 +00:00
|
|
|
|
2009-01-05 03:34:50 +00:00
|
|
|
class Iter {
|
|
|
|
public:
|
2009-09-02 21:12:42 +00:00
|
|
|
Iter(void* param) {
|
2009-01-05 03:34:50 +00:00
|
|
|
fBench = BenchRegistry::Head();
|
2009-09-02 21:12:42 +00:00
|
|
|
fParam = param;
|
2009-01-05 03:34:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SkBenchmark* next() {
|
|
|
|
if (fBench) {
|
|
|
|
BenchRegistry::Factory f = fBench->factory();
|
|
|
|
fBench = fBench->next();
|
2009-09-02 21:12:42 +00:00
|
|
|
return f(fParam);
|
2009-01-05 03:34:50 +00:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const BenchRegistry* fBench;
|
2009-09-02 21:12:42 +00:00
|
|
|
void* fParam;
|
2009-01-05 03:34:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static void make_filename(const char name[], SkString* path) {
|
|
|
|
path->set(name);
|
|
|
|
for (int i = 0; name[i]; i++) {
|
|
|
|
switch (name[i]) {
|
|
|
|
case '/':
|
|
|
|
case '\\':
|
|
|
|
case ' ':
|
|
|
|
case ':':
|
|
|
|
path->writable_str()[i] = '-';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-21 03:15:13 +00:00
|
|
|
static void saveFile(const char name[], const char config[], const char dir[],
|
|
|
|
const SkBitmap& bm) {
|
|
|
|
SkBitmap copy;
|
|
|
|
if (!bm.copyTo(©, SkBitmap::kARGB_8888_Config)) {
|
|
|
|
return;
|
|
|
|
}
|
2009-01-26 23:15:37 +00:00
|
|
|
|
|
|
|
if (bm.config() == SkBitmap::kA8_Config) {
|
|
|
|
// turn alpha into gray-scale
|
|
|
|
size_t size = copy.getSize() >> 2;
|
|
|
|
SkPMColor* p = copy.getAddr32(0, 0);
|
|
|
|
for (size_t i = 0; i < size; i++) {
|
|
|
|
int c = (*p >> SK_A32_SHIFT) & 0xFF;
|
|
|
|
c = 255 - c;
|
|
|
|
c |= (c << 24) | (c << 16) | (c << 8);
|
|
|
|
*p++ = c | (SK_A32_MASK << SK_A32_SHIFT);
|
|
|
|
}
|
|
|
|
}
|
2009-01-21 03:15:13 +00:00
|
|
|
|
|
|
|
SkString str;
|
|
|
|
make_filename(name, &str);
|
|
|
|
str.appendf("_%s.png", config);
|
|
|
|
str.prepend(dir);
|
|
|
|
::remove(str.c_str());
|
|
|
|
SkImageEncoder::EncodeFile(str.c_str(), copy, SkImageEncoder::kPNG_Type,
|
|
|
|
100);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void performClip(SkCanvas* canvas, int w, int h) {
|
|
|
|
SkRect r;
|
|
|
|
|
|
|
|
r.set(SkIntToScalar(10), SkIntToScalar(10),
|
|
|
|
SkIntToScalar(w*2/3), SkIntToScalar(h*2/3));
|
|
|
|
canvas->clipRect(r, SkRegion::kIntersect_Op);
|
|
|
|
|
|
|
|
r.set(SkIntToScalar(w/3), SkIntToScalar(h/3),
|
|
|
|
SkIntToScalar(w-10), SkIntToScalar(h-10));
|
|
|
|
canvas->clipRect(r, SkRegion::kXOR_Op);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void performRotate(SkCanvas* canvas, int w, int h) {
|
|
|
|
const SkScalar x = SkIntToScalar(w) / 2;
|
|
|
|
const SkScalar y = SkIntToScalar(h) / 2;
|
|
|
|
|
|
|
|
canvas->translate(x, y);
|
|
|
|
canvas->rotate(SkIntToScalar(35));
|
|
|
|
canvas->translate(-x, -y);
|
|
|
|
}
|
|
|
|
|
2009-08-04 01:51:09 +00:00
|
|
|
static void performScale(SkCanvas* canvas, int w, int h) {
|
|
|
|
const SkScalar x = SkIntToScalar(w) / 2;
|
|
|
|
const SkScalar y = SkIntToScalar(h) / 2;
|
|
|
|
|
|
|
|
canvas->translate(x, y);
|
|
|
|
// just enough so we can't take the sprite case
|
|
|
|
canvas->scale(SK_Scalar1 * 99/100, SK_Scalar1 * 99/100);
|
|
|
|
canvas->translate(-x, -y);
|
|
|
|
}
|
|
|
|
|
2009-08-04 18:17:15 +00:00
|
|
|
static bool parse_bool_arg(char * const* argv, char* const* stop, bool* var) {
|
|
|
|
if (argv < stop) {
|
|
|
|
*var = atoi(*argv) != 0;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-05-17 02:25:05 +00:00
|
|
|
enum Backend {
|
|
|
|
kRaster_Backend,
|
|
|
|
kGPU_Backend,
|
|
|
|
kPDF_Backend,
|
|
|
|
};
|
|
|
|
|
|
|
|
static SkDevice* make_device(SkBitmap::Config config, const SkIPoint& size,
|
|
|
|
Backend backend, GrContext* context) {
|
|
|
|
SkDevice* device = NULL;
|
|
|
|
SkBitmap bitmap;
|
|
|
|
bitmap.setConfig(config, size.fX, size.fY);
|
|
|
|
|
|
|
|
switch (backend) {
|
|
|
|
case kRaster_Backend:
|
|
|
|
bitmap.allocPixels();
|
|
|
|
erase(bitmap);
|
|
|
|
device = new SkDevice(NULL, bitmap, true);
|
|
|
|
break;
|
|
|
|
case kGPU_Backend:
|
|
|
|
device = new SkGpuDevice(context, bitmap, SkGpuDevice::Current3DApiRenderTarget());
|
|
|
|
// device->clear(0xFFFFFFFF);
|
|
|
|
break;
|
|
|
|
case kPDF_Backend:
|
|
|
|
default:
|
|
|
|
SkASSERT(!"unsupported");
|
|
|
|
}
|
|
|
|
return device;
|
|
|
|
}
|
|
|
|
|
2009-01-19 20:08:35 +00:00
|
|
|
static const struct {
|
|
|
|
SkBitmap::Config fConfig;
|
|
|
|
const char* fName;
|
2011-05-17 02:25:05 +00:00
|
|
|
Backend fBackend;
|
2009-01-19 20:08:35 +00:00
|
|
|
} gConfigs[] = {
|
2011-05-17 02:25:05 +00:00
|
|
|
{ SkBitmap::kARGB_8888_Config, "8888", kRaster_Backend },
|
|
|
|
{ SkBitmap::kRGB_565_Config, "565", kRaster_Backend },
|
|
|
|
{ SkBitmap::kARGB_8888_Config, "GPU", kGPU_Backend },
|
2009-01-19 20:08:35 +00:00
|
|
|
};
|
|
|
|
|
2009-01-21 03:15:13 +00:00
|
|
|
static int findConfig(const char config[]) {
|
|
|
|
for (size_t i = 0; i < SK_ARRAY_COUNT(gConfigs); i++) {
|
|
|
|
if (!strcmp(config, gConfigs[i].fName)) {
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2009-01-05 03:34:50 +00:00
|
|
|
int main (int argc, char * const argv[]) {
|
2009-01-28 00:56:29 +00:00
|
|
|
SkAutoGraphics ag;
|
|
|
|
|
2009-09-02 21:12:42 +00:00
|
|
|
SkTDict<const char*> defineDict(1024);
|
2009-01-19 20:08:35 +00:00
|
|
|
int repeatDraw = 1;
|
|
|
|
int forceAlpha = 0xFF;
|
|
|
|
bool forceAA = true;
|
2009-08-04 18:17:15 +00:00
|
|
|
bool forceFilter = false;
|
2009-10-19 17:39:46 +00:00
|
|
|
SkTriState::State forceDither = SkTriState::kDefault;
|
2009-08-04 01:51:09 +00:00
|
|
|
bool doScale = false;
|
2009-01-21 03:15:13 +00:00
|
|
|
bool doRotate = false;
|
|
|
|
bool doClip = false;
|
2009-08-04 01:51:09 +00:00
|
|
|
const char* matchStr = NULL;
|
2010-04-27 15:47:34 +00:00
|
|
|
bool hasStrokeWidth = false;
|
|
|
|
float strokeWidth;
|
2009-01-19 20:08:35 +00:00
|
|
|
|
2009-01-07 11:47:57 +00:00
|
|
|
SkString outDir;
|
2009-08-04 01:51:09 +00:00
|
|
|
SkBitmap::Config outConfig = SkBitmap::kNo_Config;
|
|
|
|
const char* configName = "";
|
2011-05-17 02:25:05 +00:00
|
|
|
Backend backend = kRaster_Backend; // for warning
|
2009-08-04 01:51:09 +00:00
|
|
|
int configCount = SK_ARRAY_COUNT(gConfigs);
|
2009-01-07 11:47:57 +00:00
|
|
|
|
|
|
|
char* const* stop = argv + argc;
|
|
|
|
for (++argv; argv < stop; ++argv) {
|
|
|
|
if (strcmp(*argv, "-o") == 0) {
|
|
|
|
argv++;
|
|
|
|
if (argv < stop && **argv) {
|
|
|
|
outDir.set(*argv);
|
|
|
|
if (outDir.c_str()[outDir.size() - 1] != '/') {
|
|
|
|
outDir.append("/");
|
|
|
|
}
|
|
|
|
}
|
2009-01-19 20:08:35 +00:00
|
|
|
} else if (strcmp(*argv, "-repeat") == 0) {
|
|
|
|
argv++;
|
|
|
|
if (argv < stop) {
|
|
|
|
repeatDraw = atoi(*argv);
|
|
|
|
if (repeatDraw < 1) {
|
|
|
|
repeatDraw = 1;
|
|
|
|
}
|
|
|
|
} else {
|
2009-08-04 18:17:15 +00:00
|
|
|
log_error("missing arg for -repeat\n");
|
2009-01-19 20:08:35 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2009-01-21 03:15:13 +00:00
|
|
|
} else if (!strcmp(*argv, "-rotate")) {
|
|
|
|
doRotate = true;
|
2009-08-04 01:51:09 +00:00
|
|
|
} else if (!strcmp(*argv, "-scale")) {
|
|
|
|
doScale = true;
|
2009-01-21 03:15:13 +00:00
|
|
|
} else if (!strcmp(*argv, "-clip")) {
|
|
|
|
doClip = true;
|
2009-01-19 20:08:35 +00:00
|
|
|
} else if (strcmp(*argv, "-forceAA") == 0) {
|
2009-08-04 18:17:15 +00:00
|
|
|
if (!parse_bool_arg(++argv, stop, &forceAA)) {
|
|
|
|
log_error("missing arg for -forceAA\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
} else if (strcmp(*argv, "-forceFilter") == 0) {
|
|
|
|
if (!parse_bool_arg(++argv, stop, &forceFilter)) {
|
|
|
|
log_error("missing arg for -forceFilter\n");
|
|
|
|
return -1;
|
|
|
|
}
|
2009-10-19 17:39:46 +00:00
|
|
|
} else if (strcmp(*argv, "-forceDither") == 0) {
|
|
|
|
bool tmp;
|
|
|
|
if (!parse_bool_arg(++argv, stop, &tmp)) {
|
|
|
|
log_error("missing arg for -forceDither\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
forceDither = tmp ? SkTriState::kTrue : SkTriState::kFalse;
|
2009-01-19 20:08:35 +00:00
|
|
|
} else if (strcmp(*argv, "-forceBlend") == 0) {
|
2009-08-04 18:17:15 +00:00
|
|
|
bool wantAlpha = false;
|
|
|
|
if (!parse_bool_arg(++argv, stop, &wantAlpha)) {
|
|
|
|
log_error("missing arg for -forceBlend\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
forceAlpha = wantAlpha ? 0x80 : 0xFF;
|
2010-04-27 15:47:34 +00:00
|
|
|
} else if (strcmp(*argv, "-strokeWidth") == 0) {
|
|
|
|
argv++;
|
|
|
|
if (argv < stop) {
|
|
|
|
const char *strokeWidthStr = *argv;
|
|
|
|
if (sscanf(strokeWidthStr, "%f", &strokeWidth) != 1) {
|
|
|
|
log_error("bad arg for -strokeWidth\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
hasStrokeWidth = true;
|
|
|
|
} else {
|
|
|
|
log_error("missing arg for -strokeWidth\n");
|
|
|
|
return -1;
|
|
|
|
}
|
2009-08-04 01:51:09 +00:00
|
|
|
} else if (strcmp(*argv, "-match") == 0) {
|
|
|
|
argv++;
|
|
|
|
if (argv < stop) {
|
|
|
|
matchStr = *argv;
|
|
|
|
} else {
|
2009-08-04 18:17:15 +00:00
|
|
|
log_error("missing arg for -match\n");
|
2009-08-04 01:51:09 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
} else if (strcmp(*argv, "-config") == 0) {
|
|
|
|
argv++;
|
|
|
|
if (argv < stop) {
|
|
|
|
int index = findConfig(*argv);
|
|
|
|
if (index >= 0) {
|
|
|
|
outConfig = gConfigs[index].fConfig;
|
|
|
|
configName = gConfigs[index].fName;
|
2011-05-17 02:25:05 +00:00
|
|
|
backend = gConfigs[index].fBackend;
|
2009-08-04 01:51:09 +00:00
|
|
|
configCount = 1;
|
|
|
|
} else {
|
2009-08-04 18:17:15 +00:00
|
|
|
SkString str;
|
|
|
|
str.printf("unrecognized config %s\n", *argv);
|
|
|
|
log_error(str);
|
2009-08-04 01:51:09 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
} else {
|
2009-08-04 18:17:15 +00:00
|
|
|
log_error("missing arg for -config\n");
|
2009-08-04 01:51:09 +00:00
|
|
|
return -1;
|
2009-01-21 03:15:13 +00:00
|
|
|
}
|
2010-02-22 19:50:13 +00:00
|
|
|
} else if (strlen(*argv) > 2 && strncmp(*argv, "-D", 2) == 0) {
|
2009-09-02 21:12:42 +00:00
|
|
|
argv++;
|
2010-02-22 19:50:13 +00:00
|
|
|
if (argv < stop) {
|
2009-09-02 21:12:42 +00:00
|
|
|
defineDict.set(argv[-1] + 2, *argv);
|
|
|
|
} else {
|
|
|
|
log_error("incomplete '-Dfoo bar' definition\n");
|
|
|
|
return -1;
|
|
|
|
}
|
2009-08-04 01:51:09 +00:00
|
|
|
} else {
|
2009-08-04 18:17:15 +00:00
|
|
|
SkString str;
|
|
|
|
str.printf("unrecognized arg %s\n", *argv);
|
|
|
|
log_error(str);
|
2009-08-04 01:51:09 +00:00
|
|
|
return -1;
|
2009-01-07 11:47:57 +00:00
|
|
|
}
|
|
|
|
}
|
2009-08-04 01:51:09 +00:00
|
|
|
|
2011-04-04 14:31:36 +00:00
|
|
|
// report our current settings
|
|
|
|
{
|
|
|
|
SkString str;
|
|
|
|
str.printf("skia bench: alpha=0x%02X antialias=%d filter=%d\n",
|
|
|
|
forceAlpha, forceAA, forceFilter);
|
|
|
|
log_progress(str);
|
|
|
|
}
|
2011-05-17 02:25:05 +00:00
|
|
|
|
|
|
|
GrContext* context = NULL;
|
|
|
|
SkEGLContext eglContext;
|
|
|
|
if (eglContext.init(1024, 1024)) {
|
|
|
|
context = GrContext::CreateGLShaderContext();
|
|
|
|
}
|
|
|
|
|
2009-09-02 21:12:42 +00:00
|
|
|
Iter iter(&defineDict);
|
2009-01-05 03:34:50 +00:00
|
|
|
SkBenchmark* bench;
|
|
|
|
while ((bench = iter.next()) != NULL) {
|
2009-01-07 11:47:57 +00:00
|
|
|
SkIPoint dim = bench->getSize();
|
|
|
|
if (dim.fX <= 0 || dim.fY <= 0) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-01-19 20:08:35 +00:00
|
|
|
bench->setForceAlpha(forceAlpha);
|
|
|
|
bench->setForceAA(forceAA);
|
2009-08-04 18:17:15 +00:00
|
|
|
bench->setForceFilter(forceFilter);
|
2009-10-19 17:39:46 +00:00
|
|
|
bench->setDither(forceDither);
|
2010-04-27 15:47:34 +00:00
|
|
|
if (hasStrokeWidth) {
|
|
|
|
bench->setStrokeWidth(strokeWidth);
|
|
|
|
}
|
2009-01-19 20:08:35 +00:00
|
|
|
|
2009-08-04 01:51:09 +00:00
|
|
|
// only run benchmarks if their name contains matchStr
|
|
|
|
if (matchStr && strstr(bench->getName(), matchStr) == NULL) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-08-04 18:17:15 +00:00
|
|
|
{
|
|
|
|
SkString str;
|
2011-04-11 13:12:51 +00:00
|
|
|
str.printf("running bench [%d %d] %28s", dim.fX, dim.fY,
|
2010-02-22 19:50:13 +00:00
|
|
|
bench->getName());
|
2009-08-04 18:17:15 +00:00
|
|
|
log_progress(str);
|
|
|
|
}
|
2009-01-19 20:08:35 +00:00
|
|
|
|
|
|
|
for (int configIndex = 0; configIndex < configCount; configIndex++) {
|
|
|
|
if (configCount > 1) {
|
|
|
|
outConfig = gConfigs[configIndex].fConfig;
|
|
|
|
configName = gConfigs[configIndex].fName;
|
2011-05-17 02:25:05 +00:00
|
|
|
backend = gConfigs[configIndex].fBackend;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (kGPU_Backend == backend && NULL == context) {
|
|
|
|
continue;
|
2009-01-19 20:08:35 +00:00
|
|
|
}
|
2009-01-26 23:15:37 +00:00
|
|
|
|
2011-05-17 02:25:05 +00:00
|
|
|
SkDevice* device = make_device(outConfig, dim, backend, context);
|
|
|
|
SkCanvas canvas(device);
|
|
|
|
device->unref();
|
2009-01-26 23:15:37 +00:00
|
|
|
|
2009-01-21 03:15:13 +00:00
|
|
|
if (doClip) {
|
|
|
|
performClip(&canvas, dim.fX, dim.fY);
|
|
|
|
}
|
2009-08-04 01:51:09 +00:00
|
|
|
if (doScale) {
|
|
|
|
performScale(&canvas, dim.fX, dim.fY);
|
|
|
|
}
|
2009-01-21 03:15:13 +00:00
|
|
|
if (doRotate) {
|
|
|
|
performRotate(&canvas, dim.fX, dim.fY);
|
|
|
|
}
|
|
|
|
|
2010-12-20 18:34:17 +00:00
|
|
|
if (repeatDraw > 1) {
|
|
|
|
SkAutoCanvasRestore acr(&canvas, true);
|
|
|
|
bench->draw(&canvas);
|
|
|
|
}
|
|
|
|
|
2009-01-19 20:08:35 +00:00
|
|
|
SkMSec now = SkTime::GetMSecs();
|
|
|
|
for (int i = 0; i < repeatDraw; i++) {
|
2011-05-17 02:25:05 +00:00
|
|
|
SkAutoCanvasRestore acr(&canvas, true);
|
|
|
|
bench->draw(&canvas);
|
|
|
|
}
|
|
|
|
if (context) {
|
|
|
|
context->flush();
|
2009-01-19 20:08:35 +00:00
|
|
|
}
|
2011-05-17 02:25:05 +00:00
|
|
|
|
2009-01-19 20:08:35 +00:00
|
|
|
if (repeatDraw > 1) {
|
2010-02-22 22:03:06 +00:00
|
|
|
double duration = SkTime::GetMSecs() - now;
|
2009-08-04 18:17:15 +00:00
|
|
|
SkString str;
|
2011-04-11 13:12:51 +00:00
|
|
|
str.printf(" %4s: msecs = %5.2f", configName, duration / repeatDraw);
|
2009-08-04 18:17:15 +00:00
|
|
|
log_progress(str);
|
2009-01-19 20:08:35 +00:00
|
|
|
}
|
2009-01-21 03:15:13 +00:00
|
|
|
if (outDir.size() > 0) {
|
2011-05-17 02:25:05 +00:00
|
|
|
saveFile(bench->getName(), configName, outDir.c_str(),
|
|
|
|
device->accessBitmap(false));
|
2009-01-21 03:15:13 +00:00
|
|
|
}
|
2009-01-19 20:08:35 +00:00
|
|
|
}
|
2009-08-04 18:17:15 +00:00
|
|
|
log_progress("\n");
|
2009-01-05 03:34:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|