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

Commit 8d9da28a authored by Mathias Agopian's avatar Mathias Agopian
Browse files

add sRGB pixel formats to the HALs

Change-Id: I1d5f9dd14a6485dd3a29fb5960edfa79aa86da42
parent 42cf2b59
Loading
Loading
Loading
Loading
+28 −1
Original line number Diff line number Diff line
@@ -42,6 +42,13 @@ extern "C" {
 */

enum {
    /*
     * "linear" color pixel formats:
     *
     * The pixel formats below contain sRGB data but are otherwise treated
     * as linear formats, i.e.: no special operation is performed when
     * reading or writing into a buffer in one of these formats
     */
    HAL_PIXEL_FORMAT_RGBA_8888          = 1,
    HAL_PIXEL_FORMAT_RGBX_8888          = 2,
    HAL_PIXEL_FORMAT_RGB_888            = 3,
@@ -50,7 +57,27 @@ enum {
    HAL_PIXEL_FORMAT_RGBA_5551          = 6,
    HAL_PIXEL_FORMAT_RGBA_4444          = 7,

    /* 0x8 - 0xFF range unavailable */
    /*
     * sRGB color pixel formats:
     *
     * The red, green and blue components are stored in sRGB space, and converted
     * to linear space when read, using the standard sRGB to linear equation:
     *
     * Clinear = Csrgb / 12.92                  for Csrgb <= 0.04045
     *         = (Csrgb + 0.055 / 1.055)^2.4    for Csrgb >  0.04045
     *
     * When written the inverse transformation is performed:
     *
     * Csrgb = 12.92 * Clinear                  for Clinear <= 0.0031308
     *       = 1.055 * Clinear^(1/2.4) - 0.055  for Clinear >  0.0031308
     *
     *
     *  The alpha component, if present, is always stored in linear space and
     *  is left unmodified when read or written.
     *
     */
    HAL_PIXEL_FORMAT_sRGB_A_8888        = 0xC,
    HAL_PIXEL_FORMAT_sRGB_888           = 0xD,

    /*
     * 0x100 - 0x1FF