The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 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 | |
Mathias Agopian | 9cce325 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 17 | #ifndef ANDROID_SF_LAYER_STATE_H |
| 18 | #define ANDROID_SF_LAYER_STATE_H |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 19 | |
| 20 | #include <stdint.h> |
| 21 | #include <sys/types.h> |
| 22 | |
| 23 | #include <utils/Errors.h> |
| 24 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 25 | #include <ui/Region.h> |
Jamie Gennis | f15a83f | 2012-05-10 20:43:55 -0700 | [diff] [blame] | 26 | #include <ui/Rect.h> |
Mathias Agopian | 90ac799 | 2012-02-25 18:48:35 -0800 | [diff] [blame] | 27 | #include <gui/ISurface.h> |
Mathias Agopian | 9cce325 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 28 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 29 | namespace android { |
| 30 | |
| 31 | class Parcel; |
Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 32 | class ISurfaceComposerClient; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 33 | |
| 34 | struct layer_state_t { |
| 35 | |
Mathias Agopian | 3165cc2 | 2012-08-08 19:42:09 -0700 | [diff] [blame] | 36 | |
| 37 | enum { |
| 38 | eLayerHidden = 0x01, |
| 39 | }; |
| 40 | |
| 41 | enum { |
| 42 | ePositionChanged = 0x00000001, |
| 43 | eLayerChanged = 0x00000002, |
| 44 | eSizeChanged = 0x00000004, |
| 45 | eAlphaChanged = 0x00000008, |
| 46 | eMatrixChanged = 0x00000010, |
| 47 | eTransparentRegionChanged = 0x00000020, |
| 48 | eVisibilityChanged = 0x00000040, |
| 49 | eLayerStackChanged = 0x00000080, |
| 50 | eCropChanged = 0x00000100, |
| 51 | }; |
| 52 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 53 | layer_state_t() |
| 54 | : surface(0), what(0), |
Mathias Agopian | 8785578 | 2012-07-24 21:41:09 -0700 | [diff] [blame] | 55 | x(0), y(0), z(0), w(0), h(0), layerStack(0), |
Jeff Brown | 6501e99 | 2012-07-16 15:38:18 -0700 | [diff] [blame] | 56 | alpha(0), flags(0), mask(0), |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 57 | reserved(0) |
| 58 | { |
| 59 | matrix.dsdx = matrix.dtdy = 1.0f; |
| 60 | matrix.dsdy = matrix.dtdx = 0.0f; |
Jamie Gennis | f15a83f | 2012-05-10 20:43:55 -0700 | [diff] [blame] | 61 | crop.makeInvalid(); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 62 | } |
| 63 | |
| 64 | status_t write(Parcel& output) const; |
| 65 | status_t read(const Parcel& input); |
| 66 | |
| 67 | struct matrix22_t { |
| 68 | float dsdx; |
| 69 | float dtdx; |
| 70 | float dsdy; |
| 71 | float dtdy; |
| 72 | }; |
| 73 | SurfaceID surface; |
| 74 | uint32_t what; |
Mathias Agopian | 41b6aab | 2011-08-30 18:51:54 -0700 | [diff] [blame] | 75 | float x; |
| 76 | float y; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 77 | uint32_t z; |
| 78 | uint32_t w; |
| 79 | uint32_t h; |
Mathias Agopian | 8785578 | 2012-07-24 21:41:09 -0700 | [diff] [blame] | 80 | uint32_t layerStack; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 81 | float alpha; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 82 | uint8_t flags; |
| 83 | uint8_t mask; |
| 84 | uint8_t reserved; |
| 85 | matrix22_t matrix; |
Jamie Gennis | f15a83f | 2012-05-10 20:43:55 -0700 | [diff] [blame] | 86 | Rect crop; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 87 | // non POD must be last. see write/read |
| 88 | Region transparentRegion; |
| 89 | }; |
| 90 | |
Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 91 | struct ComposerState { |
| 92 | sp<ISurfaceComposerClient> client; |
| 93 | layer_state_t state; |
| 94 | status_t write(Parcel& output) const; |
| 95 | status_t read(const Parcel& input); |
| 96 | }; |
| 97 | |
Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 98 | struct DisplayState { |
Mathias Agopian | 3165cc2 | 2012-08-08 19:42:09 -0700 | [diff] [blame] | 99 | |
| 100 | enum { |
| 101 | eOrientationDefault = 0, |
| 102 | eOrientation90 = 1, |
| 103 | eOrientation180 = 2, |
| 104 | eOrientation270 = 3, |
| 105 | eOrientationUnchanged = 4, |
| 106 | eOrientationSwapMask = 0x01 |
| 107 | }; |
| 108 | |
Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 109 | enum { |
Mathias Agopian | 00e8c7a | 2012-09-04 19:30:46 -0700 | [diff] [blame] | 110 | eSurfaceChanged = 0x01, |
| 111 | eLayerStackChanged = 0x02, |
| 112 | eDisplayProjectionChanged = 0x04 |
Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 113 | }; |
| 114 | |
| 115 | uint32_t what; |
| 116 | sp<IBinder> token; |
Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 117 | sp<ISurfaceTexture> surface; |
Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 118 | uint32_t layerStack; |
| 119 | uint32_t orientation; |
| 120 | Rect viewport; |
| 121 | Rect frame; |
| 122 | status_t write(Parcel& output) const; |
| 123 | status_t read(const Parcel& input); |
Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 124 | }; |
| 125 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 126 | }; // namespace android |
| 127 | |
Mathias Agopian | 9cce325 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 128 | #endif // ANDROID_SF_LAYER_STATE_H |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 129 | |