| 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 #ifndef VIEWS_VIEW_H_ | 5 #ifndef VIEWS_VIEW_H_ |
| 6 #define VIEWS_VIEW_H_ | 6 #define VIEWS_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 | 995 |
| 996 // Override to paint a border not specified by SetBorder(). | 996 // Override to paint a border not specified by SetBorder(). |
| 997 virtual void OnPaintBorder(gfx::Canvas* canvas); | 997 virtual void OnPaintBorder(gfx::Canvas* canvas); |
| 998 | 998 |
| 999 // Override to paint a focus border (usually a dotted rectangle) around | 999 // Override to paint a focus border (usually a dotted rectangle) around |
| 1000 // relevant contents. | 1000 // relevant contents. |
| 1001 virtual void OnPaintFocusBorder(gfx::Canvas* canvas); | 1001 virtual void OnPaintFocusBorder(gfx::Canvas* canvas); |
| 1002 | 1002 |
| 1003 // Accelerated painting ------------------------------------------------------ | 1003 // Accelerated painting ------------------------------------------------------ |
| 1004 | 1004 |
| 1005 #if !defined(COMPOSITOR_2) | |
| 1006 | |
| 1007 // Performs accelerated painting using the compositor. | |
| 1008 virtual void PaintComposite(ui::Compositor* compositor); | |
| 1009 #else | |
| 1010 | |
| 1011 // Invoked from SchedulePaintInRect. Invokes SchedulePaintInternal on the | 1005 // Invoked from SchedulePaintInRect. Invokes SchedulePaintInternal on the |
| 1012 // parent. This does not mark the texture as dirty. It's assumed the caller | 1006 // parent. This does not mark the texture as dirty. It's assumed the caller |
| 1013 // has done this. You should not need to invoke this, use SchedulePaint or | 1007 // has done this. You should not need to invoke this, use SchedulePaint or |
| 1014 // SchedulePaintInRect instead. | 1008 // SchedulePaintInRect instead. |
| 1015 virtual void SchedulePaintInternal(const gfx::Rect& r); | 1009 virtual void SchedulePaintInternal(const gfx::Rect& r); |
| 1016 | 1010 |
| 1017 // If our texture is out of date invokes Paint() with a canvas that is then | 1011 // If our texture is out of date invokes Paint() with a canvas that is then |
| 1018 // copied to the texture. If the texture is not out of date recursively | 1012 // copied to the texture. If the texture is not out of date recursively |
| 1019 // descends in case any children needed their textures updated. | 1013 // descends in case any children needed their textures updated. |
| 1020 // | 1014 // |
| 1021 // This is invoked internally by Widget and painting code. | 1015 // This is invoked internally by Widget and painting code. |
| 1022 void PaintToTexture(const gfx::Rect& dirty_rect); | 1016 void PaintToTexture(const gfx::Rect& dirty_rect); |
| 1023 | 1017 |
| 1024 // Instructs the compositor to show our texture and all children textures. | 1018 // Instructs the compositor to show our texture and all children textures. |
| 1025 // Invokes OnWillCompositeTexture() for any views that have textures. | 1019 // Invokes OnWillCompositeTexture() for any views that have textures. |
| 1026 // | 1020 // |
| 1027 // This is invoked internally by Widget and painting code. | 1021 // This is invoked internally by Widget and painting code. |
| 1028 void PaintComposite(); | 1022 void PaintComposite(); |
| 1029 | 1023 |
| 1030 // Invoked from |PaintComposite| if this view has a texture and before the | 1024 // Invoked from |PaintComposite| if this view has a texture and before the |
| 1031 // texture is rendered by the compositor. | 1025 // texture is rendered by the compositor. |
| 1032 virtual void OnWillCompositeTexture(); | 1026 virtual void OnWillCompositeTexture(); |
| 1033 #endif | |
| 1034 | 1027 |
| 1035 // Returns true if this view should paint using a texture. | 1028 // Returns true if this view should paint using a texture. |
| 1036 virtual bool ShouldPaintToTexture() const; | 1029 virtual bool ShouldPaintToTexture() const; |
| 1037 | 1030 |
| 1038 // Returns the Compositor. | 1031 // Returns the Compositor. |
| 1039 virtual const ui::Compositor* GetCompositor() const; | 1032 virtual const ui::Compositor* GetCompositor() const; |
| 1040 virtual ui::Compositor* GetCompositor(); | 1033 virtual ui::Compositor* GetCompositor(); |
| 1041 | 1034 |
| 1042 // Input --------------------------------------------------------------------- | 1035 // Input --------------------------------------------------------------------- |
| 1043 | 1036 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1222 bool ConvertPointForAncestor(const View* ancestor, gfx::Point* point) const; | 1215 bool ConvertPointForAncestor(const View* ancestor, gfx::Point* point) const; |
| 1223 | 1216 |
| 1224 // Convert a point in the ancestor's coordinate system to the view's | 1217 // Convert a point in the ancestor's coordinate system to the view's |
| 1225 // coordinate system using necessary transformations. Returns whether the | 1218 // coordinate system using necessary transformations. Returns whether the |
| 1226 // point was successfully from the ancestor's coordinate system to the view's | 1219 // point was successfully from the ancestor's coordinate system to the view's |
| 1227 // coordinate system. | 1220 // coordinate system. |
| 1228 bool ConvertPointFromAncestor(const View* ancestor, gfx::Point* point) const; | 1221 bool ConvertPointFromAncestor(const View* ancestor, gfx::Point* point) const; |
| 1229 | 1222 |
| 1230 // Accelerated painting ------------------------------------------------------ | 1223 // Accelerated painting ------------------------------------------------------ |
| 1231 | 1224 |
| 1232 #if defined(COMPOSITOR_2) | |
| 1233 // Marks the texture this view draws into as dirty. | 1225 // Marks the texture this view draws into as dirty. |
| 1234 void MarkTextureDirty(); | 1226 void MarkTextureDirty(); |
| 1235 #endif | |
| 1236 | 1227 |
| 1237 // Releases the texture of this and recurses through all children. | 1228 // Releases the texture of this and recurses through all children. |
| 1238 void ResetTexture(); | 1229 void ResetTexture(); |
| 1239 | 1230 |
| 1240 // Input --------------------------------------------------------------------- | 1231 // Input --------------------------------------------------------------------- |
| 1241 | 1232 |
| 1242 // RootView invokes these. These in turn invoke the appropriate OnMouseXXX | 1233 // RootView invokes these. These in turn invoke the appropriate OnMouseXXX |
| 1243 // method. If a drag is detected, DoDrag is invoked. | 1234 // method. If a drag is detected, DoDrag is invoked. |
| 1244 bool ProcessMousePressed(const MouseEvent& event, DragInfo* drop_info); | 1235 bool ProcessMousePressed(const MouseEvent& event, DragInfo* drop_info); |
| 1245 bool ProcessMouseDragged(const MouseEvent& event, DragInfo* drop_info); | 1236 bool ProcessMouseDragged(const MouseEvent& event, DragInfo* drop_info); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1377 | 1368 |
| 1378 // RTL painting -------------------------------------------------------------- | 1369 // RTL painting -------------------------------------------------------------- |
| 1379 | 1370 |
| 1380 // Indicates whether or not the gfx::Canvas object passed to View::Paint() | 1371 // Indicates whether or not the gfx::Canvas object passed to View::Paint() |
| 1381 // is going to be flipped horizontally (using the appropriate transform) on | 1372 // is going to be flipped horizontally (using the appropriate transform) on |
| 1382 // right-to-left locales for this View. | 1373 // right-to-left locales for this View. |
| 1383 bool flip_canvas_on_paint_for_rtl_ui_; | 1374 bool flip_canvas_on_paint_for_rtl_ui_; |
| 1384 | 1375 |
| 1385 // Accelerated painting ------------------------------------------------------ | 1376 // Accelerated painting ------------------------------------------------------ |
| 1386 | 1377 |
| 1387 #if !defined(COMPOSITOR_2) | |
| 1388 // Each transformed view will maintain its own canvas. | |
| 1389 scoped_ptr<gfx::Canvas> canvas_; | |
| 1390 | |
| 1391 // Texture ID used for accelerated painting. | |
| 1392 // TODO(sadrul): This will eventually be replaced by an abstract texture | |
| 1393 // object. | |
| 1394 ui::TextureID texture_id_; | |
| 1395 #else | |
| 1396 scoped_ptr<ui::Texture> texture_; | 1378 scoped_ptr<ui::Texture> texture_; |
| 1397 | 1379 |
| 1398 // If not empty and Paint() is invoked, the canvas is created with the | 1380 // If not empty and Paint() is invoked, the canvas is created with the |
| 1399 // specified size. | 1381 // specified size. |
| 1400 // TODO(sky): this should be passed in. | 1382 // TODO(sky): this should be passed in. |
| 1401 gfx::Rect texture_clip_rect_; | 1383 gfx::Rect texture_clip_rect_; |
| 1402 #endif | |
| 1403 | 1384 |
| 1404 // Is the texture out of date? | 1385 // Is the texture out of date? |
| 1405 bool texture_needs_updating_; | 1386 bool texture_needs_updating_; |
| 1406 | 1387 |
| 1407 // Should we paint to a texture? See description above setter for details. | 1388 // Should we paint to a texture? See description above setter for details. |
| 1408 bool paint_to_texture_; | 1389 bool paint_to_texture_; |
| 1409 | 1390 |
| 1410 // Accelerators -------------------------------------------------------------- | 1391 // Accelerators -------------------------------------------------------------- |
| 1411 | 1392 |
| 1412 // true if when we were added to hierarchy we were without focus manager | 1393 // true if when we were added to hierarchy we were without focus manager |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1452 // The Windows-specific accessibility implementation for this View. | 1433 // The Windows-specific accessibility implementation for this View. |
| 1453 scoped_refptr<NativeViewAccessibilityWin> native_view_accessibility_win_; | 1434 scoped_refptr<NativeViewAccessibilityWin> native_view_accessibility_win_; |
| 1454 #endif | 1435 #endif |
| 1455 | 1436 |
| 1456 DISALLOW_COPY_AND_ASSIGN(View); | 1437 DISALLOW_COPY_AND_ASSIGN(View); |
| 1457 }; | 1438 }; |
| 1458 | 1439 |
| 1459 } // namespace views | 1440 } // namespace views |
| 1460 | 1441 |
| 1461 #endif // VIEWS_VIEW_H_ | 1442 #endif // VIEWS_VIEW_H_ |
| OLD | NEW |