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

Side by Side Diff: ui/aura/test/test_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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/aura/test/test_window_delegate.h" 5 #include "ui/aura/test/test_window_delegate.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "ui/aura/window.h" 8 #include "ui/aura/window.h"
9 #include "ui/base/hit_test.h" 9 #include "ui/base/hit_test.h"
10 #include "ui/compositor/paint_context.h" 10 #include "ui/compositor/paint_recorder.h"
11 #include "ui/events/event.h" 11 #include "ui/events/event.h"
12 #include "ui/gfx/canvas.h" 12 #include "ui/gfx/canvas.h"
13 #include "ui/gfx/path.h" 13 #include "ui/gfx/path.h"
14 #include "ui/gfx/skia_util.h" 14 #include "ui/gfx/skia_util.h"
15 15
16 #if defined(USE_AURA) 16 #if defined(USE_AURA)
17 #include "ui/base/cursor/cursor.h" 17 #include "ui/base/cursor/cursor.h"
18 #endif 18 #endif
19 19
20 namespace aura { 20 namespace aura {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 void ColorTestWindowDelegate::OnKeyEvent(ui::KeyEvent* event) { 115 void ColorTestWindowDelegate::OnKeyEvent(ui::KeyEvent* event) {
116 last_key_code_ = event->key_code(); 116 last_key_code_ = event->key_code();
117 event->SetHandled(); 117 event->SetHandled();
118 } 118 }
119 119
120 void ColorTestWindowDelegate::OnWindowDestroyed(Window* window) { 120 void ColorTestWindowDelegate::OnWindowDestroyed(Window* window) {
121 delete this; 121 delete this;
122 } 122 }
123 123
124 void ColorTestWindowDelegate::OnPaint(const ui::PaintContext& context) { 124 void ColorTestWindowDelegate::OnPaint(const ui::PaintContext& context) {
125 context.canvas()->DrawColor(color_, SkXfermode::kSrc_Mode); 125 ui::PaintRecorder recorder(context);
126 recorder.canvas()->DrawColor(color_, SkXfermode::kSrc_Mode);
126 } 127 }
127 128
128 //////////////////////////////////////////////////////////////////////////////// 129 ////////////////////////////////////////////////////////////////////////////////
129 // MaskedWindowDelegate 130 // MaskedWindowDelegate
130 131
131 MaskedWindowDelegate::MaskedWindowDelegate(const gfx::Rect mask_rect) 132 MaskedWindowDelegate::MaskedWindowDelegate(const gfx::Rect mask_rect)
132 : mask_rect_(mask_rect) { 133 : mask_rect_(mask_rect) {
133 } 134 }
134 135
135 bool MaskedWindowDelegate::HasHitTestMask() const { 136 bool MaskedWindowDelegate::HasHitTestMask() const {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 } 224 }
224 225
225 int EventCountDelegate::GetGestureCountAndReset() { 226 int EventCountDelegate::GetGestureCountAndReset() {
226 int gesture_count = gesture_count_; 227 int gesture_count = gesture_count_;
227 gesture_count_ = 0; 228 gesture_count_ = 0;
228 return gesture_count; 229 return gesture_count;
229 } 230 }
230 231
231 } // namespace test 232 } // namespace test
232 } // namespace aura 233 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698