Attempt at fixing color cube bench
The original bench was hitting the cache since it was using the same color filter for all loops. By creating a new color filter within the loop, at least this part of it is solved. I'm not 100% sure this is the right way, but at least the numbers are a bit more reasonable and are affected by the output resolution.
BUG=skia:
Review URL: https://codereview.chromium.org/648483002
diff --git a/bench/ColorCubeBench.cpp b/bench/ColorCubeBench.cpp
index 16ed4ce..141edf6 100644
--- a/bench/ColorCubeBench.cpp
+++ b/bench/ColorCubeBench.cpp
@@ -94,12 +94,11 @@
}
void test(const int loops, SkCanvas* canvas) {
- SkAutoTUnref<SkColorFilter> colorCube(
- SkColorCubeFilter::Create(fCubeData, fCubeDimension));
SkPaint paint;
- paint.setColorFilter(colorCube);
-
for (int i = 0; i < loops; i++) {
+ SkAutoTUnref<SkColorFilter> colorCube(
+ SkColorCubeFilter::Create(fCubeData, fCubeDimension));
+ paint.setColorFilter(colorCube);
canvas->drawBitmap(fBitmap, 0, 0, &paint);
}
}