| 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/base/x/x11_util.h" | 10 #include "ui/base/x/x11_util.h" |
| 11 #include "ui/compositor/layer.h" | 11 #include "ui/compositor/layer.h" |
| 12 #include "ui/compositor/layer_type.h" | 12 #include "ui/compositor/layer_type.h" |
| 13 #include "ui/compositor/paint_context.h" | 13 #include "ui/compositor/paint_context.h" |
| 14 #include "ui/compositor/paint_recorder.h" |
| 14 #include "ui/compositor/scoped_layer_animation_settings.h" | 15 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 15 #include "ui/gfx/canvas.h" | 16 #include "ui/gfx/canvas.h" |
| 16 | 17 |
| 17 namespace ash { | 18 namespace ash { |
| 18 | 19 |
| 19 // ui::LayerDelegate that copies the aura host window's content to a ui::Layer. | 20 // ui::LayerDelegate that copies the aura host window's content to a ui::Layer. |
| 20 class BootSplashScreen::CopyHostContentLayerDelegate | 21 class BootSplashScreen::CopyHostContentLayerDelegate |
| 21 : public ui::LayerDelegate { | 22 : public ui::LayerDelegate { |
| 22 public: | 23 public: |
| 23 explicit CopyHostContentLayerDelegate(aura::WindowTreeHost* host) | 24 explicit CopyHostContentLayerDelegate(aura::WindowTreeHost* host) |
| 24 : host_(host) { | 25 : host_(host) { |
| 25 } | 26 } |
| 26 | 27 |
| 27 ~CopyHostContentLayerDelegate() override {} | 28 ~CopyHostContentLayerDelegate() override {} |
| 28 | 29 |
| 29 // ui::LayerDelegate overrides: | 30 // ui::LayerDelegate overrides: |
| 30 void OnPaintLayer(const ui::PaintContext& context) override { | 31 void OnPaintLayer(const ui::PaintContext& context) override { |
| 31 // It'd be safer to copy the area to a canvas in the constructor and then | 32 // It'd be safer to copy the area to a canvas in the constructor and then |
| 32 // copy from that canvas to this one here, but this appears to work (i.e. we | 33 // copy from that canvas to this one here, but this appears to work (i.e. we |
| 33 // only call this before we draw our first frame) and it saves us an extra | 34 // only call this before we draw our first frame) and it saves us an extra |
| 34 // copy. | 35 // copy. |
| 35 // TODO(derat): Instead of copying the data, use GLX_EXT_texture_from_pixmap | 36 // TODO(derat): Instead of copying the data, use GLX_EXT_texture_from_pixmap |
| 36 // to create a zero-copy texture (when possible): | 37 // to create a zero-copy texture (when possible): |
| 37 // https://codereview.chromium.org/10543125 | 38 // https://codereview.chromium.org/10543125 |
| 38 #if defined(USE_X11) | 39 #if defined(USE_X11) |
| 40 ui::PaintRecorder recorder(context); |
| 39 ui::CopyAreaToCanvas(host_->GetAcceleratedWidget(), host_->GetBounds(), | 41 ui::CopyAreaToCanvas(host_->GetAcceleratedWidget(), host_->GetBounds(), |
| 40 gfx::Point(), context.canvas()); | 42 gfx::Point(), recorder.canvas()); |
| 41 #else | 43 #else |
| 42 // TODO(spang): Figure out what to do here. | 44 // TODO(spang): Figure out what to do here. |
| 43 NOTIMPLEMENTED(); | 45 NOTIMPLEMENTED(); |
| 44 #endif | 46 #endif |
| 45 } | 47 } |
| 46 | 48 |
| 47 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override {} | 49 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override {} |
| 48 | 50 |
| 49 void OnDeviceScaleFactorChanged(float device_scale_factor) override {} | 51 void OnDeviceScaleFactorChanged(float device_scale_factor) override {} |
| 50 | 52 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 73 } | 75 } |
| 74 | 76 |
| 75 void BootSplashScreen::StartHideAnimation(base::TimeDelta duration) { | 77 void BootSplashScreen::StartHideAnimation(base::TimeDelta duration) { |
| 76 ui::ScopedLayerAnimationSettings settings(layer_->GetAnimator()); | 78 ui::ScopedLayerAnimationSettings settings(layer_->GetAnimator()); |
| 77 settings.SetTransitionDuration(duration); | 79 settings.SetTransitionDuration(duration); |
| 78 settings.SetPreemptionStrategy(ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); | 80 settings.SetPreemptionStrategy(ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); |
| 79 layer_->SetOpacity(0.0f); | 81 layer_->SetOpacity(0.0f); |
| 80 } | 82 } |
| 81 | 83 |
| 82 } // namespace ash | 84 } // namespace ash |
| OLD | NEW |