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

Unified Diff: ui/aura/demo/demo_main.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: ui-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 | « ui/aura/bench/bench_main.cc ('k') | ui/aura/test/test_window_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/demo/demo_main.cc
diff --git a/ui/aura/demo/demo_main.cc b/ui/aura/demo/demo_main.cc
index bf23d451f9892b5376b671ed398e54b65b4cec22..52a09d3d7b1fc45ffc8aed760a7ca329c0214fc0 100644
--- a/ui/aura/demo/demo_main.cc
+++ b/ui/aura/demo/demo_main.cc
@@ -19,7 +19,7 @@
#include "ui/aura/window_delegate.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/hit_test.h"
-#include "ui/compositor/paint_context.h"
+#include "ui/compositor/paint_recorder.h"
#include "ui/compositor/test/in_process_context_factory.h"
#include "ui/events/event.h"
#include "ui/gfx/canvas.h"
@@ -64,15 +64,15 @@ class DemoWindowDelegate : public aura::WindowDelegate {
bool CanFocus() override { return true; }
void OnCaptureLost() override {}
void OnPaint(const ui::PaintContext& context) override {
- gfx::Canvas* canvas = context.canvas();
- canvas->DrawColor(color_, SkXfermode::kSrc_Mode);
+ ui::PaintRecorder recorder(context);
+ recorder.canvas()->DrawColor(color_, SkXfermode::kSrc_Mode);
gfx::Rect r;
- canvas->GetClipBounds(&r);
+ recorder.canvas()->GetClipBounds(&r);
// Fill with a non-solid color so that the compositor will exercise its
// texture upload path.
while (!r.IsEmpty()) {
r.Inset(2, 2);
- canvas->FillRect(r, color_, SkXfermode::kXor_Mode);
+ recorder.canvas()->FillRect(r, color_, SkXfermode::kXor_Mode);
}
}
void OnDeviceScaleFactorChanged(float device_scale_factor) override {}
« no previous file with comments | « ui/aura/bench/bench_main.cc ('k') | ui/aura/test/test_window_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698