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

Unified Diff: bench/PDFBench.cpp

Issue 1810813003: update callsites for Make image factories (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: start to take advantage of sk_sp drawImage Created 4 years, 9 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 | « bench/MergeBench.cpp ('k') | bench/SKPBench.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/PDFBench.cpp
diff --git a/bench/PDFBench.cpp b/bench/PDFBench.cpp
index ba25e44f37d2c80a6964f4302b4d6e4138528c1a..920a02da4ac14017a98cc692dadc4596fcd9e15b 100644
--- a/bench/PDFBench.cpp
+++ b/bench/PDFBench.cpp
@@ -49,15 +49,13 @@ protected:
return backend == kNonRendering_Backend;
}
void onDelayedSetup() override {
- SkAutoTUnref<SkImage> img(GetResourceAsImage("color_wheel.png"));
+ sk_sp<SkImage> img(GetResourceAsImage("color_wheel.png"));
if (img) {
// force decoding, throw away reference to encoded data.
SkAutoPixmapStorage pixmap;
pixmap.alloc(SkImageInfo::MakeN32Premul(img->dimensions()));
if (img->readPixels(pixmap, 0, 0)) {
- fImage.reset(SkImage::NewRasterCopy(
- pixmap.info(), pixmap.addr(),
- pixmap.rowBytes(), pixmap.ctable()));
+ fImage = SkImage::MakeRasterCopy(pixmap);
}
}
}
@@ -67,7 +65,7 @@ protected:
}
while (loops-- > 0) {
SkAutoTUnref<SkPDFObject> object(
- SkPDFCreateBitmapObject(fImage, nullptr));
+ SkPDFCreateBitmapObject(fImage.get(), nullptr));
SkASSERT(object);
if (!object) {
return;
@@ -77,7 +75,7 @@ protected:
}
private:
- SkAutoTUnref<SkImage> fImage;
+ sk_sp<SkImage> fImage;
};
class PDFJpegImageBench : public Benchmark {
@@ -91,13 +89,12 @@ protected:
return backend == kNonRendering_Backend;
}
void onDelayedSetup() override {
- SkAutoTUnref<SkImage> img(
- GetResourceAsImage("mandrill_512_q075.jpg"));
+ sk_sp<SkImage> img(GetResourceAsImage("mandrill_512_q075.jpg"));
if (!img) { return; }
SkAutoTUnref<SkData> encoded(img->refEncoded());
SkASSERT(encoded);
if (!encoded) { return; }
- fImage.reset(img.release());
+ fImage = img;
}
void onDraw(int loops, SkCanvas*) override {
if (!fImage) {
@@ -106,7 +103,7 @@ protected:
}
while (loops-- > 0) {
SkAutoTUnref<SkPDFObject> object(
- SkPDFCreateBitmapObject(fImage, nullptr));
+ SkPDFCreateBitmapObject(fImage.get(), nullptr));
SkASSERT(object);
if (!object) {
return;
@@ -116,7 +113,7 @@ protected:
}
private:
- SkAutoTUnref<SkImage> fImage;
+ sk_sp<SkImage> fImage;
};
/** Test calling DEFLATE on a 78k PDF command stream. Used for measuring
« no previous file with comments | « bench/MergeBench.cpp ('k') | bench/SKPBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698