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

Side by Side Diff: ui/views/view.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 unified diff | Download patch
« no previous file with comments | « ui/views/bubble/tray_bubble_view.cc ('k') | ui/wm/core/image_grid.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first.
6 6
7 #include "ui/views/view.h" 7 #include "ui/views/view.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after
1452 } else { 1452 } else {
1453 for (int i = 0, count = child_count(); i < count; ++i) { 1453 for (int i = 0, count = child_count(); i < count; ++i) {
1454 View* child = child_at(i); 1454 View* child = child_at(i);
1455 child->UpdateChildLayerBounds( 1455 child->UpdateChildLayerBounds(
1456 offset + gfx::Vector2d(child->GetMirroredX(), child->y())); 1456 offset + gfx::Vector2d(child->GetMirroredX(), child->y()));
1457 } 1457 }
1458 } 1458 }
1459 } 1459 }
1460 1460
1461 void View::OnPaintLayer(const ui::PaintContext& context) { 1461 void View::OnPaintLayer(const ui::PaintContext& context) {
1462 if (!layer()->fills_bounds_opaquely()) 1462 if (!layer()->fills_bounds_opaquely()) {
1463 context.canvas()->DrawColor(SK_ColorBLACK, SkXfermode::kClear_Mode); 1463 ui::PaintRecorder recorder(context);
1464 recorder.canvas()->DrawColor(SK_ColorBLACK, SkXfermode::kClear_Mode);
1465 }
1464 if (!visible_) 1466 if (!visible_)
1465 return; 1467 return;
1466 Paint(context); 1468 Paint(context);
1467 } 1469 }
1468 1470
1469 void View::OnDelegatedFrameDamage( 1471 void View::OnDelegatedFrameDamage(
1470 const gfx::Rect& damage_rect_in_dip) { 1472 const gfx::Rect& damage_rect_in_dip) {
1471 } 1473 }
1472 1474
1473 void View::OnDeviceScaleFactorChanged(float device_scale_factor) { 1475 void View::OnDeviceScaleFactorChanged(float device_scale_factor) {
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
2367 // Message the RootView to do the drag and drop. That way if we're removed 2369 // Message the RootView to do the drag and drop. That way if we're removed
2368 // the RootView can detect it and avoid calling us back. 2370 // the RootView can detect it and avoid calling us back.
2369 gfx::Point widget_location(event.location()); 2371 gfx::Point widget_location(event.location());
2370 ConvertPointToWidget(this, &widget_location); 2372 ConvertPointToWidget(this, &widget_location);
2371 widget->RunShellDrag(this, data, widget_location, drag_operations, source); 2373 widget->RunShellDrag(this, data, widget_location, drag_operations, source);
2372 // WARNING: we may have been deleted. 2374 // WARNING: we may have been deleted.
2373 return true; 2375 return true;
2374 } 2376 }
2375 2377
2376 } // namespace views 2378 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/bubble/tray_bubble_view.cc ('k') | ui/wm/core/image_grid.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698