| 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 "components/mus/demo/mus_demo.h" | 5 #include "components/mus/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 "components/mus/public/cpp/window.h" | 9 #include "components/mus/public/cpp/window.h" |
| 10 #include "components/mus/public/cpp/window_tree_client.h" | 10 #include "components/mus/public/cpp/window_tree_client.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // Draw initial frame and start the timer to regularly draw frames. | 121 // Draw initial frame and start the timer to regularly draw frames. |
| 122 DrawFrame(); | 122 DrawFrame(); |
| 123 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kFrameDelay), | 123 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kFrameDelay), |
| 124 base::Bind(&MusDemo::DrawFrame, base::Unretained(this))); | 124 base::Bind(&MusDemo::DrawFrame, base::Unretained(this))); |
| 125 } | 125 } |
| 126 | 126 |
| 127 void MusDemo::OnAccelerator(uint32_t id, const ui::Event& event) { | 127 void MusDemo::OnAccelerator(uint32_t id, const ui::Event& event) { |
| 128 // Don't care | 128 // Don't care |
| 129 } | 129 } |
| 130 | 130 |
| 131 void MusDemo::OnWmPerformMoveLoop(uint32_t change_id, |
| 132 uint32_t window_id, |
| 133 const gfx::Point& cursor_location) { |
| 134 // Don't care |
| 135 } |
| 136 |
| 137 void MusDemo::OnWmCancelMoveLoop(uint32_t window_id) {} |
| 138 |
| 131 void MusDemo::AllocBitmap() { | 139 void MusDemo::AllocBitmap() { |
| 132 const gfx::Rect bounds = window_->GetBoundsInRoot(); | 140 const gfx::Rect bounds = window_->GetBoundsInRoot(); |
| 133 | 141 |
| 134 // Allocate bitmap the same size as the window for drawing. | 142 // Allocate bitmap the same size as the window for drawing. |
| 135 bitmap_.reset(); | 143 bitmap_.reset(); |
| 136 SkImageInfo image_info = SkImageInfo::MakeN32(bounds.width(), bounds.height(), | 144 SkImageInfo image_info = SkImageInfo::MakeN32(bounds.width(), bounds.height(), |
| 137 kPremul_SkAlphaType); | 145 kPremul_SkAlphaType); |
| 138 bitmap_.allocPixels(image_info); | 146 bitmap_.allocPixels(image_info); |
| 139 } | 147 } |
| 140 | 148 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 168 std::unique_ptr<std::vector<unsigned char>> data( | 176 std::unique_ptr<std::vector<unsigned char>> data( |
| 169 new std::vector<unsigned char>(addr, addr + bytes)); | 177 new std::vector<unsigned char>(addr, addr + bytes)); |
| 170 bitmap_.unlockPixels(); | 178 bitmap_.unlockPixels(); |
| 171 | 179 |
| 172 // Send frame to MUS via BitmapUploader. | 180 // Send frame to MUS via BitmapUploader. |
| 173 uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data), | 181 uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data), |
| 174 bitmap_uploader::BitmapUploader::BGRA); | 182 bitmap_uploader::BitmapUploader::BGRA); |
| 175 } | 183 } |
| 176 | 184 |
| 177 } // namespace mus_demo | 185 } // namespace mus_demo |
| OLD | NEW |