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

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

Issue 1057873004: Pass a ui::PaintContext from ui::Layer to layer delegates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: layer-paintcontext: mac 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/view.h ('k') | ui/views/widget/desktop_aura/desktop_native_widget_aura.h » ('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 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after
1440 SetLayerBounds(GetLocalBounds() + offset); 1440 SetLayerBounds(GetLocalBounds() + offset);
1441 } else { 1441 } else {
1442 for (int i = 0, count = child_count(); i < count; ++i) { 1442 for (int i = 0, count = child_count(); i < count; ++i) {
1443 View* child = child_at(i); 1443 View* child = child_at(i);
1444 child->UpdateChildLayerBounds( 1444 child->UpdateChildLayerBounds(
1445 offset + gfx::Vector2d(child->GetMirroredX(), child->y())); 1445 offset + gfx::Vector2d(child->GetMirroredX(), child->y()));
1446 } 1446 }
1447 } 1447 }
1448 } 1448 }
1449 1449
1450 void View::OnPaintLayer(gfx::Canvas* canvas) { 1450 void View::OnPaintLayer(const ui::PaintContext& context) {
1451 if (!layer()->fills_bounds_opaquely()) 1451 if (!layer()->fills_bounds_opaquely())
1452 canvas->DrawColor(SK_ColorBLACK, SkXfermode::kClear_Mode); 1452 context.canvas()->DrawColor(SK_ColorBLACK, SkXfermode::kClear_Mode);
1453 if (!visible_) 1453 if (!visible_)
1454 return; 1454 return;
1455 Paint(ui::PaintContext(canvas, layer()->PaintRect())); 1455 Paint(context);
1456 } 1456 }
1457 1457
1458 void View::OnDelegatedFrameDamage( 1458 void View::OnDelegatedFrameDamage(
1459 const gfx::Rect& damage_rect_in_dip) { 1459 const gfx::Rect& damage_rect_in_dip) {
1460 } 1460 }
1461 1461
1462 void View::OnDeviceScaleFactorChanged(float device_scale_factor) { 1462 void View::OnDeviceScaleFactorChanged(float device_scale_factor) {
1463 snap_layer_to_pixel_boundary_ = 1463 snap_layer_to_pixel_boundary_ =
1464 (device_scale_factor - std::floor(device_scale_factor)) != 0.0f; 1464 (device_scale_factor - std::floor(device_scale_factor)) != 0.0f;
1465 SnapLayerToPixelBoundary(); 1465 SnapLayerToPixelBoundary();
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
2356 // Message the RootView to do the drag and drop. That way if we're removed 2356 // Message the RootView to do the drag and drop. That way if we're removed
2357 // the RootView can detect it and avoid calling us back. 2357 // the RootView can detect it and avoid calling us back.
2358 gfx::Point widget_location(event.location()); 2358 gfx::Point widget_location(event.location());
2359 ConvertPointToWidget(this, &widget_location); 2359 ConvertPointToWidget(this, &widget_location);
2360 widget->RunShellDrag(this, data, widget_location, drag_operations, source); 2360 widget->RunShellDrag(this, data, widget_location, drag_operations, source);
2361 // WARNING: we may have been deleted. 2361 // WARNING: we may have been deleted.
2362 return true; 2362 return true;
2363 } 2363 }
2364 2364
2365 } // namespace views 2365 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/view.h ('k') | ui/views/widget/desktop_aura/desktop_native_widget_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698