1 /* 2 * Copyright (C) 2024 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 19 #include <android/display_luts.h> 20 #include <stdint.h> 21 #include <vector> 22 #include <utils/RefBase.h> 23 24 using namespace android; 25 26 __BEGIN_DECLS 27 28 struct ADisplayLutsEntry_buffer { 29 std::vector<float> data; 30 }; 31 32 struct ADisplayLutsEntry_properties { 33 ADisplayLuts_Dimension dimension; 34 int32_t size; 35 ADisplayLuts_SamplingKey samplingKey; 36 }; 37 38 struct ADisplayLutsEntry: public RefBase { 39 struct ADisplayLutsEntry_buffer buffer; 40 struct ADisplayLutsEntry_properties properties; ADisplayLutsEntryADisplayLutsEntry41 ADisplayLutsEntry() {} 42 43 // copy constructor ADisplayLutsEntryADisplayLutsEntry44 ADisplayLutsEntry(const ADisplayLutsEntry& other) : 45 buffer(other.buffer), 46 properties(other.properties) {} 47 48 // copy operator 49 ADisplayLutsEntry& operator=(const ADisplayLutsEntry& other) { 50 if (this != &other) { // Protect against self-assignment 51 buffer = other.buffer; 52 properties = other.properties; 53 } 54 return *this; 55 } 56 }; 57 58 struct ADisplayLuts: public RefBase { 59 int32_t totalBufferSize; 60 std::vector<int32_t> offsets; 61 std::vector<sp<ADisplayLutsEntry>> entries; 62 ADisplayLutsADisplayLuts63 ADisplayLuts() : totalBufferSize(0) {} 64 }; 65 66 __END_DECLS