Index: bench/ETCBitmapBench.cpp |
diff --git a/bench/ETCBitmapBench.cpp b/bench/ETCBitmapBench.cpp |
index 5d72bf4c681c826a4d8989059885986642083e0f..d2fc76fac0404c4f4758b1535e074dbc981b263d 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: |