| 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 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 transform_from_parent.PreconcatTransform(GetTransform()); | 834 transform_from_parent.PreconcatTransform(GetTransform()); |
| 835 transform_recorder.Transform(transform_from_parent); | 835 transform_recorder.Transform(transform_from_parent); |
| 836 } | 836 } |
| 837 | 837 |
| 838 // Note that the cache is not aware of the offset of the view | 838 // Note that the cache is not aware of the offset of the view |
| 839 // relative to the parent since painting is always done relative to | 839 // relative to the parent since painting is always done relative to |
| 840 // the top left of the individual view. | 840 // the top left of the individual view. |
| 841 if (is_invalidated || !paint_cache_.UseCache(context, size())) { | 841 if (is_invalidated || !paint_cache_.UseCache(context, size())) { |
| 842 ui::PaintRecorder recorder(context, size(), &paint_cache_); | 842 ui::PaintRecorder recorder(context, size(), &paint_cache_); |
| 843 gfx::Canvas* canvas = recorder.canvas(); | 843 gfx::Canvas* canvas = recorder.canvas(); |
| 844 | 844 gfx::ScopedRTLFlipCanvas scoped_canvas(canvas, width(), |
| 845 // If the View we are about to paint requested the canvas to be flipped, we | 845 flip_canvas_on_paint_for_rtl_ui_); |
| 846 // should change the transform appropriately. | |
| 847 // The canvas mirroring is undone once the View is done painting so that we | |
| 848 // don't pass the canvas with the mirrored transform to Views that didn't | |
| 849 // request the canvas to be flipped. | |
| 850 if (FlipCanvasOnPaintForRTLUI()) { | |
| 851 canvas->Translate(gfx::Vector2d(width(), 0)); | |
| 852 canvas->Scale(-1, 1); | |
| 853 } | |
| 854 | 846 |
| 855 // Delegate painting the contents of the View to the virtual OnPaint method. | 847 // Delegate painting the contents of the View to the virtual OnPaint method. |
| 856 OnPaint(canvas); | 848 OnPaint(canvas); |
| 857 } | 849 } |
| 858 | 850 |
| 859 // View::Paint() recursion over the subtree. | 851 // View::Paint() recursion over the subtree. |
| 860 PaintChildren(context); | 852 PaintChildren(context); |
| 861 } | 853 } |
| 862 | 854 |
| 863 void View::set_background(Background* b) { | 855 void View::set_background(Background* b) { |
| (...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2426 // Message the RootView to do the drag and drop. That way if we're removed | 2418 // Message the RootView to do the drag and drop. That way if we're removed |
| 2427 // the RootView can detect it and avoid calling us back. | 2419 // the RootView can detect it and avoid calling us back. |
| 2428 gfx::Point widget_location(event.location()); | 2420 gfx::Point widget_location(event.location()); |
| 2429 ConvertPointToWidget(this, &widget_location); | 2421 ConvertPointToWidget(this, &widget_location); |
| 2430 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2422 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
| 2431 // WARNING: we may have been deleted. | 2423 // WARNING: we may have been deleted. |
| 2432 return true; | 2424 return true; |
| 2433 } | 2425 } |
| 2434 | 2426 |
| 2435 } // namespace views | 2427 } // namespace views |
| OLD | NEW |