| 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->id_namespace = input.id_namespace(); |
| 260 id->id_namespace = cc::SurfaceIdAllocator::NamespaceForId(input); | 260 id->local_id = input.local_id(); |
| 261 id->nonce = input.nonce(); |
| 261 return id; | 262 return id; |
| 262 } | 263 } |
| 263 | 264 |
| 264 // static | 265 // static |
| 265 cc::SurfaceId TypeConverter<cc::SurfaceId, SurfaceIdPtr>::Convert( | 266 cc::SurfaceId TypeConverter<cc::SurfaceId, SurfaceIdPtr>::Convert( |
| 266 const SurfaceIdPtr& input) { | 267 const SurfaceIdPtr& input) { |
| 267 uint64_t packed_id = input->id_namespace; | 268 return cc::SurfaceId(input->id_namespace, input->local_id, input->nonce); |
| 268 packed_id <<= 32ull; | |
| 269 packed_id |= input->local; | |
| 270 return cc::SurfaceId(packed_id); | |
| 271 } | 269 } |
| 272 | 270 |
| 273 // static | 271 // static |
| 274 ColorPtr TypeConverter<ColorPtr, SkColor>::Convert(const SkColor& input) { | 272 ColorPtr TypeConverter<ColorPtr, SkColor>::Convert(const SkColor& input) { |
| 275 ColorPtr color(Color::New()); | 273 ColorPtr color(Color::New()); |
| 276 color->rgba = input; | 274 color->rgba = input; |
| 277 return color; | 275 return color; |
| 278 } | 276 } |
| 279 | 277 |
| 280 // static | 278 // static |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 } | 626 } |
| 629 | 627 |
| 630 // static | 628 // static |
| 631 std::unique_ptr<cc::CompositorFrame> | 629 std::unique_ptr<cc::CompositorFrame> |
| 632 TypeConverter<std::unique_ptr<cc::CompositorFrame>, | 630 TypeConverter<std::unique_ptr<cc::CompositorFrame>, |
| 633 CompositorFramePtr>::Convert(const CompositorFramePtr& input) { | 631 CompositorFramePtr>::Convert(const CompositorFramePtr& input) { |
| 634 return ConvertToCompositorFrame(input, nullptr); | 632 return ConvertToCompositorFrame(input, nullptr); |
| 635 } | 633 } |
| 636 | 634 |
| 637 } // namespace mojo | 635 } // namespace mojo |
| OLD | NEW |