Chromium Code Reviews| Index: ui/views/view.h |
| diff --git a/ui/views/view.h b/ui/views/view.h |
| index 7a8a7b327ebb5627de5a291fa7d0c06d35e3162e..33487f5391469e2d9bb3e2b89263b68e951944b7 100644 |
| --- a/ui/views/view.h |
| +++ b/ui/views/view.h |
| @@ -37,6 +37,7 @@ |
| #include "ui/gfx/geometry/vector2d.h" |
| #include "ui/gfx/native_widget_types.h" |
| #include "ui/gfx/path.h" |
| +#include "ui/views/paint_info.h" |
| #include "ui/views/view_targeter.h" |
| #include "ui/views/views_export.h" |
| @@ -543,7 +544,7 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
| // for View coordinates and language direction as required, allows the View |
| // to paint itself via the various OnPaint*() event handlers and then paints |
| // the hierarchy beneath it. |
| - void Paint(const ui::PaintContext& parent_context); |
| + void Paint(const PaintInfo& parent_paint_info); |
| // The background object may be null. |
| void SetBackground(std::unique_ptr<Background> b); |
| @@ -1152,7 +1153,7 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
| // Responsible for calling Paint() on child Views. Override to control the |
| // order child Views are painted. |
| - virtual void PaintChildren(const ui::PaintContext& context); |
| + virtual void PaintChildren(const PaintInfo& info); |
| // Override to provide rendering in any part of the View's bounds. Typically |
| // this is the "contents" of the view. If you override this method you will |
| @@ -1271,6 +1272,12 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
| // hierarchy). |
| virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) {} |
| + // Pixel Canvas -------------------------------------------------------------- |
| + |
| + // Returns the type of scaling to be done for this View. Values should be from |
| + // PaintInfo::ScaleType. |
|
sky
2017/07/26 22:12:12
Remove second sentence as this is obvious given th
malaykeshav
2017/07/28 01:24:38
Done
|
| + virtual PaintInfo::ScaleType GetPaintScaleType() const; |
|
sky
2017/07/26 22:12:12
Move this up with the other painting functions. Sa
sky
2017/07/26 22:12:12
Are we really going to have different scale types
malaykeshav
2017/07/28 01:24:38
All except the ones that don't want any distortion
malaykeshav
2017/07/28 01:24:38
Done.
|
| + |
| // Debugging ----------------------------------------------------------------- |
| #if !defined(NDEBUG) |
| @@ -1296,6 +1303,10 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
| friend class ViewLayerTest; |
| friend class Widget; |
| + FRIEND_TEST_ALL_PREFIXES(ViewTest, PaintWithMovedViewUsesCache); |
| + FRIEND_TEST_ALL_PREFIXES(ViewTest, PaintWithMovedViewUsesCacheInRTL); |
| + FRIEND_TEST_ALL_PREFIXES(ViewTest, PaintWithUnknownInvalidation); |
| + |
| // Painting ----------------------------------------------------------------- |
| enum SchedulePaintType { |
| @@ -1319,17 +1330,19 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
| // during painting. |
| bool ShouldPaint() const; |
| - // Returns the offset that should be used when constructing the paint context |
| + // Returns the bounds that should be used when constructing the |PaintInfo| |
| // for this view. |
| - gfx::Vector2d GetPaintContextOffset() const; |
| + gfx::Rect GetPaintRecordingBounds() const; |
| // Adjusts the transform of |recorder| in advance of painting. |
| - void SetupTransformRecorderForPainting(ui::TransformRecorder* recorder) const; |
| + void SetupTransformRecorderForPainting( |
| + ui::TransformRecorder* recorder, |
| + const gfx::Vector2d& offset_from_parent) const; |
| // Recursively calls the painting method |func| on all non-layered children, |
| // in Z order. |
| - void RecursivePaintHelper(void (View::*func)(const ui::PaintContext&), |
| - const ui::PaintContext& context); |
| + void RecursivePaintHelper(void (View::*func)(const PaintInfo&), |
| + const PaintInfo& info); |
| // Invokes Paint() and, if necessary, PaintDebugRects(). Should be called |
| // only on the root of a widget/layer. PaintDebugRects() is invoked as a |
| @@ -1340,7 +1353,7 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
| // Draws a semitransparent rect to indicate the bounds of this view. |
| // Recursively does the same for all children. Invoked only with |
| // --draw-view-bounds-rects. |
| - void PaintDebugRects(const ui::PaintContext& parent_context); |
| + void PaintDebugRects(const PaintInfo& paint_info); |
| // Tree operations ----------------------------------------------------------- |