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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) { | 129 void MusDemo::OnAccelerator(uint32_t id, const ui::Event& event) { |
130 // Don't care | 130 // Don't care |
131 } | 131 } |
132 | 132 |
| 133 void MusDemo::OnWmPerformMoveLoop(ui::Window* window, |
| 134 ui::mojom::MoveLoopSource source, |
| 135 const gfx::Point& cursor_location, |
| 136 const base::Callback<void(bool)>& on_done) { |
| 137 // Don't care |
| 138 } |
| 139 |
| 140 void MusDemo::OnWmCancelMoveLoop(ui::Window* window) {} |
| 141 |
133 void MusDemo::AllocBitmap() { | 142 void MusDemo::AllocBitmap() { |
134 const gfx::Rect bounds = window_->GetBoundsInRoot(); | 143 const gfx::Rect bounds = window_->GetBoundsInRoot(); |
135 | 144 |
136 // Allocate bitmap the same size as the window for drawing. | 145 // Allocate bitmap the same size as the window for drawing. |
137 bitmap_.reset(); | 146 bitmap_.reset(); |
138 SkImageInfo image_info = SkImageInfo::MakeN32(bounds.width(), bounds.height(), | 147 SkImageInfo image_info = SkImageInfo::MakeN32(bounds.width(), bounds.height(), |
139 kPremul_SkAlphaType); | 148 kPremul_SkAlphaType); |
140 bitmap_.allocPixels(image_info); | 149 bitmap_.allocPixels(image_info); |
141 } | 150 } |
142 | 151 |
(...skipping 27 matching lines...) Expand all Loading... |
170 std::unique_ptr<std::vector<unsigned char>> data( | 179 std::unique_ptr<std::vector<unsigned char>> data( |
171 new std::vector<unsigned char>(addr, addr + bytes)); | 180 new std::vector<unsigned char>(addr, addr + bytes)); |
172 bitmap_.unlockPixels(); | 181 bitmap_.unlockPixels(); |
173 | 182 |
174 // Send frame to MUS via BitmapUploader. | 183 // Send frame to MUS via BitmapUploader. |
175 uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data), | 184 uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data), |
176 bitmap_uploader::BitmapUploader::BGRA); | 185 bitmap_uploader::BitmapUploader::BGRA); |
177 } | 186 } |
178 | 187 |
179 } // namespace ui_demo | 188 } // namespace ui_demo |
OLD | NEW |