blob: 00323dc4f21d885ed1b2d9e35a59ecad0c939656 [file] [log] [blame]
The Android Open Source Projectedbf3b62009-03-04 03:31:441/*
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-20 02:08:1018#include <binder/Parcel.h>
Mathias Agopian90ac7992012-02-26 02:48:3519#include <gui/ISurfaceComposerClient.h>
Andy McFadden2adaf042012-12-18 17:49:4520#include <gui/IGraphicBufferProducer.h>
Mathias Agopian90ac7992012-02-26 02:48:3521#include <private/gui/LayerState.h>
The Android Open Source Projectedbf3b62009-03-04 03:31:4422
23namespace android {
24
25status_t layer_state_t::write(Parcel& output) const
26{
Mathias Agopianac9fa422013-02-12 00:40:3627 output.writeStrongBinder(surface);
Dan Stozad723bd72014-11-18 18:24:0328 output.writeUint32(what);
Mathias Agopianac9fa422013-02-12 00:40:3629 output.writeFloat(x);
30 output.writeFloat(y);
Dan Stozad723bd72014-11-18 18:24:0331 output.writeUint32(z);
32 output.writeUint32(w);
33 output.writeUint32(h);
34 output.writeUint32(layerStack);
Mathias Agopianac9fa422013-02-12 00:40:3635 output.writeFloat(alpha);
Dan Stozad723bd72014-11-18 18:24:0336 output.writeUint32(flags);
37 output.writeUint32(mask);
Mathias Agopianac9fa422013-02-12 00:40:3638 *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-04 03:31:4443}
44
45status_t layer_state_t::read(const Parcel& input)
46{
Mathias Agopianac9fa422013-02-12 00:40:3647 surface = input.readStrongBinder();
Dan Stozad723bd72014-11-18 18:24:0348 what = input.readUint32();
Mathias Agopianac9fa422013-02-12 00:40:3649 x = input.readFloat();
50 y = input.readFloat();
Dan Stozad723bd72014-11-18 18:24:0351 z = input.readUint32();
52 w = input.readUint32();
53 h = input.readUint32();
54 layerStack = input.readUint32();
Mathias Agopianac9fa422013-02-12 00:40:3655 alpha = input.readFloat();
Dan Stozad723bd72014-11-18 18:24:0356 flags = static_cast<uint8_t>(input.readUint32());
57 mask = static_cast<uint8_t>(input.readUint32());
Michael Lentine8afa1c42014-10-31 18:10:1358 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-12 00:40:3664 input.read(crop);
65 input.read(transparentRegion);
The Android Open Source Projectedbf3b62009-03-04 03:31:4466 return NO_ERROR;
67}
68
Mathias Agopian698c0872011-06-29 02:09:3169status_t ComposerState::write(Parcel& output) const {
Marco Nelissen2ea926b2014-11-14 16:01:0170 output.writeStrongBinder(IInterface::asBinder(client));
Mathias Agopian698c0872011-06-29 02:09:3171 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-25 03:43:5479
80status_t DisplayState::write(Parcel& output) const {
Mathias Agopiane57f2922012-08-09 23:29:1281 output.writeStrongBinder(token);
Marco Nelissen2ea926b2014-11-14 16:01:0182 output.writeStrongBinder(IInterface::asBinder(surface));
Dan Stozad723bd72014-11-18 18:24:0383 output.writeUint32(what);
84 output.writeUint32(layerStack);
85 output.writeUint32(orientation);
Mathias Agopian8683fca2012-08-13 02:37:1686 output.write(viewport);
87 output.write(frame);
Dan Stozad723bd72014-11-18 18:24:0388 output.writeUint32(width);
89 output.writeUint32(height);
Mathias Agopian8b33f032012-07-25 03:43:5490 return NO_ERROR;
91}
92
93status_t DisplayState::read(const Parcel& input) {
Mathias Agopiane57f2922012-08-09 23:29:1294 token = input.readStrongBinder();
Andy McFadden2adaf042012-12-18 17:49:4595 surface = interface_cast<IGraphicBufferProducer>(input.readStrongBinder());
Dan Stozad723bd72014-11-18 18:24:0396 what = input.readUint32();
97 layerStack = input.readUint32();
98 orientation = input.readUint32();
Mathias Agopian8683fca2012-08-13 02:37:1699 input.read(viewport);
100 input.read(frame);
Dan Stozad723bd72014-11-18 18:24:03101 width = input.readUint32();
102 height = input.readUint32();
Mathias Agopian8b33f032012-07-25 03:43:54103 return NO_ERROR;
104}
105
106
The Android Open Source Projectedbf3b62009-03-04 03:31:44107}; // namespace android