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

Side by Side Diff: ui/views/widget/widget.cc

Issue 1053143002: Make View::Paint use ui::PaintRecorder to access PaintContext's canvas (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: paintrecorder: . 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/views/widget/widget.h" 5 #include "ui/views/widget/widget.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
11 #include "ui/base/cursor/cursor.h" 11 #include "ui/base/cursor/cursor.h"
12 #include "ui/base/default_theme_provider.h" 12 #include "ui/base/default_theme_provider.h"
13 #include "ui/base/hit_test.h" 13 #include "ui/base/hit_test.h"
14 #include "ui/base/l10n/l10n_font_util.h" 14 #include "ui/base/l10n/l10n_font_util.h"
15 #include "ui/base/resource/resource_bundle.h" 15 #include "ui/base/resource/resource_bundle.h"
16 #include "ui/compositor/compositor.h" 16 #include "ui/compositor/compositor.h"
17 #include "ui/compositor/layer.h" 17 #include "ui/compositor/layer.h"
18 #include "ui/compositor/paint_context.h"
18 #include "ui/events/event.h" 19 #include "ui/events/event.h"
19 #include "ui/events/event_utils.h" 20 #include "ui/events/event_utils.h"
20 #include "ui/gfx/image/image_skia.h" 21 #include "ui/gfx/image/image_skia.h"
21 #include "ui/gfx/screen.h" 22 #include "ui/gfx/screen.h"
22 #include "ui/views/controls/menu/menu_controller.h" 23 #include "ui/views/controls/menu/menu_controller.h"
23 #include "ui/views/focus/focus_manager.h" 24 #include "ui/views/focus/focus_manager.h"
24 #include "ui/views/focus/focus_manager_factory.h" 25 #include "ui/views/focus/focus_manager_factory.h"
25 #include "ui/views/focus/view_storage.h" 26 #include "ui/views/focus/view_storage.h"
26 #include "ui/views/focus/widget_focus_manager.h" 27 #include "ui/views/focus/widget_focus_manager.h"
27 #include "ui/views/ime/input_method.h" 28 #include "ui/views/ime/input_method.h"
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 1173
1173 bool Widget::OnNativeWidgetPaintAccelerated(const gfx::Rect& dirty_region) { 1174 bool Widget::OnNativeWidgetPaintAccelerated(const gfx::Rect& dirty_region) {
1174 ui::Compositor* compositor = GetCompositor(); 1175 ui::Compositor* compositor = GetCompositor();
1175 if (!compositor) 1176 if (!compositor)
1176 return false; 1177 return false;
1177 1178
1178 compositor->ScheduleRedrawRect(dirty_region); 1179 compositor->ScheduleRedrawRect(dirty_region);
1179 return true; 1180 return true;
1180 } 1181 }
1181 1182
1182 void Widget::OnNativeWidgetPaint(gfx::Canvas* canvas) { 1183 void Widget::OnNativeWidgetPaint(const ui::PaintContext& context) {
1183 // On Linux Aura, we can get here during Init() because of the 1184 // On Linux Aura, we can get here during Init() because of the
1184 // SetInitialBounds call. 1185 // SetInitialBounds call.
1185 if (!native_widget_initialized_) 1186 if (!native_widget_initialized_)
1186 return; 1187 return;
1187 GetRootView()->Paint(View::PaintContext(canvas, GetLayer()->PaintRect())); 1188 GetRootView()->Paint(context);
1188 } 1189 }
1189 1190
1190 int Widget::GetNonClientComponent(const gfx::Point& point) { 1191 int Widget::GetNonClientComponent(const gfx::Point& point) {
1191 int component = non_client_view_ ? 1192 int component = non_client_view_ ?
1192 non_client_view_->NonClientHitTest(point) : 1193 non_client_view_->NonClientHitTest(point) :
1193 HTNOWHERE; 1194 HTNOWHERE;
1194 1195
1195 if (movement_disabled_ && (component == HTCAPTION || component == HTSYSMENU)) 1196 if (movement_disabled_ && (component == HTCAPTION || component == HTSYSMENU))
1196 return HTNOWHERE; 1197 return HTNOWHERE;
1197 1198
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 1538
1538 //////////////////////////////////////////////////////////////////////////////// 1539 ////////////////////////////////////////////////////////////////////////////////
1539 // internal::NativeWidgetPrivate, NativeWidget implementation: 1540 // internal::NativeWidgetPrivate, NativeWidget implementation:
1540 1541
1541 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { 1542 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() {
1542 return this; 1543 return this;
1543 } 1544 }
1544 1545
1545 } // namespace internal 1546 } // namespace internal
1546 } // namespace views 1547 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698