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 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 | 819 |
820 ui::TransformRecorder transform_recorder(context); | 820 ui::TransformRecorder transform_recorder(context); |
821 if (paint_relative_to_parent) { | 821 if (paint_relative_to_parent) { |
822 // Translate the graphics such that 0,0 corresponds to where | 822 // Translate the graphics such that 0,0 corresponds to where |
823 // this View is located relative to its parent. | 823 // this View is located relative to its parent. |
824 gfx::Transform transform_from_parent; | 824 gfx::Transform transform_from_parent; |
825 gfx::Vector2d offset_from_parent = GetMirroredPosition().OffsetFromOrigin(); | 825 gfx::Vector2d offset_from_parent = GetMirroredPosition().OffsetFromOrigin(); |
826 transform_from_parent.Translate(offset_from_parent.x(), | 826 transform_from_parent.Translate(offset_from_parent.x(), |
827 offset_from_parent.y()); | 827 offset_from_parent.y()); |
828 transform_from_parent.PreconcatTransform(GetTransform()); | 828 transform_from_parent.PreconcatTransform(GetTransform()); |
829 transform_recorder.Transform(transform_from_parent, size()); | 829 transform_recorder.Transform(transform_from_parent); |
830 } | 830 } |
831 | 831 |
832 // Note that the cache is not aware of the offset of the view | 832 // Note that the cache is not aware of the offset of the view |
833 // relative to the parent since painting is always done relative to | 833 // relative to the parent since painting is always done relative to |
834 // the top left of the individual view. | 834 // the top left of the individual view. |
835 if (is_invalidated || !paint_cache_.UseCache(context, size())) { | 835 if (is_invalidated || !paint_cache_.UseCache(context, size())) { |
836 ui::PaintRecorder recorder(context, size(), &paint_cache_); | 836 ui::PaintRecorder recorder(context, size(), &paint_cache_); |
837 gfx::Canvas* canvas = recorder.canvas(); | 837 gfx::Canvas* canvas = recorder.canvas(); |
838 | 838 |
839 // If the View we are about to paint requested the canvas to be flipped, we | 839 // If the View we are about to paint requested the canvas to be flipped, we |
(...skipping 1580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2420 // Message the RootView to do the drag and drop. That way if we're removed | 2420 // Message the RootView to do the drag and drop. That way if we're removed |
2421 // the RootView can detect it and avoid calling us back. | 2421 // the RootView can detect it and avoid calling us back. |
2422 gfx::Point widget_location(event.location()); | 2422 gfx::Point widget_location(event.location()); |
2423 ConvertPointToWidget(this, &widget_location); | 2423 ConvertPointToWidget(this, &widget_location); |
2424 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2424 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
2425 // WARNING: we may have been deleted. | 2425 // WARNING: we may have been deleted. |
2426 return true; | 2426 return true; |
2427 } | 2427 } |
2428 | 2428 |
2429 } // namespace views | 2429 } // namespace views |
OLD | NEW |