| 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/common/gpu_service.h" |
| 9 #include "components/mus/public/cpp/window.h" | 10 #include "components/mus/public/cpp/window.h" |
| 10 #include "components/mus/public/cpp/window_tree_client.h" | 11 #include "components/mus/public/cpp/window_tree_client.h" |
| 11 #include "services/shell/public/cpp/connector.h" | 12 #include "services/shell/public/cpp/connector.h" |
| 12 #include "third_party/skia/include/core/SkCanvas.h" | 13 #include "third_party/skia/include/core/SkCanvas.h" |
| 13 #include "third_party/skia/include/core/SkColor.h" | 14 #include "third_party/skia/include/core/SkColor.h" |
| 14 #include "third_party/skia/include/core/SkImageInfo.h" | 15 #include "third_party/skia/include/core/SkImageInfo.h" |
| 15 #include "third_party/skia/include/core/SkPaint.h" | 16 #include "third_party/skia/include/core/SkPaint.h" |
| 16 #include "third_party/skia/include/core/SkRect.h" | 17 #include "third_party/skia/include/core/SkRect.h" |
| 17 #include "ui/gfx/geometry/rect.h" | 18 #include "ui/gfx/geometry/rect.h" |
| 18 | 19 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 MusDemo::MusDemo() {} | 60 MusDemo::MusDemo() {} |
| 60 | 61 |
| 61 MusDemo::~MusDemo() { | 62 MusDemo::~MusDemo() { |
| 62 delete window_tree_client_; | 63 delete window_tree_client_; |
| 63 } | 64 } |
| 64 | 65 |
| 65 void MusDemo::Initialize(shell::Connector* connector, | 66 void MusDemo::Initialize(shell::Connector* connector, |
| 66 const shell::Identity& identity, | 67 const shell::Identity& identity, |
| 67 uint32_t id) { | 68 uint32_t id) { |
| 68 connector_ = connector; | 69 connector_ = connector; |
| 70 mus::GpuService::GetInstance()->Initialize(connector_); |
| 69 window_tree_client_ = new mus::WindowTreeClient(this, this, nullptr); | 71 window_tree_client_ = new mus::WindowTreeClient(this, this, nullptr); |
| 70 window_tree_client_->ConnectAsWindowManager(connector); | 72 window_tree_client_->ConnectAsWindowManager(connector); |
| 71 } | 73 } |
| 72 | 74 |
| 73 bool MusDemo::AcceptConnection(shell::Connection* connection) { | 75 bool MusDemo::AcceptConnection(shell::Connection* connection) { |
| 74 return true; | 76 return true; |
| 75 } | 77 } |
| 76 | 78 |
| 77 void MusDemo::OnEmbed(mus::Window* window) { | 79 void MusDemo::OnEmbed(mus::Window* window) { |
| 78 // Not called for the WindowManager. | 80 // Not called for the WindowManager. |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 std::unique_ptr<std::vector<unsigned char>> data( | 170 std::unique_ptr<std::vector<unsigned char>> data( |
| 169 new std::vector<unsigned char>(addr, addr + bytes)); | 171 new std::vector<unsigned char>(addr, addr + bytes)); |
| 170 bitmap_.unlockPixels(); | 172 bitmap_.unlockPixels(); |
| 171 | 173 |
| 172 // Send frame to MUS via BitmapUploader. | 174 // Send frame to MUS via BitmapUploader. |
| 173 uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data), | 175 uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data), |
| 174 bitmap_uploader::BitmapUploader::BGRA); | 176 bitmap_uploader::BitmapUploader::BGRA); |
| 175 } | 177 } |
| 176 | 178 |
| 177 } // namespace mus_demo | 179 } // namespace mus_demo |
| OLD | NEW |