Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2545)

Unified Diff: ash/wm/dock/docked_window_layout_manager.cc

Issue 1062003003: ash: Access the Canvas for painting through PaintRecorder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ash-recorder: . Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/boot_splash_screen_chromeos.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/dock/docked_window_layout_manager.cc
diff --git a/ash/wm/dock/docked_window_layout_manager.cc b/ash/wm/dock/docked_window_layout_manager.cc
index 9945fa57556e34e6e0f5eaf9f42ed078fa2db95f..684519597895ab1d52ad3c6f52fef9135833adc3 100644
--- a/ash/wm/dock/docked_window_layout_manager.cc
+++ b/ash/wm/dock/docked_window_layout_manager.cc
@@ -32,6 +32,7 @@
#include "ui/aura/window_event_dispatcher.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/compositor/paint_context.h"
+#include "ui/compositor/paint_recorder.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/geometry/rect.h"
@@ -94,38 +95,25 @@ class DockedBackgroundWidget : public views::Widget,
}
void OnNativeWidgetPaint(const ui::PaintContext& context) override {
- gfx::Canvas* canvas = context.canvas();
+ ui::PaintRecorder recorder(context);
const gfx::ImageSkia& shelf_background(
alignment_ == DOCKED_ALIGNMENT_LEFT ?
shelf_background_left_ : shelf_background_right_);
gfx::Rect rect = gfx::Rect(GetWindowBoundsInScreen().size());
SkPaint paint;
paint.setAlpha(alpha_);
- canvas->DrawImageInt(shelf_background,
- 0,
- 0,
- shelf_background.width(),
- shelf_background.height(),
- alignment_ == DOCKED_ALIGNMENT_LEFT
- ? rect.width() - shelf_background.width()
- : 0,
- 0,
- shelf_background.width(),
- rect.height(),
- false,
- paint);
- canvas->DrawImageInt(
+ recorder.canvas()->DrawImageInt(
+ shelf_background, 0, 0, shelf_background.width(),
+ shelf_background.height(), alignment_ == DOCKED_ALIGNMENT_LEFT
+ ? rect.width() - shelf_background.width()
+ : 0,
+ 0, shelf_background.width(), rect.height(), false, paint);
+ recorder.canvas()->DrawImageInt(
shelf_background,
alignment_ == DOCKED_ALIGNMENT_LEFT ? 0 : shelf_background.width() - 1,
- 0,
- 1,
- shelf_background.height(),
- alignment_ == DOCKED_ALIGNMENT_LEFT ? 0 : shelf_background.width(),
- 0,
- rect.width() - shelf_background.width(),
- rect.height(),
- false,
- paint);
+ 0, 1, shelf_background.height(),
+ alignment_ == DOCKED_ALIGNMENT_LEFT ? 0 : shelf_background.width(), 0,
+ rect.width() - shelf_background.width(), rect.height(), false, paint);
}
// BackgroundAnimatorDelegate:
« no previous file with comments | « ash/wm/boot_splash_screen_chromeos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698