OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ash/wm/boot_splash_screen_chromeos.h" | 5 #include "ash/wm/boot_splash_screen_chromeos.h" |
6 | 6 |
7 #include "third_party/skia/include/core/SkBitmap.h" | 7 #include "third_party/skia/include/core/SkBitmap.h" |
8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
9 #include "ui/aura/window_tree_host.h" | 9 #include "ui/aura/window_tree_host.h" |
10 #include "ui/compositor/layer.h" | 10 #include "ui/compositor/layer.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 #if defined(USE_X11) | 27 #if defined(USE_X11) |
28 : host_(host) | 28 : host_(host) |
29 #endif | 29 #endif |
30 { | 30 { |
31 } | 31 } |
32 | 32 |
33 ~CopyHostContentLayerDelegate() override {} | 33 ~CopyHostContentLayerDelegate() override {} |
34 | 34 |
35 // ui::LayerDelegate overrides: | 35 // ui::LayerDelegate overrides: |
36 void OnPaintLayer(const ui::PaintContext& context) override { | 36 void OnPaintLayer(const ui::PaintContext& context) override { |
37 // It'd be safer to copy the area to a canvas in the constructor and then | 37 // It'd be safer to copy the area to a canvas in the constructor and then |
38 // copy from that canvas to this one here, but this appears to work (i.e. we | 38 // copy from that canvas to this one here, but this appears to work (i.e. we |
39 // only call this before we draw our first frame) and it saves us an extra | 39 // only call this before we draw our first frame) and it saves us an extra |
40 // copy. | 40 // copy. |
41 // TODO(derat): Instead of copying the data, use GLX_EXT_texture_from_pixmap | 41 // TODO(derat): Instead of copying the data, use GLX_EXT_texture_from_pixmap |
42 // to create a zero-copy texture (when possible): | 42 // to create a zero-copy texture (when possible): |
43 // https://codereview.chromium.org/10543125 | 43 // https://codereview.chromium.org/10543125 |
44 #if defined(USE_X11) | 44 #if defined(USE_X11) |
45 ui::PaintRecorder recorder(context, host_->GetBounds().size()); | 45 ui::PaintRecorder recorder(context, host_->GetBounds().size()); |
46 ui::CopyAreaToCanvas(host_->GetAcceleratedWidget(), host_->GetBounds(), | 46 ui::CopyAreaToCanvas(host_->GetAcceleratedWidget(), host_->GetBounds(), |
47 gfx::Point(), recorder.canvas()); | 47 gfx::Point(), recorder.canvas()); |
48 #else | 48 #else |
49 // TODO(spang): Figure out what to do here. | 49 // TODO(spang): Figure out what to do here. |
50 NOTIMPLEMENTED(); | 50 NOTIMPLEMENTED(); |
51 #endif | 51 #endif |
52 } | 52 } |
53 | 53 |
(...skipping 17 matching lines...) Expand all Loading... |
71 : layer_delegate_(new CopyHostContentLayerDelegate(host)), | 71 : layer_delegate_(new CopyHostContentLayerDelegate(host)), |
72 layer_(new ui::Layer(ui::LAYER_TEXTURED)) { | 72 layer_(new ui::Layer(ui::LAYER_TEXTURED)) { |
73 layer_->set_delegate(layer_delegate_.get()); | 73 layer_->set_delegate(layer_delegate_.get()); |
74 | 74 |
75 ui::Layer* root_layer = host->window()->layer(); | 75 ui::Layer* root_layer = host->window()->layer(); |
76 layer_->SetBounds(gfx::Rect(host->window()->bounds().size())); | 76 layer_->SetBounds(gfx::Rect(host->window()->bounds().size())); |
77 root_layer->Add(layer_.get()); | 77 root_layer->Add(layer_.get()); |
78 root_layer->StackAtTop(layer_.get()); | 78 root_layer->StackAtTop(layer_.get()); |
79 } | 79 } |
80 | 80 |
81 BootSplashScreen::~BootSplashScreen() { | 81 BootSplashScreen::~BootSplashScreen() {} |
82 } | |
83 | 82 |
84 void BootSplashScreen::StartHideAnimation(base::TimeDelta duration) { | 83 void BootSplashScreen::StartHideAnimation(base::TimeDelta duration) { |
85 ui::ScopedLayerAnimationSettings settings(layer_->GetAnimator()); | 84 ui::ScopedLayerAnimationSettings settings(layer_->GetAnimator()); |
86 settings.SetTransitionDuration(duration); | 85 settings.SetTransitionDuration(duration); |
87 settings.SetPreemptionStrategy(ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); | 86 settings.SetPreemptionStrategy(ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); |
88 layer_->SetOpacity(0.0f); | 87 layer_->SetOpacity(0.0f); |
89 } | 88 } |
90 | 89 |
91 } // namespace ash | 90 } // namespace ash |
OLD | NEW |