summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Sally Qi <sallyqi@google.com> 2024-12-02 19:08:36 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-12-02 19:08:36 +0000
commit88b83fedeed51309790b7088c9a485a006664774 (patch)
treefad16b897c328b964d5c2a2663272b835e7390ea
parenta31d31ca4a28a5d7b91914aab4b0beb59b99561c (diff)
parentb40e8fecc22773142184398f3c83f1a901d8124a (diff)
Merge "[Lut NDK] Add static_assert to ensure that ADISPLAYLUTS_SAMPLINGKEY_CIE_Y is the same as android::gui::LutProperties::SamplingKey::CIE_Y." into main
-rw-r--r--native/android/display_luts.cpp9
-rw-r--r--native/android/surface_control.cpp2
2 files changed, 7 insertions, 4 deletions
diff --git a/native/android/display_luts.cpp b/native/android/display_luts.cpp
index 179a32bd1c03..b03a718d4a65 100644
--- a/native/android/display_luts.cpp
+++ b/native/android/display_luts.cpp
@@ -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) {
diff --git a/native/android/surface_control.cpp b/native/android/surface_control.cpp
index 6bca1456db3a..4fe0b80f3951 100644
--- a/native/android/surface_control.cpp
+++ b/native/android/surface_control.cpp
@@ -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);