summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authordanakj <danakj@chromium.org>2015-04-07 11:10:33 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-07 18:11:10 +0000
commita59147554aaa82da73512da5f9d61e9265d54bc0 (patch)
treeee332720a4c4463b6bb16bfd2924883870bcf462 /ash
parent8d0d03be9aaed6121770b32b3f4efd7830c2d962 (diff)
downloadchromium_src-a59147554aaa82da73512da5f9d61e9265d54bc0.zip
chromium_src-a59147554aaa82da73512da5f9d61e9265d54bc0.tar.gz
chromium_src-a59147554aaa82da73512da5f9d61e9265d54bc0.tar.bz2
ash: Access the Canvas for painting through PaintRecorder.
The PaintContext will not be backed by a Canvas in the future, so do not grab the canvas from it directly. Instead use a PaintRecorder. R=oshima BUG=466426 Review URL: https://codereview.chromium.org/1062003003 Cr-Commit-Position: refs/heads/master@{#324071}
Diffstat (limited to 'ash')
-rw-r--r--ash/utility/partial_screenshot_controller.cc7
-rw-r--r--ash/wm/boot_splash_screen_chromeos.cc4
-rw-r--r--ash/wm/dock/docked_window_layout_manager.cc36
3 files changed, 19 insertions, 28 deletions
diff --git a/ash/utility/partial_screenshot_controller.cc b/ash/utility/partial_screenshot_controller.cc
index 466432c..661d405 100644
--- a/ash/utility/partial_screenshot_controller.cc
+++ b/ash/utility/partial_screenshot_controller.cc
@@ -11,6 +11,7 @@
#include "ash/shell_window_ids.h"
#include "base/stl_util.h"
#include "ui/compositor/paint_context.h"
+#include "ui/compositor/paint_recorder.h"
#include "ui/events/event_handler.h"
#include "ui/gfx/canvas.h"
#include "ui/wm/core/cursor_manager.h"
@@ -61,15 +62,15 @@ class PartialScreenshotController::PartialScreenshotLayer
if (region_.IsEmpty())
return;
- gfx::Canvas* canvas = context.canvas();
// Screenshot area representation: black rectangle with white
// rectangle inside. To avoid capturing these rectangles when mouse
// release, they should be outside of the actual capturing area.
+ ui::PaintRecorder recorder(context);
gfx::Rect rect(region_);
rect.Inset(-1, -1);
- canvas->DrawRect(rect, SK_ColorWHITE);
+ recorder.canvas()->DrawRect(rect, SK_ColorWHITE);
rect.Inset(-1, -1);
- canvas->DrawRect(rect, SK_ColorBLACK);
+ recorder.canvas()->DrawRect(rect, SK_ColorBLACK);
}
void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override {}
diff --git a/ash/wm/boot_splash_screen_chromeos.cc b/ash/wm/boot_splash_screen_chromeos.cc
index 04d66c3..0c3cb54 100644
--- a/ash/wm/boot_splash_screen_chromeos.cc
+++ b/ash/wm/boot_splash_screen_chromeos.cc
@@ -11,6 +11,7 @@
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_type.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"
@@ -36,8 +37,9 @@ class BootSplashScreen::CopyHostContentLayerDelegate
// to create a zero-copy texture (when possible):
// https://codereview.chromium.org/10543125
#if defined(USE_X11)
+ ui::PaintRecorder recorder(context);
ui::CopyAreaToCanvas(host_->GetAcceleratedWidget(), host_->GetBounds(),
- gfx::Point(), context.canvas());
+ gfx::Point(), recorder.canvas());
#else
// TODO(spang): Figure out what to do here.
NOTIMPLEMENTED();
diff --git a/ash/wm/dock/docked_window_layout_manager.cc b/ash/wm/dock/docked_window_layout_manager.cc
index 9945fa5..6845195 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: