| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CC_IPC_TEXTURE_MAILBOX_STRUCT_TRAITS_H_ |
| 6 #define CC_IPC_TEXTURE_MAILBOX_STRUCT_TRAITS_H_ |
| 7 |
| 8 #include "cc/ipc/texture_mailbox.mojom-shared.h" |
| 9 #include "cc/resources/texture_mailbox.h" |
| 10 |
| 11 namespace mojo { |
| 12 |
| 13 template <> |
| 14 struct StructTraits<cc::mojom::TextureMailboxDataView, cc::TextureMailbox> { |
| 15 static const gpu::MailboxHolder& mailbox_holder( |
| 16 const cc::TextureMailbox& input) { |
| 17 return input.mailbox_holder_; |
| 18 } |
| 19 |
| 20 static const gfx::Size& size_in_pixels(const cc::TextureMailbox& input) { |
| 21 return input.size_in_pixels_; |
| 22 } |
| 23 |
| 24 static bool is_overlay_candidate(const cc::TextureMailbox& input) { |
| 25 return input.is_overlay_candidate_; |
| 26 } |
| 27 |
| 28 static bool is_backed_by_surface_texture(const cc::TextureMailbox& input) { |
| 29 #if defined(OS_ANDROID) |
| 30 return input.is_backed_by_surface_texture_; |
| 31 #else |
| 32 return false; |
| 33 #endif |
| 34 } |
| 35 |
| 36 static bool wants_promotion_hint(const cc::TextureMailbox& input) { |
| 37 #if defined(OS_ANDROID) |
| 38 return input.wants_promotion_hint_; |
| 39 #else |
| 40 return false; |
| 41 #endif |
| 42 } |
| 43 |
| 44 static bool secure_output_only(const cc::TextureMailbox& input) { |
| 45 return input.secure_output_only_; |
| 46 } |
| 47 |
| 48 static bool nearest_neighbor(const cc::TextureMailbox& input) { |
| 49 return input.nearest_neighbor_; |
| 50 } |
| 51 |
| 52 static const gfx::ColorSpace& color_space(const cc::TextureMailbox& input) { |
| 53 return input.color_space_; |
| 54 } |
| 55 |
| 56 static bool Read(cc::mojom::TextureMailboxDataView data, |
| 57 cc::TextureMailbox* out) { |
| 58 #if defined(OS_ANDROID) |
| 59 out->is_backed_by_surface_texture_ = data.is_backed_by_surface_texture(); |
| 60 out->wants_promotion_hint_ = data.wants_promotion_hint(); |
| 61 #endif |
| 62 out->is_overlay_candidate_ = data.is_overlay_candidate(); |
| 63 out->secure_output_only_ = data.secure_output_only(); |
| 64 out->nearest_neighbor_ = data.nearest_neighbor(); |
| 65 |
| 66 return data.ReadMailboxHolder(&out->mailbox_holder_) && |
| 67 data.ReadSizeInPixels(&out->size_in_pixels_) && |
| 68 data.ReadColorSpace(&out->color_space_); |
| 69 } |
| 70 }; |
| 71 |
| 72 } // namespace mojo |
| 73 |
| 74 #endif // CC_IPC_TEXTURE_MAILBOX_STRUCT_TRAITS_H_ |
| OLD | NEW |