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

Side by Side Diff: cc/ipc/surface_info_struct_traits.h

Issue 2610723002: Unify SurfaceInfo (Closed)
Patch Set: Cleanup offscreen canvas Created 3 years, 11 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 | « cc/ipc/surface_info.typemap ('k') | cc/ipc/typemaps.gni » ('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 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_SURFACE_INFO_STRUCT_TRAITS_H_
6 #define CC_IPC_SURFACE_INFO_STRUCT_TRAITS_H_
7
8 #include "cc/ipc/surface_info.mojom-shared.h"
9 #include "cc/surfaces/surface_info.h"
10
11 namespace mojo {
12
13 template <>
14 struct StructTraits<cc::mojom::SurfaceInfoDataView, cc::SurfaceInfo> {
15 static const cc::SurfaceId& surface_id(const cc::SurfaceInfo& surface_info) {
16 return surface_info.id();
17 }
18
19 static float device_scale_factor(const cc::SurfaceInfo& surface_info) {
20 return surface_info.device_scale_factor();
21 }
22
23 static const gfx::Size& size_in_pixels(const cc::SurfaceInfo& surface_info) {
24 return surface_info.size_in_pixels();
25 }
26
27 static bool Read(cc::mojom::SurfaceInfoDataView data, cc::SurfaceInfo* out) {
28 out->device_scale_factor_ = data.device_scale_factor();
29 return data.ReadSurfaceId(&out->id_) &&
30 data.ReadSizeInPixels(&out->size_in_pixels_);
31 }
32 };
33
34 } // namespace mojo
35
36 #endif // CC_IPC_SURFACE_INFO_STRUCT_TRAITS_H_
OLDNEW
« no previous file with comments | « cc/ipc/surface_info.typemap ('k') | cc/ipc/typemaps.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698