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

Unified Diff: gm/colorcube.cpp

Issue 1820303002: Revert of switch colorfilters to sk_sp (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 | « gm/color4f.cpp ('k') | gm/coloremoji.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/colorcube.cpp
diff --git a/gm/colorcube.cpp b/gm/colorcube.cpp
index 54e0688c6ab279f0d55fc856e0bc5de25804bb91..01aaf156107968e1220681f6331317ae5ae95a04 100644
--- a/gm/colorcube.cpp
+++ b/gm/colorcube.cpp
@@ -25,12 +25,27 @@
class ColorCubeGM : public GM {
public:
- ColorCubeGM() : fInitialized(false) {
+ ColorCubeGM()
+ : fInitialized(false)
+ , f3DLut4(nullptr)
+ , f3DLut8(nullptr)
+ , f3DLut16(nullptr)
+ , f3DLut32(nullptr)
+ , f3DLut64(nullptr)
+ {
this->setBGColor(0xFF000000);
}
+ ~ColorCubeGM() {
+ SkSafeUnref(f3DLut4);
+ SkSafeUnref(f3DLut8);
+ SkSafeUnref(f3DLut16);
+ SkSafeUnref(f3DLut32);
+ SkSafeUnref(f3DLut64);
+ }
+
protected:
- SkString onShortName() override {
+ virtual SkString onShortName() {
return SkString("colorcube");
}
@@ -52,8 +67,8 @@
canvas.drawRect(SkRect::MakeWH(80, 80), paint);
}
- void make_3Dlut(sk_sp<SkData>* data, int size, bool invR, bool invG, bool invB) {
- *data = SkData::MakeUninitialized(sizeof(SkColor) * size * size * size);
+ void make_3Dlut(SkData** data, int size, bool invR, bool invG, bool invB) {
+ *data = SkData::NewUninitialized(sizeof(SkColor) * size * size * size);
SkColor* pixels = (SkColor*)((*data)->writable_data());
SkAutoTMalloc<uint8_t> lutMemory(size);
SkAutoTMalloc<uint8_t> invLutMemory(size);
@@ -77,11 +92,11 @@
}
}
- SkISize onISize() override {
+ virtual SkISize onISize() {
return SkISize::Make(500, 100);
}
- void onDraw(SkCanvas* canvas) override {
+ virtual void onDraw(SkCanvas* canvas) {
if (!fInitialized) {
this->make_bitmap();
this->make_3Dluts();
@@ -89,19 +104,19 @@
}
canvas->clear(0x00000000);
SkPaint paint;
- paint.setColorFilter(SkColorCubeFilter::Make(f3DLut4, 4));
+ paint.setColorFilter(SkColorCubeFilter::Create(f3DLut4, 4))->unref();
canvas->drawBitmap(fBitmap, 10, 10, &paint);
- paint.setColorFilter(SkColorCubeFilter::Make(f3DLut8, 8));
+ paint.setColorFilter(SkColorCubeFilter::Create(f3DLut8, 8))->unref();
canvas->drawBitmap(fBitmap, 110, 10, &paint);
- paint.setColorFilter(SkColorCubeFilter::Make(f3DLut16, 16));
+ paint.setColorFilter(SkColorCubeFilter::Create(f3DLut16, 16))->unref();
canvas->drawBitmap(fBitmap, 210, 10, &paint);
- paint.setColorFilter(SkColorCubeFilter::Make(f3DLut32, 32));
+ paint.setColorFilter(SkColorCubeFilter::Create(f3DLut32, 32))->unref();
canvas->drawBitmap(fBitmap, 310, 10, &paint);
- paint.setColorFilter(SkColorCubeFilter::Make(f3DLut64, 64));
+ paint.setColorFilter(SkColorCubeFilter::Create(f3DLut64, 64))->unref();
canvas->drawBitmap(fBitmap, 410, 10, &paint);
}
@@ -109,11 +124,11 @@
typedef GM INHERITED;
bool fInitialized;
SkBitmap fBitmap;
- sk_sp<SkData> f3DLut4;
- sk_sp<SkData> f3DLut8;
- sk_sp<SkData> f3DLut16;
- sk_sp<SkData> f3DLut32;
- sk_sp<SkData> f3DLut64;
+ SkData* f3DLut4;
+ SkData* f3DLut8;
+ SkData* f3DLut16;
+ SkData* f3DLut32;
+ SkData* f3DLut64;
};
//////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « gm/color4f.cpp ('k') | gm/coloremoji.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698