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..cec17d659c612ba871b9878911b8cf9533bf5efb 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 RGBA |
+// 8888 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_ |