Chromium Code Reviews| Index: components/mus/public/cpp/property_type_converters.h |
| diff --git a/components/mus/public/cpp/property_type_converters.h b/components/mus/public/cpp/property_type_converters.h |
| index eac34a8ef911ccd42f4777a2136b960e71cdf413..5f331f703081f493c1c2bdb0aeac298190e6d2f8 100644 |
| --- a/components/mus/public/cpp/property_type_converters.h |
| +++ b/components/mus/public/cpp/property_type_converters.h |
| @@ -11,6 +11,8 @@ |
| #include "base/strings/string16.h" |
| #include "mojo/public/cpp/bindings/type_converter.h" |
| +class SkBitmap; |
| + |
| namespace gfx { |
| class Rect; |
| class Size; |
| @@ -21,6 +23,8 @@ namespace mojo { |
| // TODO(beng): these methods serialize types used for standard properties |
| // to vectors of bytes used by Window::SetSharedProperty(). |
| // replace this with serialization code generated @ bindings. |
| +// This would be especially useful for SkBitmap, which could be |
| +// replaced with the skia.Bitmap mojom struct serialization. |
| template <> |
| struct TypeConverter<const std::vector<uint8_t>, gfx::Rect> { |
| @@ -67,6 +71,17 @@ struct TypeConverter<std::string, const std::vector<uint8_t>> { |
| static std::string Convert(const std::vector<uint8_t>& input); |
| }; |
| +// NOTE: These methods only serialize and deserialize the common case of ARGB |
|
msw
2016/03/24 17:40:54
nit: RGBA 8888, not ARGB, right? (as you say in th
James Cook
2016/03/25 15:39:28
Done.
|
| +// bitmaps with premultiplied alpha. |
| +template <> |
| +struct TypeConverter<const std::vector<uint8_t>, SkBitmap> { |
| + static const std::vector<uint8_t> Convert(const SkBitmap& input); |
| +}; |
| +template <> |
| +struct TypeConverter<SkBitmap, const std::vector<uint8_t>> { |
| + static SkBitmap Convert(const std::vector<uint8_t>& input); |
| +}; |
| + |
| } // namespace mojo |
| #endif // COMPONENTS_MUS_PUBLIC_CPP_PROPERTY_TYPE_CONVERTERS_H_ |