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 "remoting/host/chromeos/skia_bitmap_desktop_frame.h" |
| 6 |
5 #include <stddef.h> | 7 #include <stddef.h> |
6 | 8 |
| 9 #include <utility> |
| 10 |
7 #include "base/logging.h" | 11 #include "base/logging.h" |
8 #include "remoting/host/chromeos/skia_bitmap_desktop_frame.h" | |
9 | 12 |
10 namespace remoting { | 13 namespace remoting { |
11 | 14 |
12 // static | 15 // static |
13 SkiaBitmapDesktopFrame* SkiaBitmapDesktopFrame::Create( | 16 SkiaBitmapDesktopFrame* SkiaBitmapDesktopFrame::Create( |
14 scoped_ptr<SkBitmap> bitmap) { | 17 scoped_ptr<SkBitmap> bitmap) { |
15 | 18 |
16 webrtc::DesktopSize size(bitmap->width(), bitmap->height()); | 19 webrtc::DesktopSize size(bitmap->width(), bitmap->height()); |
17 DCHECK_EQ(kBGRA_8888_SkColorType, bitmap->info().colorType()) | 20 DCHECK_EQ(kBGRA_8888_SkColorType, bitmap->info().colorType()) |
18 << "DesktopFrame objects always hold RGBA data."; | 21 << "DesktopFrame objects always hold RGBA data."; |
19 | 22 |
20 bitmap->lockPixels(); | 23 bitmap->lockPixels(); |
21 uint8_t* bitmap_data = reinterpret_cast<uint8_t*>(bitmap->getPixels()); | 24 uint8_t* bitmap_data = reinterpret_cast<uint8_t*>(bitmap->getPixels()); |
22 bitmap->unlockPixels(); | 25 bitmap->unlockPixels(); |
23 | 26 |
24 const size_t row_bytes = bitmap->rowBytes(); | 27 const size_t row_bytes = bitmap->rowBytes(); |
25 SkiaBitmapDesktopFrame* result = new SkiaBitmapDesktopFrame( | 28 SkiaBitmapDesktopFrame* result = new SkiaBitmapDesktopFrame( |
26 size, row_bytes, bitmap_data, bitmap.Pass()); | 29 size, row_bytes, bitmap_data, std::move(bitmap)); |
27 | 30 |
28 return result; | 31 return result; |
29 } | 32 } |
30 | 33 |
31 SkiaBitmapDesktopFrame::SkiaBitmapDesktopFrame(webrtc::DesktopSize size, | 34 SkiaBitmapDesktopFrame::SkiaBitmapDesktopFrame(webrtc::DesktopSize size, |
32 int stride, | 35 int stride, |
33 uint8_t* data, | 36 uint8_t* data, |
34 scoped_ptr<SkBitmap> bitmap) | 37 scoped_ptr<SkBitmap> bitmap) |
35 : DesktopFrame(size, stride, data, nullptr), bitmap_(bitmap.Pass()) { | 38 : DesktopFrame(size, stride, data, nullptr), bitmap_(std::move(bitmap)) {} |
36 } | |
37 | 39 |
38 SkiaBitmapDesktopFrame::~SkiaBitmapDesktopFrame() { | 40 SkiaBitmapDesktopFrame::~SkiaBitmapDesktopFrame() {} |
39 } | |
40 | 41 |
41 } // namespace remoting | 42 } // namespace remoting |
OLD | NEW |