blob: 39f8f92f71c57dd54f1fa18caeac59ed9c8ec753 [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
17#include <utils/Errors.h>
Mathias Agopianc5b2c0b2009-05-19 19:08:10 -070018#include <binder/Parcel.h>
Mathias Agopian90ac7992012-02-25 18:48:35 -080019#include <gui/ISurfaceComposerClient.h>
Andy McFadden2adaf042012-12-18 09:49:45 -080020#include <gui/IGraphicBufferProducer.h>
Mathias Agopian90ac7992012-02-25 18:48:35 -080021#include <private/gui/LayerState.h>
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080022
23namespace android {
24
25status_t layer_state_t::write(Parcel& output) const
26{
Mathias Agopianac9fa422013-02-11 16:40:36 -080027 output.writeStrongBinder(surface);
28 output.writeInt32(what);
29 output.writeFloat(x);
30 output.writeFloat(y);
31 output.writeInt32(z);
32 output.writeInt32(w);
33 output.writeInt32(h);
34 output.writeInt32(layerStack);
35 output.writeFloat(alpha);
36 output.writeInt32(flags);
37 output.writeInt32(mask);
38 *reinterpret_cast<layer_state_t::matrix22_t *>(
39 output.writeInplace(sizeof(layer_state_t::matrix22_t))) = matrix;
40 output.write(crop);
41 output.write(transparentRegion);
42 return NO_ERROR;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080043}
44
45status_t layer_state_t::read(const Parcel& input)
46{
Mathias Agopianac9fa422013-02-11 16:40:36 -080047 surface = input.readStrongBinder();
48 what = input.readInt32();
49 x = input.readFloat();
50 y = input.readFloat();
51 z = input.readInt32();
52 w = input.readInt32();
53 h = input.readInt32();
54 layerStack = input.readInt32();
55 alpha = input.readFloat();
56 flags = input.readInt32();
57 mask = input.readInt32();
Michael Lentine8afa1c42014-10-31 11:10:13 -070058 const void* matrix_data = input.readInplace(sizeof(layer_state_t::matrix22_t));
59 if (matrix_data) {
60 matrix = *reinterpret_cast<layer_state_t::matrix22_t const *>(matrix_data);
61 } else {
62 return BAD_VALUE;
63 }
Mathias Agopianac9fa422013-02-11 16:40:36 -080064 input.read(crop);
65 input.read(transparentRegion);
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080066 return NO_ERROR;
67}
68
Mathias Agopian698c0872011-06-28 19:09:31 -070069status_t ComposerState::write(Parcel& output) const {
70 output.writeStrongBinder(client->asBinder());
71 return state.write(output);
72}
73
74status_t ComposerState::read(const Parcel& input) {
75 client = interface_cast<ISurfaceComposerClient>(input.readStrongBinder());
76 return state.read(input);
77}
78
Mathias Agopian8b33f032012-07-24 20:43:54 -070079
80status_t DisplayState::write(Parcel& output) const {
Mathias Agopiane57f2922012-08-09 16:29:12 -070081 output.writeStrongBinder(token);
Dan Albert1474f882014-09-08 18:59:09 -070082 output.writeStrongBinder(surface != NULL ? surface->asBinder() : NULL);
Mathias Agopiane57f2922012-08-09 16:29:12 -070083 output.writeInt32(what);
Mathias Agopian8b33f032012-07-24 20:43:54 -070084 output.writeInt32(layerStack);
85 output.writeInt32(orientation);
Mathias Agopian8683fca2012-08-12 19:37:16 -070086 output.write(viewport);
87 output.write(frame);
Michael Lentine47e45402014-07-18 15:34:25 -070088 output.writeInt32(width);
89 output.writeInt32(height);
Mathias Agopian8b33f032012-07-24 20:43:54 -070090 return NO_ERROR;
91}
92
93status_t DisplayState::read(const Parcel& input) {
Mathias Agopiane57f2922012-08-09 16:29:12 -070094 token = input.readStrongBinder();
Andy McFadden2adaf042012-12-18 09:49:45 -080095 surface = interface_cast<IGraphicBufferProducer>(input.readStrongBinder());
Mathias Agopiane57f2922012-08-09 16:29:12 -070096 what = input.readInt32();
Mathias Agopian8b33f032012-07-24 20:43:54 -070097 layerStack = input.readInt32();
98 orientation = input.readInt32();
Mathias Agopian8683fca2012-08-12 19:37:16 -070099 input.read(viewport);
100 input.read(frame);
Michael Lentine47e45402014-07-18 15:34:25 -0700101 width = input.readInt32();
102 height = input.readInt32();
Mathias Agopian8b33f032012-07-24 20:43:54 -0700103 return NO_ERROR;
104}
105
106
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800107}; // namespace android