OLD | NEW |
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 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 gfx::Vector2d offset_from_parent = GetMirroredPosition().OffsetFromOrigin(); | 799 gfx::Vector2d offset_from_parent = GetMirroredPosition().OffsetFromOrigin(); |
800 transform_from_parent.Translate(offset_from_parent.x(), | 800 transform_from_parent.Translate(offset_from_parent.x(), |
801 offset_from_parent.y()); | 801 offset_from_parent.y()); |
802 transform_from_parent.PreconcatTransform(GetTransform()); | 802 transform_from_parent.PreconcatTransform(GetTransform()); |
803 clip_transform_recorder.Transform(transform_from_parent); | 803 clip_transform_recorder.Transform(transform_from_parent); |
804 } | 804 } |
805 | 805 |
806 if (is_invalidated || !paint_cache_.UseCache(context)) { | 806 if (is_invalidated || !paint_cache_.UseCache(context)) { |
807 ui::PaintRecorder recorder(context, &paint_cache_); | 807 ui::PaintRecorder recorder(context, &paint_cache_); |
808 gfx::Canvas* canvas = recorder.canvas(); | 808 gfx::Canvas* canvas = recorder.canvas(); |
| 809 // TODO(danakj): This is not needed with impl-side/slimming paint. |
809 gfx::ScopedCanvas scoped_canvas(canvas); | 810 gfx::ScopedCanvas scoped_canvas(canvas); |
810 | 811 |
811 // If the View we are about to paint requested the canvas to be flipped, we | 812 // If the View we are about to paint requested the canvas to be flipped, we |
812 // should change the transform appropriately. | 813 // should change the transform appropriately. |
813 // The canvas mirroring is undone once the View is done painting so that we | 814 // The canvas mirroring is undone once the View is done painting so that we |
814 // don't pass the canvas with the mirrored transform to Views that didn't | 815 // don't pass the canvas with the mirrored transform to Views that didn't |
815 // request the canvas to be flipped. | 816 // request the canvas to be flipped. |
816 if (FlipCanvasOnPaintForRTLUI()) { | 817 if (FlipCanvasOnPaintForRTLUI()) { |
817 canvas->Translate(gfx::Vector2d(width(), 0)); | 818 canvas->Translate(gfx::Vector2d(width(), 0)); |
818 canvas->Scale(-1, 1); | 819 canvas->Scale(-1, 1); |
(...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2369 // Message the RootView to do the drag and drop. That way if we're removed | 2370 // Message the RootView to do the drag and drop. That way if we're removed |
2370 // the RootView can detect it and avoid calling us back. | 2371 // the RootView can detect it and avoid calling us back. |
2371 gfx::Point widget_location(event.location()); | 2372 gfx::Point widget_location(event.location()); |
2372 ConvertPointToWidget(this, &widget_location); | 2373 ConvertPointToWidget(this, &widget_location); |
2373 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2374 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
2374 // WARNING: we may have been deleted. | 2375 // WARNING: we may have been deleted. |
2375 return true; | 2376 return true; |
2376 } | 2377 } |
2377 | 2378 |
2378 } // namespace views | 2379 } // namespace views |
OLD | NEW |