Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1237)

Side by Side Diff: components/arc/bitmap/bitmap_struct_traits.h

Issue 2308663002: Migrate ArcBitmap to use typemapping (Closed)
Patch Set: Addressed comment Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/arc/bitmap/OWNERS ('k') | components/arc/bitmap/bitmap_struct_traits.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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 COMPONENT_ARC_BITMAP_BITMAP_STRUCT_TRAITS_H_
6 #define COMPONENT_ARC_BITMAP_BITMAP_STRUCT_TRAITS_H_
7
8 #include "components/arc/common/bitmap.mojom.h"
9 #include "third_party/skia/include/core/SkBitmap.h"
10
11 namespace mojo {
12
13 template <>
14 struct StructTraits<arc::mojom::ArcBitmapDataView, SkBitmap> {
15 static const mojo::CArray<uint8_t> pixel_data(const SkBitmap& r) {
16 const SkImageInfo& info = r.info();
17 DCHECK_EQ(info.colorType(), kRGBA_8888_SkColorType);
18
19 return mojo::CArray<uint8_t>(
20 r.getSize(), r.getSize(), static_cast<uint8_t*>(r.getPixels()));
21 }
22 static uint32_t width(const SkBitmap& r) { return r.width(); }
23 static uint32_t height(const SkBitmap& r) { return r.height(); }
24
25 static bool Read(arc::mojom::ArcBitmapDataView data, SkBitmap* out);
26 };
27
28 }
29
30 #endif // COMPONENT_ARC_BITMAP_BITMAP_STRUCT_TRAITS_H_
OLDNEW
« no previous file with comments | « components/arc/bitmap/OWNERS ('k') | components/arc/bitmap/bitmap_struct_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698