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

Commit 983acc36 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 20536

* changes:
  add support for RGBX_8888
parents 2e6bca69 f1e5b0d4
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -242,11 +242,12 @@ static jboolean Surface_isValid(JNIEnv* env, jobject clazz)

static inline SkBitmap::Config convertPixelFormat(PixelFormat format)
{
    /* note: if PIXEL_FORMAT_XRGB_8888 means that all alpha bytes are 0xFF, then
    /* note: if PIXEL_FORMAT_RGBX_8888 means that all alpha bytes are 0xFF, then
        we can map to SkBitmap::kARGB_8888_Config, and optionally call
        bitmap.setIsOpaque(true) on the resulting SkBitmap (as an accelerator)
    */
	switch (format) {
	case PIXEL_FORMAT_RGBX_8888:    return SkBitmap::kARGB_8888_Config;
    case PIXEL_FORMAT_RGBA_8888:    return SkBitmap::kARGB_8888_Config;
    case PIXEL_FORMAT_RGBA_4444:    return SkBitmap::kARGB_4444_Config;
	case PIXEL_FORMAT_RGB_565:		return SkBitmap::kRGB_565_Config;
@@ -294,6 +295,9 @@ static jobject Surface_lockCanvas(JNIEnv* env, jobject clazz, jobject dirtyRect)
    SkBitmap bitmap;
    ssize_t bpr = info.s * bytesPerPixel(info.format);
    bitmap.setConfig(convertPixelFormat(info.format), info.w, info.h, bpr);
    if (info.format == PIXEL_FORMAT_RGBX_8888) {
        bitmap.setIsOpaque(true);
    }
    if (info.w > 0 && info.h > 0) {
        bitmap.setPixels(info.bits);
    } else {
+2 −0
Original line number Diff line number Diff line
@@ -75,6 +75,8 @@ private:
static bool supportedCopybitsFormat(int format) {
    switch (format) {
    case COPYBIT_FORMAT_RGBA_8888:
    case COPYBIT_FORMAT_RGBX_8888:
    case COPYBIT_FORMAT_RGB_888:
    case COPYBIT_FORMAT_RGB_565:
    case COPYBIT_FORMAT_BGRA_8888:
    case COPYBIT_FORMAT_RGBA_5551: