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

Commit 8ad29e43 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[RNG] Bitmap::allocateHardwareBitmap() must copy source content." into main

parents 0fc21121 30eb173f
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -212,7 +212,14 @@ sk_sp<Bitmap> Bitmap::allocateHardwareBitmap(const SkBitmap& bitmap) {
#ifdef __ANDROID__  // Layoutlib does not support hardware acceleration
    return uirenderer::HardwareBitmapUploader::allocateHardwareBitmap(bitmap);
#else
    return Bitmap::allocateHeapBitmap(bitmap.info());
    sk_sp<Bitmap> dest = Bitmap::allocateHeapBitmap(bitmap.info());

    // HardwareBitmapUploader::allocateHardwareBitmap(SkBitmap&) copies Bitmap contents
    // to a GL texture. To simulate this with an heap bitmap, we use memcpy.
    auto destPM = dest->getSkBitmap().pixmap();
    LOG_ALWAYS_FATAL_IF(!bitmap.pixmap().readPixels(destPM), "failed to copy pixels");

    return dest;
#endif
}