Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b5fdb204 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "use new api for passing colortable to allocPixels"

parents ae88c166 d20f2c2d
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -29,16 +29,15 @@ using namespace android::uirenderer;

TEST(Bitmap, colorTableRefCounting) {
    const SkPMColor c[] = { SkPackARGB32(0x80, 0x80, 0, 0) };
    SkColorTable* ctable = new SkColorTable(c, SK_ARRAY_COUNT(c));
    sk_sp<SkColorTable> ctable = SkColorTable::Make(c, SK_ARRAY_COUNT(c));

    SkBitmap* bm = new SkBitmap();
    bm->allocPixels(SkImageInfo::Make(1, 1, kIndex_8_SkColorType, kPremul_SkAlphaType),
            nullptr, ctable);
    sk_sp<Bitmap> bitmap = Bitmap::allocateHeapBitmap(bm, ctable);
            ctable);
    sk_sp<Bitmap> bitmap = Bitmap::allocateHeapBitmap(bm, ctable.get());
    EXPECT_FALSE(ctable->unique());
    delete bm;
    bitmap.reset();
    EXPECT_TRUE(ctable->unique());
    ctable->unref();
}