2 * Copyright (C) 2008 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #include <utils/Errors.h>
18 #include <binder/Parcel.h>
19 #include <gui/ISurfaceComposerClient.h>
20 #include <gui/IGraphicBufferProducer.h>
21 #include <private/gui/LayerState.h>
25 status_t layer_state_t::write(Parcel& output) const
27 output.writeStrongBinder(surface);
28 output.writeUint32(what);
31 output.writeUint32(z);
32 output.writeUint32(w);
33 output.writeUint32(h);
34 output.writeUint32(layerStack);
35 output.writeFloat(blur);
36 output.writeStrongBinder(blurMaskSurface);
37 output.writeUint32(blurMaskSampling);
38 output.writeFloat(blurMaskAlphaThreshold);
39 output.writeFloat(alpha);
40 output.writeUint32(flags);
41 output.writeUint32(mask);
42 *reinterpret_cast<layer_state_t::matrix22_t *>(
43 output.writeInplace(sizeof(layer_state_t::matrix22_t))) = matrix;
45 output.write(finalCrop);
46 output.writeStrongBinder(handle);
47 output.writeUint64(frameNumber);
48 output.writeInt32(overrideScalingMode);
49 output.write(transparentRegion);
53 status_t layer_state_t::read(const Parcel& input)
55 surface = input.readStrongBinder();
56 what = input.readUint32();
57 x = input.readFloat();
58 y = input.readFloat();
59 z = input.readUint32();
60 w = input.readUint32();
61 h = input.readUint32();
62 layerStack = input.readUint32();
63 blur = input.readFloat();
64 blurMaskSurface = input.readStrongBinder();
65 blurMaskSampling = input.readUint32();
66 blurMaskAlphaThreshold = input.readFloat();
67 alpha = input.readFloat();
68 flags = static_cast<uint8_t>(input.readUint32());
69 mask = static_cast<uint8_t>(input.readUint32());
70 const void* matrix_data = input.readInplace(sizeof(layer_state_t::matrix22_t));
72 matrix = *reinterpret_cast<layer_state_t::matrix22_t const *>(matrix_data);
77 input.read(finalCrop);
78 handle = input.readStrongBinder();
79 frameNumber = input.readUint64();
80 overrideScalingMode = input.readInt32();
81 input.read(transparentRegion);
85 status_t ComposerState::write(Parcel& output) const {
86 output.writeStrongBinder(IInterface::asBinder(client));
87 return state.write(output);
90 status_t ComposerState::read(const Parcel& input) {
91 client = interface_cast<ISurfaceComposerClient>(input.readStrongBinder());
92 return state.read(input);
96 DisplayState::DisplayState() :
99 orientation(eOrientationDefault),
100 viewport(Rect::EMPTY_RECT),
101 frame(Rect::EMPTY_RECT),
106 status_t DisplayState::write(Parcel& output) const {
107 output.writeStrongBinder(token);
108 output.writeStrongBinder(IInterface::asBinder(surface));
109 output.writeUint32(what);
110 output.writeUint32(layerStack);
111 output.writeUint32(orientation);
112 output.write(viewport);
114 output.writeUint32(width);
115 output.writeUint32(height);
119 status_t DisplayState::read(const Parcel& input) {
120 token = input.readStrongBinder();
121 surface = interface_cast<IGraphicBufferProducer>(input.readStrongBinder());
122 what = input.readUint32();
123 layerStack = input.readUint32();
124 orientation = input.readUint32();
125 input.read(viewport);
127 width = input.readUint32();
128 height = input.readUint32();
133 }; // namespace android