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

Unified Diff: ui/aura_extra/image_window_delegate.cc

Issue 1064133003: ui: Use a PaintRecorder to access the Canvas for painting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
Index: ui/aura_extra/image_window_delegate.cc
diff --git a/ui/aura_extra/image_window_delegate.cc b/ui/aura_extra/image_window_delegate.cc
index 8f04a1a4971ce615651a7f281b02794f2a3c9770..9e4b35e679e040b22d88760541559f0478f3f606 100644
--- a/ui/aura_extra/image_window_delegate.cc
+++ b/ui/aura_extra/image_window_delegate.cc
@@ -7,7 +7,7 @@
#include "ui/base/cursor/cursor.h"
#include "ui/base/hit_test.h"
#include "ui/compositor/compositor.h"
-#include "ui/compositor/paint_context.h"
+#include "ui/compositor/paint_recorder.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
@@ -71,13 +71,15 @@ void ImageWindowDelegate::OnCaptureLost() {
}
void ImageWindowDelegate::OnPaint(const ui::PaintContext& context) {
- gfx::Canvas* canvas = context.canvas();
+ ui::PaintRecorder recorder(context);
if (background_color_ != SK_ColorTRANSPARENT &&
(image_.IsEmpty() || size_mismatch_ || !offset_.IsZero())) {
- canvas->DrawColor(background_color_);
+ recorder.canvas()->DrawColor(background_color_);
+ }
+ if (!image_.IsEmpty()) {
+ recorder.canvas()->DrawImageInt(image_.AsImageSkia(), offset_.x(),
+ offset_.y());
}
- if (!image_.IsEmpty())
- canvas->DrawImageInt(image_.AsImageSkia(), offset_.x(), offset_.y());
}
void ImageWindowDelegate::OnDeviceScaleFactorChanged(float scale_factor) {

Powered by Google App Engine
This is Rietveld 408576698