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

Commit b40e8fec authored by Sally Qi's avatar Sally Qi
Browse files

[Lut NDK] Add static_assert to ensure that ADISPLAYLUTS_SAMPLINGKEY_CIE_Y is...

[Lut NDK] Add static_assert to ensure that ADISPLAYLUTS_SAMPLINGKEY_CIE_Y is the same as android::gui::LutProperties::SamplingKey::CIE_Y.


Bug: 358422255
Change-Id: I31e82bf0b257b6dee6740b53787645589db8c066
Test: builds
Flag: EXEMPT NDK
parent 43b90eb6
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -26,8 +26,9 @@
#define CHECK_NOT_NULL(name) \
    LOG_ALWAYS_FATAL_IF(name == nullptr, "nullptr passed as " #name " argument");

ADisplayLutsEntry* ADisplayLutsEntry_createEntry(float* buffer, int32_t length, int32_t dimension,
                                                 int32_t key) {
ADisplayLutsEntry* ADisplayLutsEntry_createEntry(float* buffer, int32_t length,
                                                 ADisplayLuts_Dimension dimension,
                                                 ADisplayLuts_SamplingKey key) {
    CHECK_NOT_NULL(buffer);
    LOG_ALWAYS_FATAL_IF(length >= ADISPLAYLUTS_BUFFER_LENGTH_LIMIT,
                        "the lut raw buffer length is too big to handle");
@@ -64,7 +65,7 @@ void ADisplayLutsEntry_destroy(ADisplayLutsEntry* entry) {

ADisplayLuts_Dimension ADisplayLutsEntry_getDimension(const ADisplayLutsEntry* entry) {
    CHECK_NOT_NULL(entry);
    return static_cast<ADisplayLuts_Dimension>(entry->properties.dimension);
    return entry->properties.dimension;
}

int32_t ADisplayLutsEntry_getSize(const ADisplayLutsEntry* entry) {
@@ -74,7 +75,7 @@ int32_t ADisplayLutsEntry_getSize(const ADisplayLutsEntry* entry) {

ADisplayLuts_SamplingKey ADisplayLutsEntry_getSamplingKey(const ADisplayLutsEntry* entry) {
    CHECK_NOT_NULL(entry);
    return static_cast<ADisplayLuts_SamplingKey>(entry->properties.samplingKey);
    return entry->properties.samplingKey;
}

const float* ADisplayLutsEntry_getBuffer(const ADisplayLutsEntry* _Nonnull entry) {
+2 −0
Original line number Diff line number Diff line
@@ -64,6 +64,8 @@ static_assert(static_cast<int>(ADISPLAYLUTS_SAMPLINGKEY_RGB) ==
              static_cast<int>(android::gui::LutProperties::SamplingKey::RGB));
static_assert(static_cast<int>(ADISPLAYLUTS_SAMPLINGKEY_MAX_RGB) ==
              static_cast<int>(android::gui::LutProperties::SamplingKey::MAX_RGB));
static_assert(static_cast<int>(ADISPLAYLUTS_SAMPLINGKEY_CIE_Y) ==
              static_cast<int>(android::gui::LutProperties::SamplingKey::CIE_Y));

Transaction* ASurfaceTransaction_to_Transaction(ASurfaceTransaction* aSurfaceTransaction) {
    return reinterpret_cast<Transaction*>(aSurfaceTransaction);