Simplify benchmark internal API.
I'm not quite sure why I wrote such a convoluted API with setLoops()/getLoops(). This replaces it with a loops argument passed to onDraw(). This CL is largely mechanical translation from the old API to the new one. MathBench used this->getLoops() outside onDraw(), which seems incorrect. I fixed it. BUG= R=djsollen@google.com Author: mtklein@google.com Review URL: https://codereview.chromium.org/99893003 git-svn-id: http://skia.googlecode.com/svn/trunk@12466 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
e3bb3bce3e
commit
3361471a35
@ -43,12 +43,12 @@ public:
|
||||
|
||||
protected:
|
||||
virtual const char* onGetName() { return fName.c_str(); }
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
|
||||
SkPaint paint;
|
||||
this->setupPaint(&paint);
|
||||
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
// jostle the clip regions each time to prevent caching
|
||||
fClipRect.offset((i % 2) == 0 ? SkIntToScalar(10) : SkIntToScalar(-10), 0);
|
||||
fClipPath.reset();
|
||||
@ -158,9 +158,9 @@ protected:
|
||||
canvas->restore();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
SkPoint offset = SkPoint::Make(0, 0);
|
||||
this->recurse(canvas, 0, offset);
|
||||
}
|
||||
@ -195,11 +195,11 @@ public:
|
||||
|
||||
protected:
|
||||
virtual const char* onGetName() { return fName.c_str(); }
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
SkPaint paint;
|
||||
this->setupPaint(&paint);
|
||||
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
SkAAClip clip;
|
||||
if (fDoPath) {
|
||||
clip.setPath(fPath, &fRegion, fDoAA);
|
||||
@ -230,8 +230,8 @@ public:
|
||||
|
||||
protected:
|
||||
virtual const char* onGetName() { return "aaclip_setregion"; }
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
SkAAClip clip;
|
||||
clip.setRegion(fRegion);
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
SkPaint paint;
|
||||
this->setupPaint(&paint);
|
||||
|
||||
@ -40,7 +40,7 @@ protected:
|
||||
SkAutoTUnref<SkImageFilter> bicubic(SkBicubicImageFilter::CreateMitchell(fScale));
|
||||
paint.setImageFilter(bicubic);
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
canvas->save();
|
||||
canvas->clipRect(r);
|
||||
canvas->drawOval(r, paint);
|
||||
|
@ -130,7 +130,7 @@ protected:
|
||||
fBitmap.setIsVolatile(fIsVolatile);
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
SkIPoint dim = this->getSize();
|
||||
SkRandom rand;
|
||||
|
||||
@ -141,7 +141,7 @@ protected:
|
||||
const SkScalar x0 = SkIntToScalar(-bitmap.width() / 2);
|
||||
const SkScalar y0 = SkIntToScalar(-bitmap.height() / 2);
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
SkScalar x = x0 + rand.nextUScalar1() * dim.fX;
|
||||
SkScalar y = y0 + rand.nextUScalar1() * dim.fY;
|
||||
|
||||
@ -221,7 +221,7 @@ protected:
|
||||
return fFullName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
SkISize dim = canvas->getDeviceSize();
|
||||
if (fFlags & kScale_Flag) {
|
||||
const SkScalar x = SkIntToScalar(dim.fWidth) / 2;
|
||||
@ -240,7 +240,7 @@ protected:
|
||||
canvas->rotate(SkIntToScalar(35));
|
||||
canvas->translate(-x, -y);
|
||||
}
|
||||
INHERITED::onDraw(canvas);
|
||||
INHERITED::onDraw(loops, canvas);
|
||||
}
|
||||
|
||||
virtual void setupPaint(SkPaint* paint) SK_OVERRIDE {
|
||||
|
@ -87,7 +87,7 @@ protected:
|
||||
}
|
||||
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkRandom rand;
|
||||
|
||||
SkPaint paint;
|
||||
@ -95,7 +95,7 @@ protected:
|
||||
paint.setFilterLevel(fFilterLevel);
|
||||
paint.setAlpha(fAlpha);
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
canvas->drawBitmapRectToRect(fBitmap, &fSrcR, fDstR, &paint);
|
||||
}
|
||||
}
|
||||
|
@ -69,13 +69,13 @@ protected:
|
||||
fMatrix.setScale( scale(), scale() );
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
SkPaint paint;
|
||||
this->setupPaint(&paint);
|
||||
|
||||
preBenchSetup();
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
doScaleImage();
|
||||
}
|
||||
}
|
||||
|
@ -52,14 +52,14 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
SkPaint paint;
|
||||
this->setupPaint(&paint);
|
||||
|
||||
paint.setAntiAlias(true);
|
||||
|
||||
SkRandom rand;
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
SkRect r = SkRect::MakeWH(rand.nextUScalar1() * 400,
|
||||
rand.nextUScalar1() * 400);
|
||||
r.offset(fRadius, fRadius);
|
||||
|
@ -41,11 +41,11 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkPaint paint;
|
||||
paint.setImageFilter(new SkBlurImageFilter(fSigmaX, fSigmaY))->unref();
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
canvas->drawBitmap(fCheckerboard, 0, 0, &paint);
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ protected:
|
||||
fName = name;
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
SkPaint paint;
|
||||
this->setupPaint(&paint);
|
||||
|
||||
@ -62,7 +62,7 @@ protected:
|
||||
|
||||
preBenchSetup(r);
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
makeBlurryRect(r);
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
SkScalarCeilToInt(fRRect.rect().height()));
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkLayerDrawLooper* looper = new SkLayerDrawLooper;
|
||||
{
|
||||
SkLayerDrawLooper::LayerInfo info;
|
||||
@ -72,7 +72,7 @@ public:
|
||||
loopedPaint.setAntiAlias(true);
|
||||
loopedPaint.setColor(SK_ColorCYAN);
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
canvas->drawRect(fRRect.rect(), dullPaint);
|
||||
canvas->drawRRect(fRRect, loopedPaint);
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
bool sizeChanged = false;
|
||||
if (canvas->getDeviceSize() != fSize) {
|
||||
fSize = canvas->getDeviceSize();
|
||||
@ -122,7 +122,7 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
for (int frame = 0; frame < this->getLoops(); ++frame) {
|
||||
for (int frame = 0; frame < loops; ++frame) {
|
||||
|
||||
canvas->clear(0xFFE0F0E0);
|
||||
|
||||
|
@ -51,16 +51,16 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
switch (fType) {
|
||||
case kChecksum_ChecksumType: {
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
volatile uint32_t result = SkChecksum::Compute(fData, sizeof(fData));
|
||||
sk_ignore_unused_variable(result);
|
||||
}
|
||||
} break;
|
||||
case kMD5_ChecksumType: {
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
SkMD5 md5;
|
||||
md5.update(reinterpret_cast<uint8_t*>(fData), sizeof(fData));
|
||||
SkMD5::Digest digest;
|
||||
@ -68,7 +68,7 @@ protected:
|
||||
}
|
||||
} break;
|
||||
case kSHA1_ChecksumType: {
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
SkSHA1 sha1;
|
||||
sha1.update(reinterpret_cast<uint8_t*>(fData), sizeof(fData));
|
||||
SkSHA1::Digest digest;
|
||||
@ -76,7 +76,7 @@ protected:
|
||||
}
|
||||
} break;
|
||||
case kMurmur3_ChecksumType: {
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
volatile uint32_t result = SkChecksum::Murmur3(fData, sizeof(fData));
|
||||
sk_ignore_unused_variable(result);
|
||||
}
|
||||
|
@ -461,14 +461,14 @@ public:
|
||||
protected:
|
||||
|
||||
virtual const char* onGetName() { return "chrome_scrollGmail"; }
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
SkDEBUGCODE(this->validateBounds(canvas));
|
||||
SkPaint paint;
|
||||
this->setupPaint(&paint);
|
||||
for (int i = 0; i < N; i++) {
|
||||
SkRect current;
|
||||
setRectangle(current, i);
|
||||
for (int j = 0; j < this->getLoops() * gmailScrollingRectSpec[i*3]; j++) {
|
||||
for (int j = 0; j < loops * gmailScrollingRectSpec[i*3]; j++) {
|
||||
canvas->drawRect(current, paint);
|
||||
}
|
||||
}
|
||||
|
@ -85,8 +85,8 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
fProc(this->getLoops(), fPaint, fText, sizeof(fText), NGLYPHS);
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
fProc(loops, fPaint, fText, sizeof(fText), NGLYPHS);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -72,12 +72,12 @@ protected:
|
||||
return isSmall() ? "colorfilter_dim_bright_small" : "colorfilter_dim_bright_large";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkRect r = getFilterRect();
|
||||
SkPaint paint;
|
||||
paint.setColor(SK_ColorRED);
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
for (float brightness = -1.0f; brightness <= 1.0f; brightness += 0.4f) {
|
||||
SkAutoTUnref<SkImageFilter> dim(make_brightness(-brightness));
|
||||
SkAutoTUnref<SkImageFilter> bright(make_brightness(brightness, dim));
|
||||
@ -102,11 +102,11 @@ protected:
|
||||
return isSmall() ? "colorfilter_bright_gray_small" : "colorfilter_bright_gray_large";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkRect r = getFilterRect();
|
||||
SkPaint paint;
|
||||
paint.setColor(SK_ColorRED);
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
SkAutoTUnref<SkImageFilter> brightness(make_brightness(0.9f));
|
||||
SkAutoTUnref<SkImageFilter> grayscale(make_grayscale(brightness));
|
||||
paint.setImageFilter(grayscale);
|
||||
@ -129,11 +129,11 @@ protected:
|
||||
return isSmall() ? "colorfilter_gray_bright_small" : "colorfilter_gray_bright_large";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkRect r = getFilterRect();
|
||||
SkPaint paint;
|
||||
paint.setColor(SK_ColorRED);
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
SkAutoTUnref<SkImageFilter> grayscale(make_grayscale());
|
||||
SkAutoTUnref<SkImageFilter> brightness(make_brightness(0.9f, grayscale));
|
||||
paint.setImageFilter(brightness);
|
||||
@ -156,11 +156,11 @@ protected:
|
||||
return isSmall() ? "colorfilter_blue_bright_small" : "colorfilter_blue_bright_large";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkRect r = getFilterRect();
|
||||
SkPaint paint;
|
||||
paint.setColor(SK_ColorRED);
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
SkAutoTUnref<SkImageFilter> blue(make_mode_blue());
|
||||
SkAutoTUnref<SkImageFilter> brightness(make_brightness(1.0f, blue));
|
||||
paint.setImageFilter(brightness);
|
||||
@ -183,11 +183,11 @@ protected:
|
||||
return isSmall() ? "colorfilter_bright_blue_small" : "colorfilter_bright_blue_large";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkRect r = getFilterRect();
|
||||
SkPaint paint;
|
||||
paint.setColor(SK_ColorRED);
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
SkAutoTUnref<SkImageFilter> brightness(make_brightness(1.0f));
|
||||
SkAutoTUnref<SkImageFilter> blue(make_mode_blue(brightness));
|
||||
paint.setImageFilter(blue);
|
||||
@ -210,11 +210,11 @@ protected:
|
||||
return isSmall() ? "colorfilter_bright_small" : "colorfilter_bright_large";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkRect r = getFilterRect();
|
||||
SkPaint paint;
|
||||
paint.setColor(SK_ColorRED);
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
SkAutoTUnref<SkImageFilter> brightness(make_brightness(1.0f));
|
||||
paint.setImageFilter(brightness);
|
||||
canvas->drawRect(r, paint);
|
||||
@ -236,11 +236,11 @@ protected:
|
||||
return isSmall() ? "colorfilter_blue_small" : "colorfilter_blue_large";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkRect r = getFilterRect();
|
||||
SkPaint paint;
|
||||
paint.setColor(SK_ColorRED);
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
SkAutoTUnref<SkImageFilter> blue(make_mode_blue());
|
||||
paint.setImageFilter(blue);
|
||||
canvas->drawRect(r, paint);
|
||||
@ -262,11 +262,11 @@ protected:
|
||||
return isSmall() ? "colorfilter_gray_small" : "colorfilter_gray_large";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkRect r = getFilterRect();
|
||||
SkPaint paint;
|
||||
paint.setColor(SK_ColorRED);
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
SkAutoTUnref<SkImageFilter> grayscale(make_grayscale());
|
||||
paint.setImageFilter(grayscale);
|
||||
canvas->drawRect(r, paint);
|
||||
@ -288,11 +288,11 @@ protected:
|
||||
return isSmall() ? "table_colorfilter_small" : "table_colorfilter_large";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkRect r = getFilterRect();
|
||||
SkPaint paint;
|
||||
paint.setColor(SK_ColorRED);
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
SkAutoTUnref<SkColorFilter> table_filter(make_table_filter());
|
||||
paint.setColorFilter(table_filter);
|
||||
canvas->drawRect(r, paint);
|
||||
@ -326,12 +326,12 @@ protected:
|
||||
return isSmall() ? "luma_colorfilter_small" : "luma_colorfilter_large";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkRect r = getFilterRect();
|
||||
SkPaint paint;
|
||||
paint.setColor(SK_ColorRED);
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
SkAutoTUnref<SkColorFilter> luma_filter(SkLumaColorFilter::Create());
|
||||
paint.setColorFilter(luma_filter);
|
||||
canvas->drawRect(r, paint);
|
||||
|
@ -24,10 +24,10 @@ public:
|
||||
|
||||
virtual const char* onGetName() SK_OVERRIDE { return fName.c_str(); }
|
||||
|
||||
virtual void onDraw(SkCanvas*) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
|
||||
const SkPMColor src = 0xAB998877, dst = 0x66334455;
|
||||
volatile SkPMColor junk = 0;
|
||||
for (int i = 0; i < 10*this->getLoops(); ++i) {
|
||||
for (int i = 0; i < 10*loops; ++i) {
|
||||
for (size_t j = 0; j <= 256; j++) {
|
||||
const unsigned scale = fScales[j];
|
||||
if (kFast && kScale) {
|
||||
|
@ -49,13 +49,13 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
if (fDrawCoverage) {
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
fDraw.drawPathCoverage(fPath, fPaint);
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
fDraw.drawPath(fPath, fPaint);
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkPaint paint;
|
||||
this->setupPaint(&paint);
|
||||
paint.setStyle(SkPaint::kStroke_Style);
|
||||
@ -82,7 +82,7 @@ protected:
|
||||
canvas->clipRect(r);
|
||||
}
|
||||
|
||||
this->handlePath(canvas, path, paint, this->getLoops());
|
||||
this->handlePath(canvas, path, paint, loops);
|
||||
}
|
||||
|
||||
virtual void handlePath(SkCanvas* canvas, const SkPath& path,
|
||||
@ -194,9 +194,9 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
|
||||
SkPath dst;
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
SkStrokeRec rec(SkStrokeRec::kHairline_InitStyle);
|
||||
|
||||
fPE->filterPath(&dst, fPath, &rec, NULL);
|
||||
@ -232,13 +232,13 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkPaint paint;
|
||||
this->setupPaint(&paint);
|
||||
paint.setStrokeWidth(fStrokeWidth);
|
||||
paint.setStrokeCap(fIsRound ? SkPaint::kRound_Cap : SkPaint::kSquare_Cap);
|
||||
paint.setPathEffect(fPE);
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
canvas->drawLine(10 * SK_Scalar1, 10 * SK_Scalar1,
|
||||
640 * SK_Scalar1, 10 * SK_Scalar1, paint);
|
||||
}
|
||||
@ -271,7 +271,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkPaint p;
|
||||
this->setupPaint(&p);
|
||||
p.setColor(SK_ColorBLACK);
|
||||
@ -285,7 +285,7 @@ protected:
|
||||
{ SkIntToScalar(640), 0 }
|
||||
};
|
||||
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
pts[0].fY = pts[1].fY = SkIntToScalar(i % 480);
|
||||
canvas->drawPoints(SkCanvas::kLines_PointMode, 2, pts, p);
|
||||
}
|
||||
@ -357,14 +357,14 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkPaint p;
|
||||
this->setupPaint(&p);
|
||||
p.setStyle(SkPaint::kStroke_Style);
|
||||
p.setStrokeWidth(fStrokeWidth);
|
||||
p.setPathEffect(fPathEffect);
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
canvas->drawPoints(SkCanvas::kLines_PointMode, 2, fPts, p);
|
||||
}
|
||||
}
|
||||
|
@ -40,8 +40,8 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
SkBitmap bm;
|
||||
SkImageDecoder::DecodeFile(FLAGS_decodeBenchFilename[0],
|
||||
&bm,
|
||||
|
@ -24,7 +24,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
SkBaseDevice *device = canvas->getDevice()->createCompatibleDevice(
|
||||
SkBitmap::kARGB_8888_Config, CANVAS_WIDTH, CANVAS_HEIGHT, false);
|
||||
|
||||
@ -32,13 +32,13 @@ protected:
|
||||
device->unref();
|
||||
|
||||
initDeferredCanvas(deferredCanvas);
|
||||
drawInDeferredCanvas(deferredCanvas);
|
||||
drawInDeferredCanvas(loops, deferredCanvas);
|
||||
finalizeDeferredCanvas(deferredCanvas);
|
||||
deferredCanvas->flush();
|
||||
}
|
||||
|
||||
virtual void initDeferredCanvas(SkDeferredCanvas* canvas) = 0;
|
||||
virtual void drawInDeferredCanvas(SkDeferredCanvas* canvas) = 0;
|
||||
virtual void drawInDeferredCanvas(const int loops, SkDeferredCanvas* canvas) = 0;
|
||||
virtual void finalizeDeferredCanvas(SkDeferredCanvas* canvas) = 0;
|
||||
|
||||
SkString fName;
|
||||
@ -76,11 +76,11 @@ protected:
|
||||
canvas->setNotificationClient(&fNotificationClient);
|
||||
}
|
||||
|
||||
virtual void drawInDeferredCanvas(SkDeferredCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void drawInDeferredCanvas(const int loops, SkDeferredCanvas* canvas) SK_OVERRIDE {
|
||||
SkRect rect;
|
||||
rect.setXYWH(0, 0, 10, 10);
|
||||
SkPaint paint;
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
canvas->save(SkCanvas::kMatrixClip_SaveFlag);
|
||||
canvas->translate(SkIntToScalar(i * 27 % CANVAS_WIDTH), SkIntToScalar(i * 13 % CANVAS_HEIGHT));
|
||||
canvas->drawRect(rect, paint);
|
||||
|
@ -31,7 +31,7 @@ protected:
|
||||
"DeferredSurfaceCopy_nonDiscardable";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
// The canvas is not actually used for this test except to provide
|
||||
// configuration information: gpu, multisampling, size, etc?
|
||||
SkImageInfo info;
|
||||
@ -55,7 +55,7 @@ protected:
|
||||
SkAutoTUnref<SkDeferredCanvas> drawingCanvas(SkDeferredCanvas::Create(surface));
|
||||
surface->unref();
|
||||
|
||||
for (int iteration = 0; iteration < this->getLoops(); iteration++) {
|
||||
for (int iteration = 0; iteration < loops; iteration++) {
|
||||
drawingCanvas->clear(0);
|
||||
SkAutoTUnref<SkImage> image(drawingCanvas->newImageSnapshot());
|
||||
SkPaint paint;
|
||||
|
@ -99,7 +99,7 @@ protected:
|
||||
return this->isSmall() ? "displacement_zero_small" : "displacement_zero_large";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkPaint paint;
|
||||
SkAutoTUnref<SkImageFilter> displ(SkNEW_ARGS(SkBitmapSource, (fCheckerboard)));
|
||||
// No displacement effect
|
||||
@ -107,7 +107,7 @@ protected:
|
||||
(SkDisplacementMapEffect::kR_ChannelSelectorType,
|
||||
SkDisplacementMapEffect::kG_ChannelSelectorType, 0.0f, displ)))->unref();
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
this->drawClippedBitmap(canvas, 0, 0, paint);
|
||||
}
|
||||
}
|
||||
@ -126,14 +126,14 @@ protected:
|
||||
return isSmall() ? "displacement_alpha_small" : "displacement_alpha_large";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkPaint paint;
|
||||
SkAutoTUnref<SkImageFilter> displ(SkNEW_ARGS(SkBitmapSource, (fCheckerboard)));
|
||||
// Displacement, with 1 alpha component (which isn't pre-multiplied)
|
||||
paint.setImageFilter(SkNEW_ARGS(SkDisplacementMapEffect,
|
||||
(SkDisplacementMapEffect::kB_ChannelSelectorType,
|
||||
SkDisplacementMapEffect::kA_ChannelSelectorType, 16.0f, displ)))->unref();
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
drawClippedBitmap(canvas, 100, 0, paint);
|
||||
}
|
||||
}
|
||||
@ -152,14 +152,14 @@ protected:
|
||||
return isSmall() ? "displacement_full_small" : "displacement_full_large";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkPaint paint;
|
||||
SkAutoTUnref<SkImageFilter> displ(SkNEW_ARGS(SkBitmapSource, (fCheckerboard)));
|
||||
// Displacement, with 2 non-alpha components
|
||||
paint.setImageFilter(SkNEW_ARGS(SkDisplacementMapEffect,
|
||||
(SkDisplacementMapEffect::kR_ChannelSelectorType,
|
||||
SkDisplacementMapEffect::kB_ChannelSelectorType, 32.0f, displ)))->unref();
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
this->drawClippedBitmap(canvas, 200, 0, paint);
|
||||
}
|
||||
}
|
||||
|
@ -39,9 +39,9 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkPaint paint;
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
paint.setColor(fColors[i % N]);
|
||||
canvas->drawRect(fRects[i % N], paint);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ protected:
|
||||
return "fontcache";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkPaint paint;
|
||||
this->setupPaint(&paint);
|
||||
paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
|
||||
@ -40,7 +40,7 @@ protected:
|
||||
const uint16_t* array = gUniqueGlyphIDs;
|
||||
while (*array != gUniqueGlyphIDs_Sentinel) {
|
||||
int count = count_glyphs(array);
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
paint.measureText(array, count * sizeof(uint16_t));
|
||||
}
|
||||
array += count + 1; // skip the sentinel
|
||||
@ -119,7 +119,7 @@ protected:
|
||||
return "fontefficiency";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
static bool gDone;
|
||||
if (gDone) {
|
||||
return;
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual const char* onGetName() { return fName.c_str(); }
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
SkPaint paint;
|
||||
this->setupPaint(&paint);
|
||||
paint.setLCDRenderText(fDoLCD);
|
||||
@ -35,7 +35,7 @@ protected:
|
||||
bool prev = gSkSuppressFontCachePurgeSpew;
|
||||
gSkSuppressFontCachePurgeSpew = true;
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
// this is critical - we want to time the creation process, so we
|
||||
// explicitly flush our cache before each run
|
||||
SkGraphics::PurgeFontCache();
|
||||
|
@ -86,7 +86,7 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkRandom scaleRand;
|
||||
SkRandom transRand;
|
||||
SkRandom rotRand;
|
||||
@ -143,7 +143,7 @@ protected:
|
||||
SkShader::kClamp_TileMode,
|
||||
SkShader::kClamp_TileMode))->unref();
|
||||
|
||||
for (int i = 0; i < this->getLoops(); ++i, ++fNumSaved) {
|
||||
for (int i = 0; i < loops; ++i, ++fNumSaved) {
|
||||
if (0 == i % kNumBeforeClear) {
|
||||
if (kPartial_Clear == fClear) {
|
||||
for (int j = 0; j < fNumSaved; ++j) {
|
||||
|
@ -41,7 +41,7 @@ protected:
|
||||
return "grmemorypool_stack";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
SkRandom r;
|
||||
enum {
|
||||
kMaxObjects = 4 * (1 << 10),
|
||||
@ -51,11 +51,11 @@ protected:
|
||||
// We delete if a random [-1, 1] fixed pt is < the thresh. Otherwise,
|
||||
// we allocate. We start allocate-biased and ping-pong to delete-biased
|
||||
SkFixed delThresh = -SK_FixedHalf;
|
||||
const int kSwitchThreshPeriod = this->getLoops() / (2 * kMaxObjects);
|
||||
const int kSwitchThreshPeriod = loops / (2 * kMaxObjects);
|
||||
int s = 0;
|
||||
|
||||
int count = 0;
|
||||
for (int i = 0; i < this->getLoops(); i++, ++s) {
|
||||
for (int i = 0; i < loops; i++, ++s) {
|
||||
if (kSwitchThreshPeriod == s) {
|
||||
delThresh = -delThresh;
|
||||
s = 0;
|
||||
@ -93,14 +93,14 @@ protected:
|
||||
return "grmemorypool_random";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
SkRandom r;
|
||||
enum {
|
||||
kMaxObjects = 4 * (1 << 10),
|
||||
};
|
||||
SkAutoTDelete<A> objects[kMaxObjects];
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
uint32_t idx = r.nextRangeU(0, kMaxObjects-1);
|
||||
if (NULL == objects[idx].get()) {
|
||||
objects[idx].reset(new A);
|
||||
@ -131,10 +131,10 @@ protected:
|
||||
return "grmemorypool_queue";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
SkRandom r;
|
||||
A* objects[M];
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
uint32_t count = r.nextRangeU(0, M-1);
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
objects[i] = new A;
|
||||
|
@ -183,10 +183,10 @@ protected:
|
||||
return "grresourcecache_add";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
GrGpu* gpu = canvas->getGrContext()->getGpu();
|
||||
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
GrResourceCache cache(CACHE_SIZE_COUNT, CACHE_SIZE_BYTES);
|
||||
populate_cache(&cache, gpu, DUPLICATE_COUNT);
|
||||
populate_cache(&cache, gpu, RESOURCE_COUNT);
|
||||
@ -219,13 +219,13 @@ protected:
|
||||
return "grresourcecache_find";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
GrGpu* gpu = canvas->getGrContext()->getGpu();
|
||||
GrResourceCache cache(CACHE_SIZE_COUNT, CACHE_SIZE_BYTES);
|
||||
populate_cache(&cache, gpu, DUPLICATE_COUNT);
|
||||
populate_cache(&cache, gpu, RESOURCE_COUNT);
|
||||
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
for (int k = 0; k < RESOURCE_COUNT; ++k) {
|
||||
check_cache_contents_or_die(&cache, k);
|
||||
}
|
||||
|
@ -203,14 +203,14 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
SkPaint paint;
|
||||
this->setupPaint(&paint);
|
||||
|
||||
paint.setShader(fShader);
|
||||
|
||||
SkRect r = { 0, 0, SkIntToScalar(W), SkIntToScalar(H) };
|
||||
for (int i = 0; i < this->getLoops() * kRepeat; i++) {
|
||||
for (int i = 0; i < loops * kRepeat; i++) {
|
||||
switch (fGeomType) {
|
||||
case kRect_GeomType:
|
||||
canvas->drawRect(r, paint);
|
||||
@ -273,7 +273,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
SkPaint paint;
|
||||
this->setupPaint(&paint);
|
||||
|
||||
@ -283,7 +283,7 @@ protected:
|
||||
{ SkIntToScalar(100), SkIntToScalar(100) },
|
||||
};
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
const int gray = i % 256;
|
||||
const int alpha = fHasAlpha ? gray : 0xFF;
|
||||
SkColor colors[] = {
|
||||
|
@ -49,7 +49,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkPaint paint(fPaint);
|
||||
this->setupPaint(&paint);
|
||||
|
||||
@ -63,7 +63,7 @@ protected:
|
||||
path.transform(m);
|
||||
}
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
canvas->drawPath(path, paint);
|
||||
}
|
||||
}
|
||||
|
@ -38,14 +38,14 @@ protected:
|
||||
return "imagecache";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
|
||||
if (fCache.getBytesUsed() == 0) {
|
||||
this->populateCache();
|
||||
}
|
||||
|
||||
SkBitmap tmp;
|
||||
// search for a miss (-1 scale)
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
(void)fCache.findAndLock(fBM, -1, -1, &tmp);
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
|
||||
#ifdef SK_DEBUG
|
||||
if (!fValid) {
|
||||
SkDebugf("stream was invalid: %s\n", fName.c_str());
|
||||
@ -61,7 +61,7 @@ protected:
|
||||
#endif
|
||||
// Decode a bunch of times
|
||||
SkBitmap bm;
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
SkDEBUGCODE(bool success =) SkImageDecoder::DecodeStream(&fStream, &bm);
|
||||
#ifdef SK_DEBUG
|
||||
if (!success) {
|
||||
|
@ -35,8 +35,8 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
int n = this->getLoops() * this->mulLoopCount();
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
int n = loops * this->mulLoopCount();
|
||||
for (int i = 0; i < n; i++) {
|
||||
this->performTest(fDst, fFx, fDx, kBuffer);
|
||||
}
|
||||
|
@ -20,12 +20,12 @@ public:
|
||||
LightingBaseBench(bool small) : fIsSmall(small) { }
|
||||
|
||||
protected:
|
||||
void draw(SkCanvas* canvas, SkImageFilter* imageFilter) const {
|
||||
void draw(const int loops, SkCanvas* canvas, SkImageFilter* imageFilter) const {
|
||||
SkRect r = fIsSmall ? SkRect::MakeWH(FILTER_WIDTH_SMALL, FILTER_HEIGHT_SMALL) :
|
||||
SkRect::MakeWH(FILTER_WIDTH_LARGE, FILTER_HEIGHT_LARGE);
|
||||
SkPaint paint;
|
||||
paint.setImageFilter(imageFilter)->unref();
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
canvas->drawRect(r, paint);
|
||||
}
|
||||
}
|
||||
@ -105,9 +105,11 @@ protected:
|
||||
return fIsSmall ? "lightingpointlitdiffuse_small" : "lightingpointlitdiffuse_large";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
draw(canvas, SkLightingImageFilter::CreatePointLitDiffuse(getPointLocation(), getWhite(),
|
||||
getSurfaceScale(), getKd()));
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
draw(loops, canvas, SkLightingImageFilter::CreatePointLitDiffuse(getPointLocation(),
|
||||
getWhite(),
|
||||
getSurfaceScale(),
|
||||
getKd()));
|
||||
}
|
||||
|
||||
private:
|
||||
@ -124,9 +126,11 @@ protected:
|
||||
return fIsSmall ? "lightingdistantlitdiffuse_small" : "lightingdistantlitdiffuse_large";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
draw(canvas, SkLightingImageFilter::CreateDistantLitDiffuse(getDistantDirection(),
|
||||
getWhite(), getSurfaceScale(), getKd()));
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
draw(loops, canvas, SkLightingImageFilter::CreateDistantLitDiffuse(getDistantDirection(),
|
||||
getWhite(),
|
||||
getSurfaceScale(),
|
||||
getKd()));
|
||||
}
|
||||
|
||||
private:
|
||||
@ -143,10 +147,14 @@ protected:
|
||||
return fIsSmall ? "lightingspotlitdiffuse_small" : "lightingspotlitdiffuse_large";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
draw(canvas, SkLightingImageFilter::CreateSpotLitDiffuse(getSpotLocation(),
|
||||
getSpotTarget(), getSpotExponent(), getCutoffAngle(), getWhite(), getSurfaceScale(),
|
||||
getKd()));
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
draw(loops, canvas, SkLightingImageFilter::CreateSpotLitDiffuse(getSpotLocation(),
|
||||
getSpotTarget(),
|
||||
getSpotExponent(),
|
||||
getCutoffAngle(),
|
||||
getWhite(),
|
||||
getSurfaceScale(),
|
||||
getKd()));
|
||||
}
|
||||
|
||||
private:
|
||||
@ -163,9 +171,12 @@ protected:
|
||||
return fIsSmall ? "lightingpointlitspecular_small" : "lightingpointlitspecular_large";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
draw(canvas, SkLightingImageFilter::CreatePointLitSpecular(getPointLocation(), getWhite(),
|
||||
getSurfaceScale(), getKs(), getShininess()));
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
draw(loops, canvas, SkLightingImageFilter::CreatePointLitSpecular(getPointLocation(),
|
||||
getWhite(),
|
||||
getSurfaceScale(),
|
||||
getKs(),
|
||||
getShininess()));
|
||||
}
|
||||
|
||||
private:
|
||||
@ -182,9 +193,12 @@ protected:
|
||||
return fIsSmall ? "lightingdistantlitspecular_small" : "lightingdistantlitspecular_large";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
draw(canvas, SkLightingImageFilter::CreateDistantLitSpecular(getDistantDirection(),
|
||||
getWhite(), getSurfaceScale(), getKs(), getShininess()));
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
draw(loops, canvas, SkLightingImageFilter::CreateDistantLitSpecular(getDistantDirection(),
|
||||
getWhite(),
|
||||
getSurfaceScale(),
|
||||
getKs(),
|
||||
getShininess()));
|
||||
}
|
||||
|
||||
private:
|
||||
@ -201,10 +215,15 @@ protected:
|
||||
return fIsSmall ? "lightingspotlitspecular_small" : "lightingspotlitspecular_large";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
draw(canvas, SkLightingImageFilter::CreateSpotLitSpecular(getSpotLocation(),
|
||||
getSpotTarget(), getSpotExponent(), getCutoffAngle(), getWhite(), getSurfaceScale(),
|
||||
getKs(), getShininess()));
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
draw(loops, canvas, SkLightingImageFilter::CreateSpotLitSpecular(getSpotLocation(),
|
||||
getSpotTarget(),
|
||||
getSpotExponent(),
|
||||
getCutoffAngle(),
|
||||
getWhite(),
|
||||
getSurfaceScale(),
|
||||
getKs(),
|
||||
getShininess()));
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -42,7 +42,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkPaint paint;
|
||||
this->setupPaint(&paint);
|
||||
|
||||
@ -50,7 +50,7 @@ protected:
|
||||
paint.setAntiAlias(fDoAA);
|
||||
paint.setStrokeWidth(fStrokeWidth);
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
canvas->drawPoints(SkCanvas::kLines_PointMode, PTS, fPts, paint);
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
const int w = fIsSmall ? FILTER_WIDTH_SMALL : FILTER_WIDTH_LARGE;
|
||||
const int h = fIsSmall ? FILTER_HEIGHT_SMALL : FILTER_HEIGHT_LARGE;
|
||||
SkPaint paint;
|
||||
@ -44,7 +44,7 @@ protected:
|
||||
SkIntToScalar(w / 2),
|
||||
SkIntToScalar(h / 2)), 100))->unref();
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
canvas->drawBitmap(fCheckerboard, 0, 0, &paint);
|
||||
}
|
||||
}
|
||||
|
@ -46,8 +46,8 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
int n = this->getLoops() * this->mulLoopCount();
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
int n = loops * this->mulLoopCount();
|
||||
for (int i = 0; i < n; i++) {
|
||||
this->performTest(fDst, fSrc, kBuffer);
|
||||
}
|
||||
@ -290,20 +290,20 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
IsFiniteProc proc = fProc;
|
||||
const float* data = fData;
|
||||
// do this so the compiler won't throw away the function call
|
||||
int counter = 0;
|
||||
|
||||
if (proc) {
|
||||
for (int j = 0; j < this->getLoops(); ++j) {
|
||||
for (int j = 0; j < loops; ++j) {
|
||||
for (int i = 0; i < N - 4; ++i) {
|
||||
counter += proc(&data[i]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int j = 0; j < this->getLoops(); ++j) {
|
||||
for (int j = 0; j < loops; ++j) {
|
||||
for (int i = 0; i < N - 4; ++i) {
|
||||
const SkRect* r = reinterpret_cast<const SkRect*>(&data[i]);
|
||||
if (false) { // avoid bit rot, suppress warning
|
||||
@ -360,20 +360,20 @@ public:
|
||||
virtual void process(float) {}
|
||||
|
||||
protected:
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
SkRandom rand;
|
||||
float accum = 0;
|
||||
const float* data = fData;
|
||||
|
||||
if (fFast) {
|
||||
for (int j = 0; j < this->getLoops(); ++j) {
|
||||
for (int j = 0; j < loops; ++j) {
|
||||
for (int i = 0; i < ARRAY; ++i) {
|
||||
accum += fast_floor(data[i]);
|
||||
}
|
||||
this->process(accum);
|
||||
}
|
||||
} else {
|
||||
for (int j = 0; j < this->getLoops(); ++j) {
|
||||
for (int j = 0; j < loops; ++j) {
|
||||
for (int i = 0; i < ARRAY; ++i) {
|
||||
accum += sk_float_floor(data[i]);
|
||||
}
|
||||
@ -422,18 +422,18 @@ public:
|
||||
virtual void process(int) {}
|
||||
|
||||
protected:
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
int accum = 0;
|
||||
|
||||
if (fUsePortable) {
|
||||
for (int j = 0; j < this->getLoops(); ++j) {
|
||||
for (int j = 0; j < loops; ++j) {
|
||||
for (int i = 0; i < ARRAY; ++i) {
|
||||
accum += SkCLZ_portable(fData[i]);
|
||||
}
|
||||
this->process(accum);
|
||||
}
|
||||
} else {
|
||||
for (int j = 0; j < this->getLoops(); ++j) {
|
||||
for (int j = 0; j < loops; ++j) {
|
||||
for (int i = 0; i < ARRAY; ++i) {
|
||||
accum += SkCLZ(fData[i]);
|
||||
}
|
||||
@ -478,10 +478,10 @@ public:
|
||||
virtual void process(int) {}
|
||||
|
||||
protected:
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
int accum = 0;
|
||||
|
||||
for (int j = 0; j < this->getLoops(); ++j) {
|
||||
for (int j = 0; j < loops; ++j) {
|
||||
for (int i = 0; i < ARRAY; ++i) {
|
||||
accum += fVec[i].normalize();
|
||||
}
|
||||
@ -511,8 +511,8 @@ public:
|
||||
|
||||
FixedMathBench() {
|
||||
SkRandom rand;
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
fData[i%N] = rand.nextSScalar1();
|
||||
for (int i = 0; i < N; ++i) {
|
||||
fData[i] = rand.nextSScalar1();
|
||||
}
|
||||
|
||||
}
|
||||
@ -522,8 +522,8 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
for (int j = 0; j < this->getLoops(); ++j) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
for (int j = 0; j < loops; ++j) {
|
||||
for (int i = 0; i < N - 4; ++i) {
|
||||
fResult[i] = SkFloatToFixed(fData[i]);
|
||||
}
|
||||
@ -562,10 +562,10 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
volatile T a = 0, b = 0;
|
||||
T div = 0, mod = 0;
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
if ((T)i == 0) continue; // Small T will wrap around.
|
||||
SkTDivMod((T)(i+1), (T)i, &div, &mod);
|
||||
a ^= div;
|
||||
|
@ -30,8 +30,8 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
this->performTest();
|
||||
}
|
||||
}
|
||||
|
@ -31,8 +31,8 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
this->performTest();
|
||||
}
|
||||
}
|
||||
|
@ -35,12 +35,12 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
SkPaint paint;
|
||||
this->setupPaint(&paint);
|
||||
paint.setAntiAlias(true);
|
||||
SkRandom rand;
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
SkRect r = SkRect::MakeWH(rand.nextUScalar1() * 400,
|
||||
rand.nextUScalar1() * 400);
|
||||
paint.setImageFilter(fFilter);
|
||||
|
@ -30,14 +30,14 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
|
||||
size_t inc = fMinSize >> 4;
|
||||
SkASSERT(inc > 0);
|
||||
size_t total = fMinSize * 64;
|
||||
|
||||
SkChunkAlloc alloc(fMinSize);
|
||||
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
size_t size = 0;
|
||||
int calls = 0;
|
||||
while (size < total) {
|
||||
@ -99,8 +99,8 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) SK_OVERRIDE {
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
int* zeros = fUseCalloc ? calloc(fNum) : malloc_bzero(fNum);
|
||||
if (fRead) {
|
||||
volatile int x = 15;
|
||||
|
@ -47,8 +47,8 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
this->performTest();
|
||||
}
|
||||
}
|
||||
|
@ -32,12 +32,12 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkRect r = fIsSmall ? SkRect::MakeWH(FILTER_WIDTH_SMALL, FILTER_HEIGHT_SMALL) :
|
||||
SkRect::MakeWH(FILTER_WIDTH_LARGE, FILTER_HEIGHT_LARGE);
|
||||
SkPaint paint;
|
||||
paint.setImageFilter(mergeBitmaps())->unref();
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
canvas->drawRect(r, paint);
|
||||
}
|
||||
}
|
||||
|
@ -50,14 +50,14 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
SkPaint paint;
|
||||
this->setupPaint(&paint);
|
||||
|
||||
paint.setAntiAlias(true);
|
||||
|
||||
SkRandom rand;
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
SkRect r = SkRect::MakeWH(rand.nextUScalar1() * 400,
|
||||
rand.nextUScalar1() * 400);
|
||||
r.offset(fRadius, fRadius);
|
||||
|
@ -18,9 +18,9 @@ protected:
|
||||
return "mutex";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
SK_DECLARE_STATIC_MUTEX(mu);
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
mu.acquire();
|
||||
mu.release();
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkPaint paint(fPaint);
|
||||
this->setupPaint(&paint);
|
||||
|
||||
@ -62,7 +62,7 @@ protected:
|
||||
path.transform(m);
|
||||
}
|
||||
|
||||
int count = this->getLoops();
|
||||
int count = loops;
|
||||
if (fFlags & kBig_Flag) {
|
||||
count >>= 2;
|
||||
}
|
||||
@ -330,8 +330,8 @@ protected:
|
||||
fPaths.reset(kPathCnt);
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) SK_OVERRIDE {
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
this->makePath(&fPaths[i & (kPathCnt - 1)]);
|
||||
}
|
||||
this->restartMakingPaths();
|
||||
@ -370,8 +370,8 @@ protected:
|
||||
}
|
||||
this->finishedMakingPaths();
|
||||
}
|
||||
virtual void onDraw(SkCanvas*) SK_OVERRIDE {
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
int idx = i & (kPathCnt - 1);
|
||||
fCopies[idx] = fPaths[idx];
|
||||
}
|
||||
@ -414,13 +414,13 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
|
||||
if (fInPlace) {
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
fPaths[i & (kPathCnt - 1)].transform(fMatrix);
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
int idx = i & (kPathCnt - 1);
|
||||
fPaths[idx].transform(fMatrix, &fTransformed[idx]);
|
||||
}
|
||||
@ -466,8 +466,8 @@ protected:
|
||||
this->finishedMakingPaths();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) SK_OVERRIDE {
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
int idx = i & (kPathCnt - 1);
|
||||
fParity ^= (fPaths[idx] == fCopies[idx & ~0x1]);
|
||||
}
|
||||
@ -535,38 +535,38 @@ protected:
|
||||
this->finishedMakingPaths();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
|
||||
switch (fType) {
|
||||
case kAdd_AddType:
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
int idx = i & (kPathCnt - 1);
|
||||
SkPath result = fPaths0[idx];
|
||||
result.addPath(fPaths1[idx]);
|
||||
}
|
||||
break;
|
||||
case kAddTrans_AddType:
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
int idx = i & (kPathCnt - 1);
|
||||
SkPath result = fPaths0[idx];
|
||||
result.addPath(fPaths1[idx], 2 * SK_Scalar1, 5 * SK_Scalar1);
|
||||
}
|
||||
break;
|
||||
case kAddMatrix_AddType:
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
int idx = i & (kPathCnt - 1);
|
||||
SkPath result = fPaths0[idx];
|
||||
result.addPath(fPaths1[idx], fMatrix);
|
||||
}
|
||||
break;
|
||||
case kReverseAdd_AddType:
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
int idx = i & (kPathCnt - 1);
|
||||
SkPath result = fPaths0[idx];
|
||||
result.reverseAddPath(fPaths1[idx]);
|
||||
}
|
||||
break;
|
||||
case kReversePathTo_AddType:
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
int idx = i & (kPathCnt - 1);
|
||||
SkPath result = fPaths0[idx];
|
||||
result.reversePathTo(fPaths1[idx]);
|
||||
@ -608,7 +608,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkPaint paint;
|
||||
|
||||
paint.setColor(SK_ColorBLACK);
|
||||
@ -621,7 +621,7 @@ protected:
|
||||
|
||||
SkRect r;
|
||||
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
SkScalar radius = rand.nextUScalar1() * 3;
|
||||
r.fLeft = rand.nextUScalar1() * 300;
|
||||
r.fTop = rand.nextUScalar1() * 300;
|
||||
@ -714,11 +714,11 @@ protected:
|
||||
SkASSERT(path->isConvex());
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkRandom rand;
|
||||
SkRect r;
|
||||
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
SkPaint paint;
|
||||
paint.setColor(0xff000000 | rand.nextU());
|
||||
paint.setAntiAlias(true);
|
||||
@ -788,8 +788,8 @@ private:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) SK_OVERRIDE {
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
const SkRect& rect = fQueryRects[i % kQueryRectCnt];
|
||||
fParity = fParity != fPath.conservativelyContainsRect(rect);
|
||||
}
|
||||
@ -851,9 +851,9 @@ private:
|
||||
return "ratquad-chop-0.5";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
|
||||
SkConic dst[2];
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
fRQ.chopAt(0.5f, dst);
|
||||
}
|
||||
}
|
||||
@ -876,9 +876,9 @@ private:
|
||||
return "ratquad-chop-half";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
|
||||
SkConic dst[2];
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
fRQ.chop(dst);
|
||||
}
|
||||
}
|
||||
@ -931,9 +931,9 @@ protected:
|
||||
return "conic-compute-error";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
|
||||
SkVector err;
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
for (int j = 0; j < CONICS; ++j) {
|
||||
fConics[j].computeAsQuadError(&err);
|
||||
}
|
||||
@ -953,8 +953,8 @@ protected:
|
||||
return "conic-asQuadTol";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) SK_OVERRIDE {
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
for (int j = 0; j < CONICS; ++j) {
|
||||
fConics[j].asQuadTol(SK_ScalarHalf);
|
||||
}
|
||||
@ -974,8 +974,8 @@ protected:
|
||||
return "conic-quadPow2";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) SK_OVERRIDE {
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
for (int j = 0; j < CONICS; ++j) {
|
||||
fConics[j].computeQuadPOW2(SK_ScalarHalf);
|
||||
}
|
||||
|
@ -65,9 +65,9 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
|
||||
if (fRaw) {
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
SkPath::RawIter iter(fPath);
|
||||
SkPath::Verb verb;
|
||||
SkPoint pts[4];
|
||||
@ -75,7 +75,7 @@ protected:
|
||||
while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { }
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
SkPath::Iter iter(fPath, false);
|
||||
SkPath::Verb verb;
|
||||
SkPoint pts[4];
|
||||
|
@ -52,9 +52,9 @@ public:
|
||||
protected:
|
||||
virtual const char* onGetName() { return fName.c_str(); }
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
|
||||
for (int i = 0; i < this->getLoops(); ++i){
|
||||
for (int i = 0; i < loops; ++i){
|
||||
//create a random 16x16 bitmap
|
||||
fillRandomBits(H * STRIDE, (char*) &bits);
|
||||
|
||||
|
@ -21,9 +21,9 @@ protected:
|
||||
return "perlinnoise";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
this->test(canvas, 0, 0, SkPerlinNoiseShader::kFractalNoise_Type,
|
||||
0.1f, 0.1f, 3, 0, false);
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
this->test(loops, canvas, 0, 0, SkPerlinNoiseShader::kFractalNoise_Type,
|
||||
0.1f, 0.1f, 3, 0, false);
|
||||
}
|
||||
|
||||
private:
|
||||
@ -38,7 +38,7 @@ private:
|
||||
canvas->restore();
|
||||
}
|
||||
|
||||
void test(SkCanvas* canvas, int x, int y, SkPerlinNoiseShader::Type type,
|
||||
void test(const int loops, SkCanvas* canvas, int x, int y, SkPerlinNoiseShader::Type type,
|
||||
float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed,
|
||||
bool stitchTiles) {
|
||||
SkShader* shader = (type == SkPerlinNoiseShader::kFractalNoise_Type) ?
|
||||
@ -49,7 +49,7 @@ private:
|
||||
SkPaint paint;
|
||||
paint.setShader(shader)->unref();
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
this->drawClippedRect(canvas, x, y, paint);
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
|
||||
SkPicture picture;
|
||||
|
||||
@ -43,9 +43,9 @@ protected:
|
||||
recordCanvas(pCanvas);
|
||||
picture.endRecording();
|
||||
|
||||
const SkPoint translateDelta = getTranslateDelta(this->getLoops());
|
||||
const SkPoint translateDelta = getTranslateDelta(loops);
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
picture.draw(canvas);
|
||||
canvas->translate(translateDelta.fX, translateDelta.fY);
|
||||
}
|
||||
|
@ -50,13 +50,13 @@ public:
|
||||
DictionaryRecordBench() : INHERITED("dictionaries") {}
|
||||
|
||||
protected:
|
||||
virtual void onDraw(SkCanvas*) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
|
||||
SkAutoTDelete<SkPicture> picture;
|
||||
SkCanvas* canvas = NULL;
|
||||
|
||||
const SkPoint translateDelta = getTranslateDelta(this->getLoops());
|
||||
const SkPoint translateDelta = getTranslateDelta(loops);
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
if (0 == i % kMaxLoopsPerCanvas) {
|
||||
picture.reset(SkNEW(SkPicture));
|
||||
canvas = picture->beginRecording(PICTURE_WIDTH, PICTURE_HEIGHT);
|
||||
@ -117,12 +117,12 @@ public:
|
||||
UniquePaintDictionaryRecordBench() : INHERITED("unique_paint_dictionary") { }
|
||||
|
||||
protected:
|
||||
virtual void onDraw(SkCanvas*) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
|
||||
SkRandom rand;
|
||||
SkPaint paint;
|
||||
SkAutoTDelete<SkPicture> picture;
|
||||
SkCanvas* canvas = NULL;
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
if (0 == i % kMaxLoopsPerCanvas) {
|
||||
picture.reset(SkNEW(SkPicture));
|
||||
canvas = picture->beginRecording(PICTURE_WIDTH, PICTURE_HEIGHT);
|
||||
@ -157,10 +157,10 @@ public:
|
||||
ObjCount = 100, // number of unique paint objects
|
||||
};
|
||||
protected:
|
||||
virtual void onDraw(SkCanvas*) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
|
||||
SkPicture picture;
|
||||
SkCanvas* canvas = picture.beginRecording(PICTURE_WIDTH, PICTURE_HEIGHT);
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
canvas->drawPaint(fPaint[i % ObjCount]);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
canvas->clear(SK_ColorBLACK);
|
||||
SkISize size = canvas->getDeviceSize();
|
||||
|
||||
@ -45,7 +45,7 @@ protected:
|
||||
bmp2.setConfig(SkBitmap::kARGB_8888_Config, size.width(),
|
||||
size.height());
|
||||
|
||||
for (int loop = 0; loop < this->getLoops(); ++loop) {
|
||||
for (int loop = 0; loop < loops; ++loop) {
|
||||
// Unpremul -> Premul
|
||||
canvas->writePixels(bmp1, 0, 0, fUnPremulConfig);
|
||||
// Premul -> Unpremul
|
||||
|
@ -47,9 +47,9 @@ protected:
|
||||
virtual const char* onGetName() SK_OVERRIDE {
|
||||
return fName.c_str();
|
||||
}
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkRandom rand;
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
for (int j = 0; j < NUM_BUILD_RECTS; ++j) {
|
||||
fTree->insert(reinterpret_cast<void*>(j), fProc(rand, j, NUM_BUILD_RECTS),
|
||||
fBulkLoad);
|
||||
@ -111,9 +111,9 @@ protected:
|
||||
fTree->flushDeferredInserts();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkRandom rand;
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
SkTDArray<void*> hits;
|
||||
SkIRect query;
|
||||
switch(fQuery) {
|
||||
|
@ -24,7 +24,7 @@ protected:
|
||||
return "readpix";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
canvas->clear(SK_ColorBLACK);
|
||||
|
||||
SkISize size = canvas->getDeviceSize();
|
||||
@ -45,7 +45,7 @@ protected:
|
||||
|
||||
bitmap.setConfig(SkBitmap::kARGB_8888_Config, kWindowSize, kWindowSize);
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
for (int x = 0; x < kNumStepsX; ++x) {
|
||||
for (int y = 0; y < kNumStepsY; ++y) {
|
||||
canvas->readPixels(&bitmap, x * offX, y * offY);
|
||||
|
@ -62,13 +62,13 @@ protected:
|
||||
}
|
||||
|
||||
virtual const char* onGetName() { return computeName("rects"); }
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
SkPaint paint;
|
||||
if (fStroke > 0) {
|
||||
paint.setStyle(SkPaint::kStroke_Style);
|
||||
paint.setStrokeWidth(SkIntToScalar(fStroke));
|
||||
}
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
paint.setColor(fColors[i % N]);
|
||||
this->setupPaint(&paint);
|
||||
this->drawThisRect(canvas, fRects[i % N], paint);
|
||||
@ -141,7 +141,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
SkScalar gSizes[] = {
|
||||
SkIntToScalar(7), 0
|
||||
};
|
||||
@ -155,7 +155,7 @@ protected:
|
||||
SkPaint paint;
|
||||
paint.setStrokeCap(SkPaint::kRound_Cap);
|
||||
|
||||
for (int loop = 0; loop < this->getLoops(); loop++) {
|
||||
for (int loop = 0; loop < loops; loop++) {
|
||||
for (size_t i = 0; i < sizes; i++) {
|
||||
paint.setStrokeWidth(gSizes[i]);
|
||||
this->setupPaint(&paint);
|
||||
@ -185,7 +185,7 @@ protected:
|
||||
return "aarects";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
static const SkScalar kHalfRectSize = 0.75f;
|
||||
|
||||
SkPaint paint;
|
||||
@ -195,7 +195,7 @@ protected:
|
||||
SkRect r = { -kHalfRectSize, -kHalfRectSize, kHalfRectSize, kHalfRectSize };
|
||||
int rot = 0;
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
// Draw small aa rects in a grid across the screen
|
||||
for (SkScalar y = kHalfRectSize+SK_Scalar1; y < H; y += 2*kHalfRectSize+2) {
|
||||
for (SkScalar x = kHalfRectSize+SK_Scalar1; x < W; x += 2*kHalfRectSize+2) {
|
||||
@ -243,7 +243,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
SkScalar gSizes[] = {
|
||||
SkIntToScalar(13), SkIntToScalar(24)
|
||||
};
|
||||
@ -269,7 +269,7 @@ protected:
|
||||
SkShader::kClamp_TileMode);
|
||||
paint.setShader(s)->unref();
|
||||
}
|
||||
for (int loop = 0; loop < this->getLoops(); loop++) {
|
||||
for (int loop = 0; loop < loops; loop++) {
|
||||
for (size_t i = 0; i < sizes; i++) {
|
||||
switch (_type) {
|
||||
case kMaskOpaque:
|
||||
|
@ -24,10 +24,10 @@ protected:
|
||||
return "rectori";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkRandom Random;
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
SkScalar blurSigma = Random.nextRangeScalar(1.5f, 25.0f);
|
||||
SkScalar size = Random.nextRangeScalar(20*blurSigma, 50*blurSigma);
|
||||
|
||||
|
@ -25,8 +25,8 @@ protected:
|
||||
return "ref_cnt_stack";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
SkRefCnt ref;
|
||||
for (int j = 0; j < M; ++j) {
|
||||
ref.ref();
|
||||
@ -63,9 +63,9 @@ protected:
|
||||
return "ref_cnt_heap";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
char memory[sizeof(PlacedRefCnt)];
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
PlacedRefCnt* ref = new (memory) PlacedRefCnt();
|
||||
for (int j = 0; j < M; ++j) {
|
||||
ref->ref();
|
||||
@ -90,8 +90,8 @@ protected:
|
||||
return "ref_cnt_new";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
SkRefCnt* ref = new SkRefCnt();
|
||||
for (int j = 0; j < M; ++j) {
|
||||
ref->ref();
|
||||
@ -118,8 +118,8 @@ protected:
|
||||
return "ref_cnt_stack_weak";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
SkWeakRefCnt ref;
|
||||
for (int j = 0; j < M; ++j) {
|
||||
ref.ref();
|
||||
@ -149,9 +149,9 @@ protected:
|
||||
return "ref_cnt_heap_weak";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
char memory[sizeof(PlacedWeakRefCnt)];
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
PlacedWeakRefCnt* ref = new (memory) PlacedWeakRefCnt();
|
||||
for (int j = 0; j < M; ++j) {
|
||||
ref->ref();
|
||||
@ -176,8 +176,8 @@ protected:
|
||||
return "ref_cnt_new_weak";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
SkWeakRefCnt* ref = new SkWeakRefCnt();
|
||||
for (int j = 0; j < M; ++j) {
|
||||
ref->ref();
|
||||
|
@ -106,9 +106,9 @@ public:
|
||||
protected:
|
||||
virtual const char* onGetName() { return fName.c_str(); }
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
Proc proc = fProc;
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
proc(fA, fB);
|
||||
}
|
||||
}
|
||||
|
@ -52,10 +52,10 @@ public:
|
||||
protected:
|
||||
virtual const char* onGetName() { return fName.c_str(); }
|
||||
|
||||
virtual void onDraw(SkCanvas*) {
|
||||
virtual void onDraw(const int loops, SkCanvas*) {
|
||||
Proc proc = fProc;
|
||||
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
proc(fA, fB);
|
||||
}
|
||||
}
|
||||
|
@ -133,11 +133,11 @@ protected:
|
||||
}
|
||||
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkPaint paint(fPaint);
|
||||
this->setupPaint(&paint);
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
canvas->drawPaint(paint);
|
||||
}
|
||||
}
|
||||
|
@ -31,8 +31,8 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
this->performTest();
|
||||
}
|
||||
}
|
||||
@ -157,9 +157,9 @@ protected:
|
||||
return "rect_bounds";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkRect r;
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
r.set(fPts, PTS);
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
const SkIPoint dim = this->getSize();
|
||||
SkRandom rand;
|
||||
|
||||
@ -71,14 +71,14 @@ protected:
|
||||
const SkScalar y0 = SkIntToScalar(-10);
|
||||
|
||||
paint.setTextSize(SkIntToScalar(12));
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
SkScalar x = x0 + rand.nextUScalar1() * dim.fX;
|
||||
SkScalar y = y0 + rand.nextUScalar1() * dim.fY;
|
||||
canvas->drawText(fText.c_str(), fText.size(), x, y, paint);
|
||||
}
|
||||
|
||||
paint.setTextSize(SkIntToScalar(48));
|
||||
for (int i = 0; i < this->getLoops() / 4 ; i++) {
|
||||
for (int i = 0; i < loops / 4 ; i++) {
|
||||
SkScalar x = x0 + rand.nextUScalar1() * dim.fX;
|
||||
SkScalar y = y0 + rand.nextUScalar1() * dim.fY;
|
||||
canvas->drawText(fText.c_str(), fText.size(), x, y, paint);
|
||||
|
@ -22,7 +22,6 @@ SkBenchmark::SkBenchmark() {
|
||||
fForceFilter = false;
|
||||
fDither = SkTriState::kDefault;
|
||||
fOrMask = fClearMask = 0;
|
||||
fLoops = 1;
|
||||
}
|
||||
|
||||
const char* SkBenchmark::getName() {
|
||||
@ -37,8 +36,8 @@ void SkBenchmark::preDraw() {
|
||||
this->onPreDraw();
|
||||
}
|
||||
|
||||
void SkBenchmark::draw(SkCanvas* canvas) {
|
||||
this->onDraw(canvas);
|
||||
void SkBenchmark::draw(const int loops, SkCanvas* canvas) {
|
||||
this->onDraw(loops, canvas);
|
||||
}
|
||||
|
||||
void SkBenchmark::postDraw() {
|
||||
|
@ -67,7 +67,8 @@ public:
|
||||
// before the initial draw.
|
||||
void preDraw();
|
||||
|
||||
void draw(SkCanvas*);
|
||||
// Bench framework can tune loops to be large enough for stable timing.
|
||||
void draw(const int loops, SkCanvas*);
|
||||
|
||||
// Call after draw, allows the benchmark to do cleanup work outside of the
|
||||
// timer. When a benchmark is repeatedly drawn, this is only called once
|
||||
@ -104,15 +105,6 @@ public:
|
||||
fClearMask = clearMask;
|
||||
}
|
||||
|
||||
// The bench framework calls this to control the runtime of a bench.
|
||||
void setLoops(int loops) {
|
||||
fLoops = loops;
|
||||
}
|
||||
|
||||
// Each bench should do its main work in a loop like this:
|
||||
// for (int i = 0; i < this->getLoops(); i++) { <work here> }
|
||||
int getLoops() const { return fLoops; }
|
||||
|
||||
static void SetResourcePath(const char* resPath) { gResourcePath.set(resPath); }
|
||||
|
||||
static SkString& GetResourcePath() { return gResourcePath; }
|
||||
@ -122,7 +114,9 @@ protected:
|
||||
|
||||
virtual const char* onGetName() = 0;
|
||||
virtual void onPreDraw() {}
|
||||
virtual void onDraw(SkCanvas*) = 0;
|
||||
// Each bench should do its main work in a loop like this:
|
||||
// for (int i = 0; i < loops; i++) { <work here> }
|
||||
virtual void onDraw(const int loops, SkCanvas*) = 0;
|
||||
virtual void onPostDraw() {}
|
||||
|
||||
virtual SkIPoint onGetSize();
|
||||
@ -133,7 +127,6 @@ private:
|
||||
bool fForceFilter;
|
||||
SkTriState::State fDither;
|
||||
uint32_t fOrMask, fClearMask;
|
||||
int fLoops;
|
||||
static SkString gResourcePath;
|
||||
|
||||
typedef SkRefCnt INHERITED;
|
||||
|
@ -72,7 +72,7 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
|
||||
if (!fValid) {
|
||||
#ifdef SK_DEBUG
|
||||
SkDebugf("stream was invalid: %s\n", fFilename.c_str());
|
||||
@ -81,7 +81,7 @@ protected:
|
||||
}
|
||||
// Decode a bunch of times
|
||||
SkBitmap bm;
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
SkDEBUGCODE(bool success =) fDecoder->decode(&fStream, &bm,
|
||||
SkImageDecoder::kDecodePixels_Mode);
|
||||
#ifdef SK_DEBUG
|
||||
|
@ -122,9 +122,9 @@ protected:
|
||||
gRec[fType].fProc(fUnsorted.get());
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
|
||||
SkAutoTMalloc<int> sorted(N);
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
memcpy(sorted.get(), fUnsorted.get(), N*sizeof(int));
|
||||
fSortProc(sorted.get());
|
||||
#ifdef SK_DEBUG
|
||||
|
@ -78,13 +78,13 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
fRec.fCanvas = canvas;
|
||||
this->setupPaint(&fRec.fPaint);
|
||||
fRec.fPaint.setStyle(SkPaint::kStroke_Style);
|
||||
fRec.fPaint.setStrokeJoin(fJoin);
|
||||
fRec.fPaint.setStrokeWidth(5);
|
||||
fProc(&fRec, this->getLoops());
|
||||
fProc(&fRec, loops);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -33,14 +33,14 @@ protected:
|
||||
return "tablebench";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
SkPaint cellPaint;
|
||||
cellPaint.setColor(0xFFFFFFF);
|
||||
|
||||
SkPaint borderPaint;
|
||||
borderPaint.setColor(0xFFCCCCCC);
|
||||
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
for (int row = 0; row < kNumRows; ++row) {
|
||||
for (int col = 0; col < kNumCols; ++col) {
|
||||
SkRect cell = SkRect::MakeLTRB(col * kCellWidth,
|
||||
|
@ -91,7 +91,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
const SkIPoint dim = this->getSize();
|
||||
SkRandom rand;
|
||||
|
||||
@ -111,7 +111,7 @@ protected:
|
||||
canvas->translate(SK_Scalar1, SK_Scalar1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
if (fDoPos) {
|
||||
canvas->drawPosText(fText.c_str(), fText.size(), fPos, paint);
|
||||
} else {
|
||||
|
@ -82,7 +82,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
SkPaint paint(fPaint);
|
||||
this->setupPaint(&paint);
|
||||
paint.setFilterLevel(fDoFilter ? SkPaint::kLow_FilterLevel
|
||||
@ -103,7 +103,7 @@ protected:
|
||||
SkPaint bgPaint;
|
||||
bgPaint.setColor(SK_ColorWHITE);
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
if (fDoTrans) {
|
||||
canvas->drawRect(r, bgPaint);
|
||||
}
|
||||
|
@ -77,11 +77,11 @@ public:
|
||||
|
||||
protected:
|
||||
virtual const char* onGetName() { return fName.c_str(); }
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) {
|
||||
SkPaint paint;
|
||||
this->setupPaint(&paint);
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
canvas->drawVertices(SkCanvas::kTriangles_VertexMode, PTS,
|
||||
fPts, NULL, fColors, NULL, fIdx, IDX, paint);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ protected:
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkISize size = canvas->getDeviceSize();
|
||||
|
||||
canvas->clear(0xFFFF0000);
|
||||
@ -55,7 +55,7 @@ protected:
|
||||
bmp.setConfig(SkBitmap::kARGB_8888_Config, size.width(), size.height());
|
||||
canvas->readPixels(&bmp, 0, 0);
|
||||
|
||||
for (int loop = 0; loop < this->getLoops(); ++loop) {
|
||||
for (int loop = 0; loop < loops; ++loop) {
|
||||
canvas->writePixels(bmp, 0, 0, fConfig);
|
||||
}
|
||||
}
|
||||
|
@ -21,11 +21,11 @@ protected:
|
||||
return "writer";
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas*) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
|
||||
static const char gStr[] = "abcdefghimjklmnopqrstuvwxyz";
|
||||
static const size_t gLen = strlen(gStr);
|
||||
SkWriter32 writer(256 * 4);
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
for (size_t j = 0; j <= gLen; j++) {
|
||||
writer.writeString(gStr, j);
|
||||
}
|
||||
|
@ -31,10 +31,10 @@ public:
|
||||
protected:
|
||||
virtual const char* onGetName() SK_OVERRIDE { return fName.c_str(); }
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
SkISize size = canvas->getDeviceSize();
|
||||
SkRandom random;
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
SkPaint paint;
|
||||
paint.setXfermode(fXfermode.get());
|
||||
paint.setColor(random.nextU());
|
||||
@ -70,8 +70,8 @@ public:
|
||||
protected:
|
||||
virtual const char* onGetName() SK_OVERRIDE { return "xfermode_create"; }
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
for (int outer = 0; outer < this->getLoops() * 10; ++outer) {
|
||||
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
|
||||
for (int outer = 0; outer < loops * 10; ++outer) {
|
||||
for (int i = 0; i <= SkXfermode::kLastMode; ++i) {
|
||||
SkXfermode* xfer = SkXfermode::Create(SkXfermode::Mode(i));
|
||||
SkSafeUnref(xfer);
|
||||
|
@ -520,7 +520,7 @@ int tool_main(int argc, char** argv) {
|
||||
canvas.reset(SkRef(recordTo.beginRecording(dim.fX, dim.fY, kRecordFlags)));
|
||||
break;
|
||||
case kPictureRecord_BenchMode:
|
||||
bench->draw(recordFrom.beginRecording(dim.fX, dim.fY, kRecordFlags));
|
||||
bench->draw(1, recordFrom.beginRecording(dim.fX, dim.fY, kRecordFlags));
|
||||
recordFrom.endRecording();
|
||||
canvas.reset(SkRef(recordTo.beginRecording(dim.fX, dim.fY, kRecordFlags)));
|
||||
break;
|
||||
@ -592,18 +592,19 @@ int tool_main(int argc, char** argv) {
|
||||
// Save and restore around each call to draw() to guarantee a pristine canvas.
|
||||
SkAutoCanvasRestore saveRestore(canvas, true/*also save*/);
|
||||
|
||||
int loops;
|
||||
if (frameIntervalComputed && loopCount > loopsPerFrame) {
|
||||
bench->setLoops(loopsPerFrame);
|
||||
loops = loopsPerFrame;
|
||||
loopCount -= loopsPerFrame;
|
||||
} else {
|
||||
bench->setLoops(loopCount);
|
||||
loops = loopCount;
|
||||
loopCount = 0;
|
||||
}
|
||||
|
||||
if (benchMode == kPictureRecord_BenchMode) {
|
||||
recordFrom.draw(canvas);
|
||||
} else {
|
||||
bench->draw(canvas);
|
||||
bench->draw(loops, canvas);
|
||||
}
|
||||
|
||||
if (kDeferredSilent_BenchMode == benchMode) {
|
||||
|
Loading…
Reference in New Issue
Block a user