Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: bench/ETCBitmapBench.cpp

Issue 1340803002: discardable pixelrefs are gone, update tests accordingly (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gm/astcbitmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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:
« no previous file with comments | « no previous file | gm/astcbitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698