Chromium Code Reviews| Index: skia/public/interfaces/bitmap_array_struct_traits.h |
| diff --git a/skia/public/interfaces/bitmap_array_struct_traits.h b/skia/public/interfaces/bitmap_array_struct_traits.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1629e59022fbcfdc5505984b4bfe74213ef1c82e |
| --- /dev/null |
| +++ b/skia/public/interfaces/bitmap_array_struct_traits.h |
| @@ -0,0 +1,34 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef SKIA_PUBLIC_INTERFACES_BITMAP_ARRAY_STRUCT_TRAITS_H_ |
| +#define SKIA_PUBLIC_INTERFACES_BITMAP_ARRAY_STRUCT_TRAITS_H_ |
| + |
| +#include <vector> |
| + |
| +#include "skia/public/interfaces/bitmap_array.mojom.h" |
| +#include "third_party/skia/include/core/SkBitmap.h" |
| + |
| +namespace mojo { |
| + |
| +template <> |
| +struct StructTraits<skia::mojom::BitmapArray, std::vector<SkBitmap>> { |
| + static const std::vector<SkBitmap>& bitmaps( |
| + const std::vector<SkBitmap>& bitmaps) { |
| + return bitmaps; |
| + } |
| + |
| + static bool Read(skia::mojom::BitmapArrayDataView data, |
| + std::vector<SkBitmap>* out) { |
| + std::vector<SkBitmap> bitmaps; |
| + if (!data.ReadBitmaps(&bitmaps)) |
|
Fady Samuel
2016/06/23 21:45:12
It seems like you could simply:
data.ReadBitmaps(
rjkroege
2016/06/24 14:13:20
Thanks. Done.
|
| + return false; |
| + *out = std::move(bitmaps); |
| + return true; |
| + } |
| +}; |
| + |
| +} // namespace mojo |
| + |
| +#endif // SKIA_PUBLIC_INTERFACES_BITMAP_ARRAY_STRUCT_TRAITS_H_ |