Chromium Code Reviews| Index: chrome/browser/ui/views/tabs/tab.h |
| diff --git a/chrome/browser/ui/views/tabs/tab.h b/chrome/browser/ui/views/tabs/tab.h |
| index 7b7bc644e81e50785ca15f69330a514f3126bb59..57611b74d6373c766ac44e43a346f7391eb6def8 100644 |
| --- a/chrome/browser/ui/views/tabs/tab.h |
| +++ b/chrome/browser/ui/views/tabs/tab.h |
| @@ -12,6 +12,7 @@ |
| #include "base/gtest_prod_util.h" |
| #include "base/macros.h" |
| #include "base/memory/ref_counted.h" |
| +#include "cc/paint/paint_record.h" |
| #include "chrome/browser/ui/views/tabs/tab_renderer_data.h" |
| #include "ui/base/layout.h" |
| #include "ui/gfx/animation/animation_delegate.h" |
| @@ -235,11 +236,24 @@ class Tab : public gfx::AnimationDelegate, |
| // Paints a tab background using the image defined by |fill_id| at the |
| // provided offset. If |fill_id| is 0, it will fall back to using the solid |
| // color defined by the theme provider and ignore the offset. |
| - void PaintTabBackgroundUsingFillId(gfx::Canvas* fill_canvas, |
| - gfx::Canvas* stroke_canvas, |
| - bool is_active, |
| - int fill_id, |
| - int y_offset); |
| + void PaintTabBackground(gfx::Canvas* canvas, |
| + bool active, |
| + int fill_id, |
| + int y_offset, |
| + const gfx::Path* clip); |
| + |
| + // Helper methods for PaintTabBackground. |
| + void PaintTabBackgroundFill(gfx::Canvas* canvas, |
| + const gfx::Path& fill_path, |
| + bool active, |
| + bool hover, |
| + SkColor active_color, |
| + SkColor inactive_color, |
| + int fill_id, |
| + int y_offset); |
| + void PaintTabBackgroundStroke(gfx::Canvas* canvas, |
| + const gfx::Path& fill_path, |
| + bool active); |
| // Paints the pinned tab title changed indicator and |favicon_|. |favicon_| |
| // may be null. |favicon_draw_bounds| is |favicon_bounds_| adjusted for rtl |
| @@ -355,6 +369,24 @@ class Tab : public gfx::AnimationDelegate, |
| // and thus may be null. |
| gfx::ImageSkia favicon_; |
| + struct BackgroundCache { |
|
Peter Kasting
2017/04/07 00:59:20
Nit: I think the Google style guide requests that
danakj
2017/04/07 19:10:49
yeh.. that seems unfortunate here. The guide says
Peter Kasting
2017/04/07 23:34:03
It's OK to keep it here. It'd be even better to m
|
| + BackgroundCache(); |
| + ~BackgroundCache(); |
| + |
| + // Parameters used to construct the PaintRecords. |
| + float scale = 0.f; |
| + gfx::Size size; |
| + SkColor active_color; |
|
Peter Kasting
2017/04/07 00:59:20
Nit: If you're going to init |scale| in the declar
danakj
2017/04/07 19:10:49
Right, don't want to compare uninit things, even t
|
| + SkColor inactive_color; |
| + |
| + // The PaintRecords being cached based on the above parameters. |
| + sk_sp<cc::PaintRecord> fill_record; |
| + sk_sp<cc::PaintRecord> stroke_record; |
| + }; |
| + |
| + BackgroundCache background_active_cache_; |
| + BackgroundCache background_inactive_cache_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(Tab); |
| }; |