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

Commit 3b9869e3 authored by Derek Sollenberger's avatar Derek Sollenberger
Browse files

Support copying from index8 into another index8.

Both bitmap's must share the same color table as we essentially
memcopy the pixel data between the buffers.

Bug: 64112829
Test: CtsGraphicsTestCases
Merged-In: I317e3a814dbd102925fe412d2e19111b0af3af38
Change-Id: I5d99627fe7dd0639bb47a2eb8790510beebe6c6f
parent 6583c37a
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -752,7 +752,8 @@ static jobject Bitmap_creator(JNIEnv* env, jobject, jintArray jColors,

static bool bitmapCopyTo(SkBitmap* dst, SkColorType dstCT, const SkBitmap& src,
        SkBitmap::Allocator* alloc) {
    LOG_ALWAYS_FATAL_IF(kIndex_8_SkColorType == dstCT, "Error, cannot copyTo kIndex8.");
    LOG_ALWAYS_FATAL_IF(kIndex_8_SkColorType == dstCT &&
            kIndex_8_SkColorType != src.colorType(), "Error, cannot copyTo kIndex8.");

    SkPixmap srcPM;
    if (!src.peekPixels(&srcPM)) {
@@ -787,7 +788,7 @@ static bool bitmapCopyTo(SkBitmap* dst, SkColorType dstCT, const SkBitmap& src,
    if (!dst->setInfo(dstInfo)) {
        return false;
    }
    if (!dst->tryAllocPixels(alloc, nullptr)) {
    if (!dst->tryAllocPixels(alloc, srcPM.ctable())) {
        return false;
    }