blob: bf4bf034ff26afb30eba8a94c538708abacd5ee5 [file] [log] [blame]
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -08001/*
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 Agopian9cce3252010-02-09 17:46:37 -080017#ifndef ANDROID_SF_LAYER_STATE_H
18#define ANDROID_SF_LAYER_STATE_H
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080019
20#include <stdint.h>
21#include <sys/types.h>
22
23#include <utils/Errors.h>
24
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080025#include <ui/Region.h>
Jamie Gennisf15a83f2012-05-10 20:43:55 -070026#include <ui/Rect.h>
Mathias Agopian9cce3252010-02-09 17:46:37 -080027
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080028namespace android {
29
30class Parcel;
Mathias Agopian698c0872011-06-28 19:09:31 -070031class ISurfaceComposerClient;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080032
33struct layer_state_t {
34
Mathias Agopian3165cc22012-08-08 19:42:09 -070035
36 enum {
37 eLayerHidden = 0x01,
38 };
39
40 enum {
41 ePositionChanged = 0x00000001,
42 eLayerChanged = 0x00000002,
43 eSizeChanged = 0x00000004,
44 eAlphaChanged = 0x00000008,
45 eMatrixChanged = 0x00000010,
46 eTransparentRegionChanged = 0x00000020,
47 eVisibilityChanged = 0x00000040,
48 eLayerStackChanged = 0x00000080,
49 eCropChanged = 0x00000100,
50 };
51
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080052 layer_state_t()
Mathias Agopianac9fa422013-02-11 16:40:36 -080053 : what(0),
Mathias Agopian87855782012-07-24 21:41:09 -070054 x(0), y(0), z(0), w(0), h(0), layerStack(0),
Jeff Brown6501e992012-07-16 15:38:18 -070055 alpha(0), flags(0), mask(0),
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080056 reserved(0)
57 {
58 matrix.dsdx = matrix.dtdy = 1.0f;
59 matrix.dsdy = matrix.dtdx = 0.0f;
Jamie Gennisf15a83f2012-05-10 20:43:55 -070060 crop.makeInvalid();
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080061 }
62
63 status_t write(Parcel& output) const;
64 status_t read(const Parcel& input);
65
66 struct matrix22_t {
67 float dsdx;
68 float dtdx;
69 float dsdy;
70 float dtdy;
71 };
Mathias Agopianac9fa422013-02-11 16:40:36 -080072 sp<IBinder> surface;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080073 uint32_t what;
Mathias Agopian41b6aab2011-08-30 18:51:54 -070074 float x;
75 float y;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080076 uint32_t z;
77 uint32_t w;
78 uint32_t h;
Mathias Agopian87855782012-07-24 21:41:09 -070079 uint32_t layerStack;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080080 float alpha;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080081 uint8_t flags;
82 uint8_t mask;
83 uint8_t reserved;
84 matrix22_t matrix;
Jamie Gennisf15a83f2012-05-10 20:43:55 -070085 Rect crop;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080086 // non POD must be last. see write/read
87 Region transparentRegion;
88};
89
Mathias Agopian698c0872011-06-28 19:09:31 -070090struct ComposerState {
91 sp<ISurfaceComposerClient> client;
92 layer_state_t state;
93 status_t write(Parcel& output) const;
94 status_t read(const Parcel& input);
95};
96
Mathias Agopian8b33f032012-07-24 20:43:54 -070097struct DisplayState {
Mathias Agopian3165cc22012-08-08 19:42:09 -070098
99 enum {
100 eOrientationDefault = 0,
101 eOrientation90 = 1,
102 eOrientation180 = 2,
103 eOrientation270 = 3,
104 eOrientationUnchanged = 4,
105 eOrientationSwapMask = 0x01
106 };
107
Mathias Agopiane57f2922012-08-09 16:29:12 -0700108 enum {
Mathias Agopian00e8c7a2012-09-04 19:30:46 -0700109 eSurfaceChanged = 0x01,
110 eLayerStackChanged = 0x02,
111 eDisplayProjectionChanged = 0x04
Mathias Agopiane57f2922012-08-09 16:29:12 -0700112 };
113
114 uint32_t what;
115 sp<IBinder> token;
Andy McFadden2adaf042012-12-18 09:49:45 -0800116 sp<IGraphicBufferProducer> surface;
Mathias Agopiane57f2922012-08-09 16:29:12 -0700117 uint32_t layerStack;
118 uint32_t orientation;
119 Rect viewport;
120 Rect frame;
121 status_t write(Parcel& output) const;
122 status_t read(const Parcel& input);
Mathias Agopian8b33f032012-07-24 20:43:54 -0700123};
124
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800125}; // namespace android
126
Mathias Agopian9cce3252010-02-09 17:46:37 -0800127#endif // ANDROID_SF_LAYER_STATE_H
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800128