| OLD | NEW | 
|---|
|  | (Empty) | 
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |  | 
| 2 // Use of this source code is governed by a BSD-style license that can be |  | 
| 3 // found in the LICENSE file. |  | 
| 4 |  | 
| 5 #include "base/callback.h" |  | 
| 6 #include "base/macros.h" |  | 
| 7 #include "third_party/skia/include/core/SkColor.h" |  | 
| 8 #include "ui/compositor/layer_delegate.h" |  | 
| 9 #include "ui/compositor/paint_context.h" |  | 
| 10 #include "ui/gfx/geometry/rect.h" |  | 
| 11 |  | 
| 12 namespace ui { |  | 
| 13 class Layer; |  | 
| 14 }  // namespace ui |  | 
| 15 |  | 
| 16 namespace views { |  | 
| 17 |  | 
| 18 // Renders the visual feedback for an ink drop animation. Will render a circle |  | 
| 19 // if |circle_| is true, otherwise renders a rounded rectangle. |  | 
| 20 class InkDropDelegate : public ui::LayerDelegate { |  | 
| 21  public: |  | 
| 22   InkDropDelegate(ui::Layer* layer, |  | 
| 23                   SkColor color, |  | 
| 24                   int circle_radius, |  | 
| 25                   int rounded_rect_corner_radius); |  | 
| 26   ~InkDropDelegate() override; |  | 
| 27 |  | 
| 28   // Sets the visual style of the feedback. |  | 
| 29   void set_should_render_circle(bool should_render_circle) { |  | 
| 30     should_render_circle_ = should_render_circle; |  | 
| 31   } |  | 
| 32 |  | 
| 33   bool should_render_circle() const { return should_render_circle_; } |  | 
| 34 |  | 
| 35   // ui::LayerDelegate: |  | 
| 36   void OnPaintLayer(const ui::PaintContext& context) override; |  | 
| 37   void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override; |  | 
| 38   void OnDeviceScaleFactorChanged(float device_scale_factor) override; |  | 
| 39   base::Closure PrepareForLayerBoundsChange() override; |  | 
| 40 |  | 
| 41  private: |  | 
| 42   // The ui::Layer being rendered to. |  | 
| 43   ui::Layer* layer_; |  | 
| 44 |  | 
| 45   // The color to paint. |  | 
| 46   SkColor color_; |  | 
| 47 |  | 
| 48   // When true renders a circle, otherwise renders a rounded rectangle. |  | 
| 49   bool should_render_circle_; |  | 
| 50 |  | 
| 51   // The radius of the circle. |  | 
| 52   const int circle_radius_; |  | 
| 53 |  | 
| 54   // The radius of the rounded rectangles corners. |  | 
| 55   const int rounded_rect_corner_radius_; |  | 
| 56 |  | 
| 57   DISALLOW_COPY_AND_ASSIGN(InkDropDelegate); |  | 
| 58 }; |  | 
| 59 |  | 
| 60 }  // namespace views |  | 
| OLD | NEW | 
|---|