| 1 | /* |
| 2 | * Copyright 2018 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 | package android.hardware.display; |
| 18 | |
| 19 | /** |
| 20 | * @hide |
| 21 | */ |
| 22 | public final class DisplayedContentSamplingAttributes { |
| 23 | private int mPixelFormat; |
| 24 | private int mDataspace; |
| 25 | private int mComponentMask; |
| 26 | |
| 27 | /* Creates the attributes reported by the display hardware about what capabilities |
| 28 | * are present. |
| 29 | * |
| 30 | * NOTE: the format and ds constants must match the values from graphics/common/x.x/types.hal |
| 31 | * @param format the format that the display hardware samples in. |
| 32 | * @param ds the dataspace in use when sampling. |
| 33 | * @param componentMask a mask of which of the format components are supported. |
| 34 | */ |
| 35 | public DisplayedContentSamplingAttributes(int format, int ds, int componentMask) { |
| 36 | mPixelFormat = format; |
| 37 | mDataspace = ds; |
| 38 | mComponentMask = componentMask; |
| 39 | } |
| 40 | |
| 41 | /* Returns the pixel format that the display hardware uses when sampling. |
| 42 | * |
| 43 | * NOTE: the returned constant matches the values from graphics/common/x.x/types.hal |
| 44 | * @return the format that the samples were collected in. |
| 45 | */ |
| 46 | public int getPixelFormat() { |
| 47 | return mPixelFormat; |
| 48 | } |
| 49 | |
| 50 | /* Returns the dataspace that the display hardware uses when sampling. |
| 51 | * |
| 52 | * NOTE: the returned constant matches the values from graphics/common/x.x/types.hal |
| 53 | * @return the dataspace that the samples were collected in. |
| 54 | */ |
| 55 | public int getDataspace() { |
| 56 | return mDataspace; |
| 57 | } |
| 58 | |
| 59 | /* Returns a mask of which components can be collected by the sampling engine. |
| 60 | * |
| 61 | * @return a mask of the components which are supported by the engine. The lowest |
| 62 | * bit corresponds to the lowest component (ie, 0x1 corresponds to A for RGBA). |
| 63 | */ |
| 64 | public int getComponentMask() { |
| 65 | return mComponentMask; |
| 66 | } |
| 67 | } |