Chromium Code Reviews| Index: ui/views/view.cc |
| diff --git a/ui/views/view.cc b/ui/views/view.cc |
| index 78659caf418cd1b5ee47d40b98e1841a3e4f659b..e5e47198fff67b24d2533a66f701dd084e56e289 100644 |
| --- a/ui/views/view.cc |
| +++ b/ui/views/view.cc |
| @@ -748,6 +748,7 @@ void View::Paint(const ui::PaintContext& parent_context) { |
| ui::PaintContext context = |
| parent_context.CloneWithPaintOffset(offset_to_parent); |
| + bool is_invalidated = true; |
|
sky
2015/04/23 16:29:00
is_invalid?
|
| if (context.CanCheckInvalidated()) { |
| #if DCHECK_IS_ON() |
| gfx::Vector2d offset; |
| @@ -770,10 +771,12 @@ void View::Paint(const ui::PaintContext& parent_context) { |
| // If the View wasn't invalidated, don't waste time painting it, the output |
| // would be culled. |
| - if (!context.IsRectInvalidated(GetLocalBounds())) |
| - return; |
| + is_invalidated = context.IsRectInvalidated(GetLocalBounds()); |
|
sky
2015/04/23 16:29:00
nit: IsRectInvalidated() sounds like it is modifyi
danakj
2015/04/23 16:34:09
Hm, I disagree. "Invalidated" means that ScheduleP
|
| } |
| + if (!is_invalidated && context.EarlyOutOfPaintingWhenNotInvalidated()) |
| + return; |
| + |
| TRACE_EVENT1("views", "View::Paint", "class", GetClassName()); |
| // If the view is backed by a layer, it should paint with itself as the origin |
| @@ -803,8 +806,8 @@ void View::Paint(const ui::PaintContext& parent_context) { |
| clip_transform_recorder->Transform(transform_from_parent); |
| } |
| - { |
| - ui::PaintRecorder recorder(context); |
| + if (is_invalidated || !paint_cache_.UseCache(context)) { |
| + ui::PaintRecorder recorder(context, &paint_cache_); |
| gfx::Canvas* canvas = recorder.canvas(); |
| gfx::ScopedCanvas scoped_canvas(canvas); |