OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "mojo/converters/surfaces/surfaces_type_converters.h" | 5 #include "mojo/converters/surfaces/surfaces_type_converters.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 } | 249 } |
250 return true; | 250 return true; |
251 } | 251 } |
252 | 252 |
253 } // namespace | 253 } // namespace |
254 | 254 |
255 // static | 255 // static |
256 SurfaceIdPtr TypeConverter<SurfaceIdPtr, cc::SurfaceId>::Convert( | 256 SurfaceIdPtr TypeConverter<SurfaceIdPtr, cc::SurfaceId>::Convert( |
257 const cc::SurfaceId& input) { | 257 const cc::SurfaceId& input) { |
258 SurfaceIdPtr id(SurfaceId::New()); | 258 SurfaceIdPtr id(SurfaceId::New()); |
259 id->local = static_cast<uint32_t>(input.id); | 259 id->local = input.local_id; |
260 id->id_namespace = cc::SurfaceIdAllocator::NamespaceForId(input); | 260 id->id_namespace = input.id_namespace; |
261 return id; | 261 return id; |
262 } | 262 } |
263 | 263 |
264 // static | 264 // static |
265 cc::SurfaceId TypeConverter<cc::SurfaceId, SurfaceIdPtr>::Convert( | 265 cc::SurfaceId TypeConverter<cc::SurfaceId, SurfaceIdPtr>::Convert( |
266 const SurfaceIdPtr& input) { | 266 const SurfaceIdPtr& input) { |
267 uint64_t packed_id = input->id_namespace; | 267 return cc::SurfaceId(input->id_namespace, input->local); |
268 packed_id <<= 32ull; | |
269 packed_id |= input->local; | |
270 return cc::SurfaceId(packed_id); | |
271 } | 268 } |
272 | 269 |
273 // static | 270 // static |
274 ColorPtr TypeConverter<ColorPtr, SkColor>::Convert(const SkColor& input) { | 271 ColorPtr TypeConverter<ColorPtr, SkColor>::Convert(const SkColor& input) { |
275 ColorPtr color(Color::New()); | 272 ColorPtr color(Color::New()); |
276 color->rgba = input; | 273 color->rgba = input; |
277 return color; | 274 return color; |
278 } | 275 } |
279 | 276 |
280 // static | 277 // static |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 } | 625 } |
629 | 626 |
630 // static | 627 // static |
631 std::unique_ptr<cc::CompositorFrame> | 628 std::unique_ptr<cc::CompositorFrame> |
632 TypeConverter<std::unique_ptr<cc::CompositorFrame>, | 629 TypeConverter<std::unique_ptr<cc::CompositorFrame>, |
633 CompositorFramePtr>::Convert(const CompositorFramePtr& input) { | 630 CompositorFramePtr>::Convert(const CompositorFramePtr& input) { |
634 return ConvertToCompositorFrame(input, nullptr); | 631 return ConvertToCompositorFrame(input, nullptr); |
635 } | 632 } |
636 | 633 |
637 } // namespace mojo | 634 } // namespace mojo |
OLD | NEW |