| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 61 | 61 | 
| 62 WindowTreeData::~WindowTreeData() {} | 62 WindowTreeData::~WindowTreeData() {} | 
| 63 | 63 | 
| 64 aura::Window* WindowTreeData::bitmap_window() { | 64 aura::Window* WindowTreeData::bitmap_window() { | 
| 65   DCHECK(!window_tree_host_->window()->children().empty()); | 65   DCHECK(!window_tree_host_->window()->children().empty()); | 
| 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   if (window_tree_host) { | 
| 72   window_tree_host->Show(); | 72     window_tree_host->InitHost(); | 
| 73   // Take ownership of the WTH. | 73     window_tree_host->Show(); | 
| 74   window_tree_host_ = std::move(window_tree_host); | 74     SetWindowTreeHost(std::move(window_tree_host)); | 
|  | 75   } | 
| 75 | 76 | 
| 76   // Initialize the window for the bitmap. | 77   // Initialize the window for the bitmap. | 
| 77   window_delegate_ = new aura_extra::ImageWindowDelegate(); | 78   window_delegate_ = new aura_extra::ImageWindowDelegate(); | 
| 78   aura::Window* root_window = window_tree_host_->window(); | 79   aura::Window* root_window = window_tree_host_->window(); | 
| 79   aura::Window* bitmap_window = new aura::Window(window_delegate_); | 80   aura::Window* bitmap_window = new aura::Window(window_delegate_); | 
| 80   bitmap_window->Init(LAYER_TEXTURED); | 81   bitmap_window->Init(LAYER_TEXTURED); | 
| 81   bitmap_window->SetBounds(gfx::Rect(root_window->bounds().size())); | 82   bitmap_window->SetBounds(gfx::Rect(root_window->bounds().size())); | 
| 82   bitmap_window->Show(); | 83   bitmap_window->Show(); | 
| 83   bitmap_window->SetName("Bitmap"); | 84   bitmap_window->SetName("Bitmap"); | 
| 84   root_window->AddChild(bitmap_window); | 85   root_window->AddChild(bitmap_window); | 
| (...skipping 27 matching lines...) Expand all  Loading... | 
| 112   gfx::ImageSkiaRep image_skia_rep(bitmap, 1); | 113   gfx::ImageSkiaRep image_skia_rep(bitmap, 1); | 
| 113   gfx::ImageSkia image_skia(image_skia_rep); | 114   gfx::ImageSkia image_skia(image_skia_rep); | 
| 114   gfx::Image image(image_skia); | 115   gfx::Image image(image_skia); | 
| 115 | 116 | 
| 116   window_delegate_->SetImage(image); | 117   window_delegate_->SetImage(image); | 
| 117   bitmap_window()->SchedulePaintInRect(gfx::Rect(bounds.size())); | 118   bitmap_window()->SchedulePaintInRect(gfx::Rect(bounds.size())); | 
| 118 } | 119 } | 
| 119 | 120 | 
| 120 }  // namespace demo | 121 }  // namespace demo | 
| 121 }  // namespace ui | 122 }  // namespace ui | 
| OLD | NEW | 
|---|