| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 "services/ui/demo/mus_demo.h" | 5 #include "services/ui/demo/mus_demo.h" |
| 6 | 6 |
| 7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
| 8 #include "components/bitmap_uploader/bitmap_uploader.h" | 8 #include "components/bitmap_uploader/bitmap_uploader.h" |
| 9 #include "services/shell/public/cpp/connector.h" | 9 #include "services/shell/public/cpp/connector.h" |
| 10 #include "services/ui/common/gpu_service.h" | 10 #include "services/ui/common/gpu_service.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // Initialize bitmap uploader for sending frames to MUS. | 119 // Initialize bitmap uploader for sending frames to MUS. |
| 120 uploader_.reset(new bitmap_uploader::BitmapUploader(window_)); | 120 uploader_.reset(new bitmap_uploader::BitmapUploader(window_)); |
| 121 uploader_->Init(connector_); | 121 uploader_->Init(connector_); |
| 122 | 122 |
| 123 // Draw initial frame and start the timer to regularly draw frames. | 123 // Draw initial frame and start the timer to regularly draw frames. |
| 124 DrawFrame(); | 124 DrawFrame(); |
| 125 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kFrameDelay), | 125 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kFrameDelay), |
| 126 base::Bind(&MusDemo::DrawFrame, base::Unretained(this))); | 126 base::Bind(&MusDemo::DrawFrame, base::Unretained(this))); |
| 127 } | 127 } |
| 128 | 128 |
| 129 void MusDemo::OnAccelerator(uint32_t id, const ui::Event& event) { | |
| 130 // Don't care | |
| 131 } | |
| 132 | |
| 133 void MusDemo::OnWmPerformMoveLoop(ui::Window* window, | 129 void MusDemo::OnWmPerformMoveLoop(ui::Window* window, |
| 134 ui::mojom::MoveLoopSource source, | 130 ui::mojom::MoveLoopSource source, |
| 135 const gfx::Point& cursor_location, | 131 const gfx::Point& cursor_location, |
| 136 const base::Callback<void(bool)>& on_done) { | 132 const base::Callback<void(bool)>& on_done) { |
| 137 // Don't care | 133 // Don't care |
| 138 } | 134 } |
| 139 | 135 |
| 140 void MusDemo::OnWmCancelMoveLoop(ui::Window* window) {} | 136 void MusDemo::OnWmCancelMoveLoop(ui::Window* window) {} |
| 141 | 137 |
| 142 void MusDemo::AllocBitmap() { | 138 void MusDemo::AllocBitmap() { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 std::unique_ptr<std::vector<unsigned char>> data( | 175 std::unique_ptr<std::vector<unsigned char>> data( |
| 180 new std::vector<unsigned char>(addr, addr + bytes)); | 176 new std::vector<unsigned char>(addr, addr + bytes)); |
| 181 bitmap_.unlockPixels(); | 177 bitmap_.unlockPixels(); |
| 182 | 178 |
| 183 // Send frame to MUS via BitmapUploader. | 179 // Send frame to MUS via BitmapUploader. |
| 184 uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data), | 180 uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data), |
| 185 bitmap_uploader::BitmapUploader::BGRA); | 181 bitmap_uploader::BitmapUploader::BGRA); |
| 186 } | 182 } |
| 187 | 183 |
| 188 } // namespace ui_demo | 184 } // namespace ui_demo |
| OLD | NEW |