OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "views/view.h" | 5 #include "views/view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "third_party/skia/include/core/SkRect.h" | 13 #include "third_party/skia/include/core/SkRect.h" |
14 #include "ui/base/accessibility/accessibility_types.h" | 14 #include "ui/base/accessibility/accessibility_types.h" |
15 #include "ui/base/dragdrop/drag_drop_types.h" | 15 #include "ui/base/dragdrop/drag_drop_types.h" |
16 #include "ui/gfx/canvas_skia.h" | 16 #include "ui/gfx/canvas_skia.h" |
17 #include "ui/gfx/compositor/compositor.h" | 17 #include "ui/gfx/compositor/compositor.h" |
18 #include "ui/gfx/path.h" | 18 #include "ui/gfx/path.h" |
| 19 #include "ui/gfx/point3.h" |
19 #include "ui/gfx/transform.h" | 20 #include "ui/gfx/transform.h" |
20 #include "views/background.h" | 21 #include "views/background.h" |
21 #include "views/layout/layout_manager.h" | 22 #include "views/layout/layout_manager.h" |
22 #include "views/views_delegate.h" | 23 #include "views/views_delegate.h" |
23 #include "views/widget/native_widget_private.h" | 24 #include "views/widget/native_widget_private.h" |
24 #include "views/widget/root_view.h" | 25 #include "views/widget/root_view.h" |
25 #include "views/widget/tooltip_manager.h" | 26 #include "views/widget/tooltip_manager.h" |
26 #include "views/widget/widget.h" | 27 #include "views/widget/widget.h" |
27 | 28 |
28 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
(...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1563 ConvertPointFromWidget(dst, point); | 1564 ConvertPointFromWidget(dst, point); |
1564 } | 1565 } |
1565 } | 1566 } |
1566 } | 1567 } |
1567 | 1568 |
1568 bool View::ConvertPointForAncestor(const View* ancestor, | 1569 bool View::ConvertPointForAncestor(const View* ancestor, |
1569 gfx::Point* point) const { | 1570 gfx::Point* point) const { |
1570 ui::Transform trans; | 1571 ui::Transform trans; |
1571 // TODO(sad): Have some way of caching the transformation results. | 1572 // TODO(sad): Have some way of caching the transformation results. |
1572 bool result = GetTransformRelativeTo(ancestor, &trans); | 1573 bool result = GetTransformRelativeTo(ancestor, &trans); |
1573 trans.TransformPoint(point); | 1574 gfx::Point3f p(*point); |
| 1575 trans.TransformPoint(p); |
| 1576 *point = p.AsPoint(); |
1574 return result; | 1577 return result; |
1575 } | 1578 } |
1576 | 1579 |
1577 bool View::ConvertPointFromAncestor(const View* ancestor, | 1580 bool View::ConvertPointFromAncestor(const View* ancestor, |
1578 gfx::Point* point) const { | 1581 gfx::Point* point) const { |
1579 ui::Transform trans; | 1582 ui::Transform trans; |
1580 bool result = GetTransformRelativeTo(ancestor, &trans); | 1583 bool result = GetTransformRelativeTo(ancestor, &trans); |
1581 trans.TransformPointReverse(point); | 1584 gfx::Point3f p(*point); |
| 1585 trans.TransformPointReverse(p); |
| 1586 *point = p.AsPoint(); |
1582 return result; | 1587 return result; |
1583 } | 1588 } |
1584 | 1589 |
1585 // Accelerated painting -------------------------------------------------------- | 1590 // Accelerated painting -------------------------------------------------------- |
1586 | 1591 |
1587 void View::MarkTextureDirty() { | 1592 void View::MarkTextureDirty() { |
1588 View* owner = this; | 1593 View* owner = this; |
1589 while (!((owner->transform_.get() && owner->transform_->HasChange()) || | 1594 while (!((owner->transform_.get() && owner->transform_->HasChange()) || |
1590 owner->paint_to_texture_) && owner->parent_) | 1595 owner->paint_to_texture_) && owner->parent_) |
1591 owner = owner->parent_; | 1596 owner = owner->parent_; |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1861 result.append(GetChildViewAt(i)->PrintViewGraph(false)); | 1866 result.append(GetChildViewAt(i)->PrintViewGraph(false)); |
1862 | 1867 |
1863 if (first) | 1868 if (first) |
1864 result.append("}\n"); | 1869 result.append("}\n"); |
1865 | 1870 |
1866 return result; | 1871 return result; |
1867 } | 1872 } |
1868 #endif | 1873 #endif |
1869 | 1874 |
1870 } // namespace views | 1875 } // namespace views |
OLD | NEW |