The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 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 Agopian | c5b2c0b | 2009-05-19 19:08:10 -0700 | [diff] [blame] | 18 | #include <binder/Parcel.h> |
Mathias Agopian | 90ac799 | 2012-02-25 18:48:35 -0800 | [diff] [blame] | 19 | #include <gui/ISurfaceComposerClient.h> |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 20 | #include <gui/IGraphicBufferProducer.h> |
Mathias Agopian | 90ac799 | 2012-02-25 18:48:35 -0800 | [diff] [blame] | 21 | #include <private/gui/LayerState.h> |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 22 | |
| 23 | namespace android { |
| 24 | |
| 25 | status_t layer_state_t::write(Parcel& output) const |
| 26 | { |
Mathias Agopian | ac9fa42 | 2013-02-11 16:40:36 -0800 | [diff] [blame] | 27 | 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 Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | status_t layer_state_t::read(const Parcel& input) |
| 46 | { |
Mathias Agopian | ac9fa42 | 2013-02-11 16:40:36 -0800 | [diff] [blame] | 47 | 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(); |
| 58 | matrix = *reinterpret_cast<layer_state_t::matrix22_t const *>( |
| 59 | input.readInplace(sizeof(layer_state_t::matrix22_t))); |
| 60 | input.read(crop); |
| 61 | input.read(transparentRegion); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 62 | return NO_ERROR; |
| 63 | } |
| 64 | |
Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 65 | status_t ComposerState::write(Parcel& output) const { |
| 66 | output.writeStrongBinder(client->asBinder()); |
| 67 | return state.write(output); |
| 68 | } |
| 69 | |
| 70 | status_t ComposerState::read(const Parcel& input) { |
| 71 | client = interface_cast<ISurfaceComposerClient>(input.readStrongBinder()); |
| 72 | return state.read(input); |
| 73 | } |
| 74 | |
Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 75 | |
| 76 | status_t DisplayState::write(Parcel& output) const { |
Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 77 | output.writeStrongBinder(token); |
Dan Albert | 1474f88 | 2014-09-08 18:59:09 -0700 | [diff] [blame^] | 78 | output.writeStrongBinder(surface != NULL ? surface->asBinder() : NULL); |
Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 79 | output.writeInt32(what); |
Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 80 | output.writeInt32(layerStack); |
| 81 | output.writeInt32(orientation); |
Mathias Agopian | 8683fca | 2012-08-12 19:37:16 -0700 | [diff] [blame] | 82 | output.write(viewport); |
| 83 | output.write(frame); |
Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 84 | return NO_ERROR; |
| 85 | } |
| 86 | |
| 87 | status_t DisplayState::read(const Parcel& input) { |
Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 88 | token = input.readStrongBinder(); |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 89 | surface = interface_cast<IGraphicBufferProducer>(input.readStrongBinder()); |
Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 90 | what = input.readInt32(); |
Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 91 | layerStack = input.readInt32(); |
| 92 | orientation = input.readInt32(); |
Mathias Agopian | 8683fca | 2012-08-12 19:37:16 -0700 | [diff] [blame] | 93 | input.read(viewport); |
| 94 | input.read(frame); |
Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 95 | return NO_ERROR; |
| 96 | } |
| 97 | |
| 98 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 99 | }; // namespace android |