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

Commit d20f2c2d authored by Mike Reed's avatar Mike Reed
Browse files

use new api for passing colortable to allocPixels

Test: Bitmap:colorTableRefCounting still passes

Change-Id: I5f20a55a98f5766da7c4a490c9be56f9140024c3
parent 3f09522f
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();
}