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

Unified Diff: bench/ColorCubeBench.cpp

Issue 1821103004: Revert of Revert[2] of "switch colorfilters to sk_sp (patchset #11 id:200001 of https://codereview.chromium.o… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/BlurRoundRectBench.cpp ('k') | bench/ColorFilterBench.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/ColorCubeBench.cpp
diff --git a/bench/ColorCubeBench.cpp b/bench/ColorCubeBench.cpp
index 6a7774012dab3412e831e234afdaaa732bef8f65..9f6bd001ff00b5b972dad83acce4d87f65ea7386 100644
--- a/bench/ColorCubeBench.cpp
+++ b/bench/ColorCubeBench.cpp
@@ -13,12 +13,18 @@
class ColorCubeBench : public Benchmark {
SkISize fSize;
int fCubeDimension;
- sk_sp<SkData> fCubeData;
+ SkData* fCubeData;
SkBitmap fBitmap;
public:
- ColorCubeBench() : fCubeDimension(0) {
+ ColorCubeBench()
+ : fCubeDimension(0)
+ , fCubeData(nullptr) {
fSize = SkISize::Make(2880, 1800); // 2014 Macbook Pro resolution
+ }
+
+ ~ColorCubeBench() {
+ SkSafeUnref(fCubeData);
}
protected:
@@ -65,7 +71,7 @@
void makeCubeData() {
fCubeDimension = 32;
- fCubeData = SkData::MakeUninitialized(sizeof(SkColor) *
+ fCubeData = SkData::NewUninitialized(sizeof(SkColor) *
fCubeDimension * fCubeDimension * fCubeDimension);
SkColor* pixels = (SkColor*)(fCubeData->writable_data());
SkAutoTMalloc<uint8_t> lutMemory(fCubeDimension);
@@ -89,7 +95,9 @@
void test(int loops, SkCanvas* canvas) {
SkPaint paint;
for (int i = 0; i < loops; i++) {
- paint.setColorFilter(SkColorCubeFilter::Make(fCubeData, fCubeDimension));
+ SkAutoTUnref<SkColorFilter> colorCube(
+ SkColorCubeFilter::Create(fCubeData, fCubeDimension));
+ paint.setColorFilter(colorCube);
canvas->drawBitmap(fBitmap, 0, 0, &paint);
}
}
« no previous file with comments | « bench/BlurRoundRectBench.cpp ('k') | bench/ColorFilterBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698