Ticket #12611: 0001-also-print-all-supported-bitmap-overlay-colorspaces.patch

File 0001-also-print-all-supported-bitmap-overlay-colorspaces.patch, 3.4 KB (added by hypgci, 5 years ago)

Replacing the previous patch file

  • src/bin/screeninfo.cpp

    From 0d6400a1c600e399bd74f301e78e16cfca753b3e Mon Sep 17 00:00:00 2001
    From: Hannah <hypgci@gmail.com>
    Date: Sat, 23 Jan 2016 00:06:09 +0000
    Subject: [PATCH] also print all supported bitmap overlay colorspaces
    
    ---
     src/bin/screeninfo.cpp | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++
     1 file changed, 85 insertions(+)
    
    diff --git a/src/bin/screeninfo.cpp b/src/bin/screeninfo.cpp
    index ff2a06f..fbf84fd 100644
    a b  
    1212#include <stdio.h>
    1313
    1414
     15struct ColorSpace {
     16    color_space space;
     17    const char* name;
     18    ColorSpace(color_space s, const char* n) { space = s; name = n; }
     19};
     20
     21ColorSpace table[] =
     22{
     23    ColorSpace(B_RGB32, "RGB32"),
     24    ColorSpace(B_RGB32, "RGB32"),
     25    ColorSpace(B_RGBA32, "RGBA32"),
     26    ColorSpace(B_RGB24, "RGB24"),
     27    ColorSpace(B_RGB16, "RGB16"),
     28    ColorSpace(B_RGB15, "RGB15"),
     29    ColorSpace(B_RGBA15, "RGBA15"),
     30    ColorSpace(B_CMAP8, "CMAP8"),
     31    ColorSpace(B_GRAY8, "GRAY8"),
     32    ColorSpace(B_GRAY1, "GRAY1"),
     33    ColorSpace(B_RGB32_BIG, "RGB32_BIG"),
     34    ColorSpace(B_RGBA32_BIG, "RGBA32_BIG"),
     35    ColorSpace(B_RGB24_BIG, "RGB24_BIG"),
     36    ColorSpace(B_RGB16_BIG, "RGB16_BIG"),
     37    ColorSpace(B_RGB15_BIG, "RGB15_BIG"),
     38    ColorSpace(B_RGBA15_BIG, "RGBA15_BIG"),
     39    ColorSpace(B_RGB32_LITTLE, "RGB32_LITTLE"),
     40    ColorSpace(B_RGBA32_LITTLE, "RGBA32_LITTLE"),
     41    ColorSpace(B_RGB24_LITTLE, "RGB24_LITTLE"),
     42    ColorSpace(B_RGB16_LITTLE, "RGB16_LITTLE"),
     43    ColorSpace(B_RGB15_LITTLE, "RGB15_LITTLE"),
     44    ColorSpace(B_RGBA15_LITTLE, "RGBA15_LITTLE"),
     45    ColorSpace(B_YCbCr422, "YCbCr422"),
     46    ColorSpace(B_YCbCr411, "YCbCr411"),
     47    ColorSpace(B_YCbCr444, "YCbCr444"),
     48    ColorSpace(B_YCbCr420, "YCbCr420"),
     49    ColorSpace(B_YUV422, "YUV422"),
     50    ColorSpace(B_YUV411, "YUV411"),
     51    ColorSpace(B_YUV444, "YUV444"),
     52    ColorSpace(B_YUV420, "YUV420"),
     53    ColorSpace(B_YUV9, "YUV9"),
     54    ColorSpace(B_YUV12, "YUV12"),
     55    ColorSpace(B_UVL24, "UVL24"),
     56    ColorSpace(B_UVL32, "UVL32"),
     57    ColorSpace(B_UVLA32, "UVLA32"),
     58    ColorSpace(B_LAB24, "LAB24"),
     59    ColorSpace(B_LAB32, "LAB32"),
     60    ColorSpace(B_LABA32, "LABA32"),
     61    ColorSpace(B_HSI24, "HSI24"),
     62    ColorSpace(B_HSI32, "HSI32"),
     63    ColorSpace(B_HSIA32, "HSIA32"),
     64    ColorSpace(B_HSV24, "HSV24"),
     65    ColorSpace(B_HSV32, "HSV32"),
     66    ColorSpace(B_HSVA32, "HSVA32"),
     67    ColorSpace(B_HLS24, "HLS24"),
     68    ColorSpace(B_HLS32, "HLS32"),
     69    ColorSpace(B_HLSA32, "HLSA32"),
     70    ColorSpace(B_CMY24, "CMY24"),
     71    ColorSpace(B_CMY32, "CMY32"),
     72    ColorSpace(B_CMYA32, "CMYA32"),
     73    ColorSpace(B_CMYK32, "CMYK32"),
     74    ColorSpace(B_MONOCHROME_1_BIT, "MONOCHROME_1_BIT"),
     75    ColorSpace(B_GRAYSCALE_8_BIT, "GRAYSCALE_8_BIT"),
     76    ColorSpace(B_COLOR_8_BIT, "COLOR_8_BIT"),
     77    ColorSpace(B_RGB_32_BIT, "RGB_32_BIT"),
     78    ColorSpace(B_RGB_16_BIT, "RGB_16_BIT"),
     79    ColorSpace(B_BIG_RGB_32_BIT, "BIG_RGB_32_BIT"),
     80    ColorSpace(B_BIG_RGB_16_BIT, "BIG_RGB_16_BIT")
     81};
     82
     83
     84void
     85print_supported_overlays()
     86{
     87    for (int32 i = 0; i < sizeof(table) / sizeof(table[0]); i++)
     88    {
     89        uint32 supportFlags = 0;
     90
     91        if (bitmaps_support_space(table[i].space, &supportFlags)
     92                && (supportFlags & B_BITMAPS_SUPPORT_OVERLAY))
     93            printf("\t%s\n", table[i].name);
     94    }
     95}
     96
     97
    1598int
    1699main()
    17100{
    main()  
    34117            printf("  name:    %s\n", info.name);
    35118            printf("  chipset: %s\n", info.chipset);
    36119            printf("  serial:  %s\n", info.serial_no);
     120            printf("  bitmap overlay colorspaces supported:\n");
     121            print_supported_overlays();
    37122        }
    38123    } while (screen.SetToNext() == B_OK);
    39124