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

Commit 9d767168 authored by Alec Mouri's avatar Alec Mouri
Browse files

Add BGRA1010102 pixelformat

Bug: 414794424
Flag: com.android.graphics.hwui.flags.requested_formats_bgra_1010102
Test: builds
Change-Id: I778959dc9ae8dbdbac0aacf35739ef89e51a8652
parent efc96757
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -19065,6 +19065,7 @@ package android.hardware {
    method public boolean isClosed();
    method public static boolean isSupported(@IntRange(from=1) int, @IntRange(from=1) int, int, @IntRange(from=1) int, long);
    method public void writeToParcel(android.os.Parcel, int);
    field @FlaggedApi("com.android.graphics.hwui.flags.requested_formats_bgra_1010102") public static final int BGRA_1010102 = 67; // 0x43
    field public static final int BLOB = 33; // 0x21
    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.HardwareBuffer> CREATOR;
    field public static final int DS_24UI8 = 50; // 0x32
+13 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ public final class HardwareBuffer implements Parcelable, AutoCloseable {
            RG_1414,
            RGBA_12121212,
            RGBA_14141414,
            BGRA_1010102,
    })
    public @interface Format {
    }
@@ -207,6 +208,18 @@ public final class HardwareBuffer implements Parcelable, AutoCloseable {
    @FlaggedApi(com.android.graphics.hwui.flags.Flags.FLAG_REQUESTED_FORMATS_12_14)
    public static final int RGBA_14141414 = 0x42;

/**
     * 32-bit packed format that has 2-bit A, 10-bit R, G, and B components,
     * in that order, from the most-significant bits to the least-significant
     * bits.
     *
     * The component values are unsigned normalized to the range [0, 1], whose
     * interpretation is defined by the dataspace.
     */
    @FlaggedApi(com.android.graphics.hwui.flags.Flags.FLAG_REQUESTED_FORMATS_BGRA_1010102)
    public static final int BGRA_1010102 = 0x43;


    // Note: do not rename, this field is used by native code
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    private long mNativeObject;
+8 −0
Original line number Diff line number Diff line
@@ -97,6 +97,14 @@ flag {
  bug: "390471495"
}

flag {
  name: "requested_formats_bgra_1010102"
  is_exported: true
  namespace: "core_graphics"
  description: "Enable BGRA_1010102 in the SDK"
  bug: "414794424"
}

flag {
  name: "draw_region"
  namespace: "core_graphics"
+5 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@
#include <cmath>

#include "SkColorSpace.h"
#include "SkColorType.h"

namespace android {
namespace uirenderer {
@@ -68,6 +69,10 @@ static inline SkImageInfo createImageInfo(int32_t width, int32_t height, int32_t
            colorType = kBGRA_8888_SkColorType;
            alphaType = kPremul_SkAlphaType;
            break;
        case AHARDWAREBUFFER_FORMAT_B10G10R10A2_UNORM:
            colorType = kBGRA_1010102_SkColorType;
            alphaType = kPremul_SkAlphaType;
            break;
        default:
            ALOGV("Unsupported format: %d, return unknown by default", format);
            break;