blob: e2604f8e206f72b39f08d5f6f45e1cdcb6752855 [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>
Mathias Agopian8b33f032012-07-24 20:43:54 -070020#include <gui/ISurfaceTexture.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 Agopianb6121422010-02-17 20:22:26 -080027 status_t err;
28
Mathias Agopian8683fca2012-08-12 19:37:16 -070029 err = output.write(transparentRegion);
Mathias Agopianb6121422010-02-17 20:22:26 -080030 if (err < NO_ERROR) return err;
31
32 // NOTE: regions are at the end of the structure
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080033 size_t size = sizeof(layer_state_t);
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080034 size -= sizeof(transparentRegion);
Mathias Agopianb6121422010-02-17 20:22:26 -080035 err = output.write(this, size);
36 return err;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080037}
38
39status_t layer_state_t::read(const Parcel& input)
40{
Mathias Agopianb6121422010-02-17 20:22:26 -080041 status_t err;
Mathias Agopianb6121422010-02-17 20:22:26 -080042
Mathias Agopian8683fca2012-08-12 19:37:16 -070043 err = input.read(transparentRegion);
Mathias Agopianb6121422010-02-17 20:22:26 -080044 if (err < NO_ERROR) return err;
45
46 // NOTE: regions are at the end of the structure
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080047 size_t size = sizeof(layer_state_t);
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080048 size -= sizeof(transparentRegion);
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080049 input.read(this, size);
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080050 return NO_ERROR;
51}
52
Mathias Agopian698c0872011-06-28 19:09:31 -070053status_t ComposerState::write(Parcel& output) const {
54 output.writeStrongBinder(client->asBinder());
55 return state.write(output);
56}
57
58status_t ComposerState::read(const Parcel& input) {
59 client = interface_cast<ISurfaceComposerClient>(input.readStrongBinder());
60 return state.read(input);
61}
62
Mathias Agopian8b33f032012-07-24 20:43:54 -070063
64status_t DisplayState::write(Parcel& output) const {
Mathias Agopiane57f2922012-08-09 16:29:12 -070065 output.writeStrongBinder(token);
Mathias Agopian8b33f032012-07-24 20:43:54 -070066 output.writeStrongBinder(surface->asBinder());
Mathias Agopiane57f2922012-08-09 16:29:12 -070067 output.writeInt32(what);
Mathias Agopian8b33f032012-07-24 20:43:54 -070068 output.writeInt32(layerStack);
69 output.writeInt32(orientation);
Mathias Agopian8683fca2012-08-12 19:37:16 -070070 output.write(viewport);
71 output.write(frame);
Mathias Agopian8b33f032012-07-24 20:43:54 -070072 return NO_ERROR;
73}
74
75status_t DisplayState::read(const Parcel& input) {
Mathias Agopiane57f2922012-08-09 16:29:12 -070076 token = input.readStrongBinder();
Mathias Agopian8b33f032012-07-24 20:43:54 -070077 surface = interface_cast<ISurfaceTexture>(input.readStrongBinder());
Mathias Agopiane57f2922012-08-09 16:29:12 -070078 what = input.readInt32();
Mathias Agopian8b33f032012-07-24 20:43:54 -070079 layerStack = input.readInt32();
80 orientation = input.readInt32();
Mathias Agopian8683fca2012-08-12 19:37:16 -070081 input.read(viewport);
82 input.read(frame);
Mathias Agopian8b33f032012-07-24 20:43:54 -070083 return NO_ERROR;
84}
85
86
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080087}; // namespace android