Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/window_tree_data.h" | 5 #include "services/ui/demo/window_tree_data.h" |
| 6 | 6 |
| 7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
| 8 #include "third_party/skia/include/core/SkBitmap.h" | 8 #include "third_party/skia/include/core/SkBitmap.h" |
| 9 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
| 10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 return window_tree_host_->window()->children()[0]; | 66 return window_tree_host_->window()->children()[0]; |
| 67 } | 67 } |
| 68 | 68 |
| 69 void WindowTreeData::Init( | 69 void WindowTreeData::Init( |
| 70 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { | 70 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { |
| 71 window_tree_host->InitHost(); | 71 window_tree_host->InitHost(); |
| 72 window_tree_host->Show(); | 72 window_tree_host->Show(); |
| 73 // Take ownership of the WTH. | 73 // Take ownership of the WTH. |
| 74 window_tree_host_ = std::move(window_tree_host); | 74 window_tree_host_ = std::move(window_tree_host); |
| 75 | 75 |
| 76 InitImpl(window_tree_host_.get()); | |
| 77 } | |
| 78 | |
| 79 void WindowTreeData::InitImpl(aura::WindowTreeHostMus* window_tree_host) { | |
|
fwang
2017/03/07 09:21:25
Let's keep this in one function and only do the ab
tonikitoo
2017/03/07 14:00:49
Done.
| |
| 76 // Initialize the window for the bitmap. | 80 // Initialize the window for the bitmap. |
| 77 window_delegate_ = new aura_extra::ImageWindowDelegate(); | 81 window_delegate_ = new aura_extra::ImageWindowDelegate(); |
| 78 aura::Window* root_window = window_tree_host_->window(); | 82 aura::Window* root_window = window_tree_host_->window(); |
| 79 aura::Window* bitmap_window = new aura::Window(window_delegate_); | 83 aura::Window* bitmap_window = new aura::Window(window_delegate_); |
| 80 bitmap_window->Init(LAYER_TEXTURED); | 84 bitmap_window->Init(LAYER_TEXTURED); |
| 81 bitmap_window->SetBounds(gfx::Rect(root_window->bounds().size())); | 85 bitmap_window->SetBounds(gfx::Rect(root_window->bounds().size())); |
| 82 bitmap_window->Show(); | 86 bitmap_window->Show(); |
| 83 bitmap_window->SetName("Bitmap"); | 87 bitmap_window->SetName("Bitmap"); |
| 84 root_window->AddChild(bitmap_window); | 88 root_window->AddChild(bitmap_window); |
| 85 | 89 |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 112 gfx::ImageSkiaRep image_skia_rep(bitmap, 1); | 116 gfx::ImageSkiaRep image_skia_rep(bitmap, 1); |
| 113 gfx::ImageSkia image_skia(image_skia_rep); | 117 gfx::ImageSkia image_skia(image_skia_rep); |
| 114 gfx::Image image(image_skia); | 118 gfx::Image image(image_skia); |
| 115 | 119 |
| 116 window_delegate_->SetImage(image); | 120 window_delegate_->SetImage(image); |
| 117 bitmap_window()->SchedulePaintInRect(gfx::Rect(bounds.size())); | 121 bitmap_window()->SchedulePaintInRect(gfx::Rect(bounds.size())); |
| 118 } | 122 } |
| 119 | 123 |
| 120 } // namespace demo | 124 } // namespace demo |
| 121 } // namespace ui | 125 } // namespace ui |
| OLD | NEW |