Chromium Code Reviews| 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_COPY_OUTPUT_RESULT_STRUCT_TRAITS_H_ | |
| 6 #define CC_IPC_COPY_OUTPUT_RESULT_STRUCT_TRAITS_H_ | |
| 7 | |
| 8 #include "cc/ipc/copy_output_result.mojom-shared.h" | |
| 9 #include "cc/output/copy_output_result.h" | |
| 10 | |
| 11 namespace mojo { | |
| 12 | |
| 13 template <> | |
| 14 struct StructTraits<cc::mojom::CopyOutputResultDataView, cc::CopyOutputResult> { | |
| 15 static const gfx::Size& size(const cc::CopyOutputResult& result) { | |
| 16 return result.size_; | |
| 17 } | |
| 18 | |
| 19 static const SkBitmap& bitmap(const cc::CopyOutputResult& result) { | |
| 20 static SkBitmap null_bitmap; | |
|
vmpstr
2017/01/31 21:32:19
nit: empty_bitmap
Ken Rockot(use gerrit already)
2017/01/31 21:46:20
Per the ongoing discussion linked earlier, please
Saman Sami
2017/02/01 15:51:57
Done.
Saman Sami
2017/02/01 15:51:57
This is a null bitmap though. IsNull() returns tru
Ken Rockot(use gerrit already)
2017/02/01 16:04:55
And perhaps more importantly, IsNull() returns tru
| |
| 21 if (!result.bitmap_) | |
| 22 return null_bitmap; | |
| 23 return *result.bitmap_; | |
| 24 } | |
| 25 | |
| 26 static const cc::TextureMailbox& texture_mailbox( | |
| 27 const cc::CopyOutputResult& result) { | |
| 28 return result.texture_mailbox_; | |
| 29 } | |
| 30 | |
| 31 static bool Read(cc::mojom::CopyOutputResultDataView data, | |
|
Ken Rockot(use gerrit already)
2017/01/31 21:46:20
nit: (sorry, overlooked this earlier) Please defin
Saman Sami
2017/02/01 15:51:57
Done.
| |
| 32 cc::CopyOutputResult* out) { | |
| 33 out->bitmap_ = base::MakeUnique<SkBitmap>(); | |
| 34 return data.ReadSize(&out->size_) && data.ReadBitmap(out->bitmap_.get()) && | |
| 35 data.ReadTextureMailbox(&out->texture_mailbox_); | |
| 36 } | |
| 37 }; | |
| 38 | |
| 39 } // namespace mojo | |
| 40 | |
| 41 #endif // CC_IPC_COPY_OUTPUT_RESULT_STRUCT_TRAITS_H_ | |
| OLD | NEW |