aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench
diff options
context:
space:
mode:
authorGravatar reed <reed@chromium.org>2015-09-14 08:52:12 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-09-14 08:52:12 -0700
commit74bd953719c97e048def312973fd51320e7a00f0 (patch)
tree71758a15963fdc5f65ae385bf7590c7bb53ff5c7 /bench
parent4c9281d1036606e52390f28dc964d53acf0c44b7 (diff)
discardable pixelrefs are gone, update tests accordingly
Diffstat (limited to 'bench')
-rw-r--r--bench/ETCBitmapBench.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/bench/ETCBitmapBench.cpp b/bench/ETCBitmapBench.cpp
index 5d72bf4c68..d2fc76fac0 100644
--- a/bench/ETCBitmapBench.cpp
+++ b/bench/ETCBitmapBench.cpp
@@ -150,26 +150,28 @@ protected:
return;
}
- // Install pixel ref
- if (!SkInstallDiscardablePixelRef(fPKMData, &(this->fBitmap))) {
- SkDebugf("Could not install discardable pixel ref.\n");
- return;
- }
-
- // Decompress it if necessary
- if (this->fDecompress) {
- this->fBitmap.lockPixels();
+ if (fDecompress) {
+ SkAutoTDelete<SkImageGenerator> gen(SkImageGenerator::NewFromEncoded(fPKMData));
+ gen->generateBitmap(&fBitmap);
+ } else {
+ fImage.reset(SkImage::NewFromEncoded(fPKMData));
}
}
void onDraw(const int loops, SkCanvas* canvas) override {
for (int i = 0; i < loops; ++i) {
- canvas->drawBitmap(this->fBitmap, 0, 0, nullptr);
+ if (fDecompress) {
+ canvas->drawBitmap(this->fBitmap, 0, 0, nullptr);
+ } else {
+ canvas->drawImage(fImage, 0, 0, nullptr);
+ }
}
}
protected:
SkBitmap fBitmap;
+ SkAutoTUnref<SkImage> fImage;
+
bool decompress() const { return fDecompress; }
Backend backend() const { return fBackend; }
private: