Revert of Benchmark designed to exercise fractional image scale/translation (patchset #2 of https://codereview.chromium.org/491793003/)
Reason for revert: fires asserts on Linux Debug builds http://108.170.220.120:10115/builders/Test-Ubuntu12-ShuttleA-GTX660-x86_64-Debug/builds/1910 Original issue's description: > Benchmark designed to exercise fractional image scale/translation > > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/5fc226641a0926dddbf70ba784f344881f4c05b9 R=reed@google.com, humper@google.com TBR=humper@google.com, reed@google.com NOTREECHECKS=true NOTRY=true BUG=skia: Author: djsollen@google.com Review URL: https://codereview.chromium.org/470063007
This commit is contained in:
parent
a6785ccb54
commit
5387c83f81
@ -1,104 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2013 Google Inc.
|
|
||||||
*
|
|
||||||
* Use of this source code is governed by a BSD-style license that can be
|
|
||||||
* found in the LICENSE file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "Benchmark.h"
|
|
||||||
#include "SkBlurMask.h"
|
|
||||||
#include "SkCanvas.h"
|
|
||||||
#include "SkPaint.h"
|
|
||||||
#include "SkRandom.h"
|
|
||||||
#include "SkShader.h"
|
|
||||||
#include "SkString.h"
|
|
||||||
|
|
||||||
class BitmapFractionalBench: public Benchmark {
|
|
||||||
int fInputSize;
|
|
||||||
int fOutputSize;
|
|
||||||
SkPaint::FilterLevel fFilterLevel;
|
|
||||||
SkString fName;
|
|
||||||
|
|
||||||
public:
|
|
||||||
BitmapFractionalBench( int is, const char *name, SkPaint::FilterLevel filterLevel ) {
|
|
||||||
fInputSize = is;
|
|
||||||
fOutputSize = 2*is;
|
|
||||||
fFilterLevel = filterLevel;
|
|
||||||
fName.printf( "bitmap_fractional_bench_%s", name );
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
SkBitmap fInputBitmap, fOutputBitmap;
|
|
||||||
SkMatrix fMatrix;
|
|
||||||
|
|
||||||
virtual const char* onGetName() {
|
|
||||||
return fName.c_str();
|
|
||||||
}
|
|
||||||
|
|
||||||
int inputSize() const {
|
|
||||||
return fInputSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
int outputSize() const {
|
|
||||||
return fOutputSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
SkIPoint onGetSize() SK_OVERRIDE {
|
|
||||||
return SkIPoint::Make( fOutputSize, fOutputSize );
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void onPreDraw() {
|
|
||||||
fInputBitmap.allocN32Pixels(fInputSize, fInputSize, true);
|
|
||||||
fInputBitmap.eraseColor(SK_ColorWHITE);
|
|
||||||
|
|
||||||
fOutputBitmap.allocN32Pixels(fOutputSize, fOutputSize, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void onDraw(const int loops, SkCanvas*) {
|
|
||||||
SkPaint paint;
|
|
||||||
this->setupPaint(&paint);
|
|
||||||
|
|
||||||
preBenchSetup();
|
|
||||||
|
|
||||||
SkCanvas canvas( fOutputBitmap );
|
|
||||||
paint.setFilterLevel(fFilterLevel);
|
|
||||||
fInputBitmap.notifyPixelsChanged();
|
|
||||||
|
|
||||||
for (int i = 0; i < loops; i++) {
|
|
||||||
// up-scale the image by a variety of close, fractional scales
|
|
||||||
for (int j = 0 ; j < 20 ; j++) {
|
|
||||||
fMatrix = SkMatrix::I();
|
|
||||||
fMatrix.setScale( 1 + j/500.f, 1 + j/500.f );
|
|
||||||
canvas.drawBitmapMatrix( fInputBitmap, fMatrix, &paint );
|
|
||||||
}
|
|
||||||
// down-scale the image by a variety of close, fractional scales
|
|
||||||
for (int j = 0 ; j < 20 ; j++) {
|
|
||||||
fMatrix = SkMatrix::I();
|
|
||||||
fMatrix.setScale( 1 - j/500.f, 1 - j/500.f );
|
|
||||||
canvas.drawBitmapMatrix( fInputBitmap, fMatrix, &paint );
|
|
||||||
}
|
|
||||||
// Now try some fractional translates
|
|
||||||
for (int j = 0 ; j < 20 ; j++) {
|
|
||||||
fMatrix = SkMatrix::I();
|
|
||||||
fMatrix.setTranslate( j/3.f, j/3.f );
|
|
||||||
canvas.drawBitmapMatrix( fInputBitmap, fMatrix, &paint );
|
|
||||||
}
|
|
||||||
// Finally, some fractional translates with non-identity scale.
|
|
||||||
for (int j = 0 ; j < 20 ; j++) {
|
|
||||||
fMatrix = SkMatrix::I();
|
|
||||||
fMatrix.setTranslate( j/3.f, j/3.f );
|
|
||||||
fMatrix.preScale( 1.5f, 1.5f );
|
|
||||||
canvas.drawBitmapMatrix( fInputBitmap, fMatrix, &paint );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void preBenchSetup() {}
|
|
||||||
private:
|
|
||||||
typedef Benchmark INHERITED;
|
|
||||||
};
|
|
||||||
|
|
||||||
DEF_BENCH(return new BitmapFractionalBench(256, "high", SkPaint::kHigh_FilterLevel);)
|
|
||||||
DEF_BENCH(return new BitmapFractionalBench(256, "medium", SkPaint::kMedium_FilterLevel);)
|
|
||||||
DEF_BENCH(return new BitmapFractionalBench(256, "low", SkPaint::kLow_FilterLevel);)
|
|
@ -25,7 +25,6 @@
|
|||||||
'../bench/AAClipBench.cpp',
|
'../bench/AAClipBench.cpp',
|
||||||
'../bench/AlternatingColorPatternBench.cpp',
|
'../bench/AlternatingColorPatternBench.cpp',
|
||||||
'../bench/BitmapBench.cpp',
|
'../bench/BitmapBench.cpp',
|
||||||
'../bench/BitmapFractionalBench.cpp',
|
|
||||||
'../bench/BitmapRectBench.cpp',
|
'../bench/BitmapRectBench.cpp',
|
||||||
'../bench/BitmapScaleBench.cpp',
|
'../bench/BitmapScaleBench.cpp',
|
||||||
'../bench/BlurBench.cpp',
|
'../bench/BlurBench.cpp',
|
||||||
|
Loading…
Reference in New Issue
Block a user