| 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 "ui/views/animation/ink_drop_delegate.h" | 
|  | 6 | 
|  | 7 #include "third_party/skia/include/core/SkPaint.h" | 
|  | 8 #include "ui/compositor/layer.h" | 
|  | 9 #include "ui/compositor/paint_recorder.h" | 
|  | 10 #include "ui/gfx/canvas.h" | 
|  | 11 | 
|  | 12 namespace views { | 
|  | 13 | 
|  | 14 InkDropDelegate::InkDropDelegate(ui::Layer* layer, | 
|  | 15                                  SkColor color, | 
|  | 16                                  int circle_radius, | 
|  | 17                                  int rounded_rect_corner_radius) | 
|  | 18     : layer_(layer), | 
|  | 19       color_(color), | 
|  | 20       should_render_circle_(true), | 
|  | 21       circle_radius_(circle_radius), | 
|  | 22       rounded_rect_corner_radius_(rounded_rect_corner_radius) {} | 
|  | 23 | 
|  | 24 InkDropDelegate::~InkDropDelegate() {} | 
|  | 25 | 
|  | 26 void InkDropDelegate::OnPaintLayer(const ui::PaintContext& context) { | 
|  | 27   SkPaint paint; | 
|  | 28   paint.setColor(color()); | 
|  | 29   paint.setFlags(SkPaint::kAntiAlias_Flag); | 
|  | 30   paint.setStyle(SkPaint::kFill_Style); | 
|  | 31 | 
|  | 32   gfx::Rect bounds = layer()->bounds(); | 
|  | 33 | 
|  | 34   ui::PaintRecorder recorder(context, layer()->size()); | 
|  | 35   gfx::Canvas* canvas = recorder.canvas(); | 
|  | 36   if (should_render_circle()) { | 
|  | 37     gfx::Point midpoint(bounds.width() * 0.5f, bounds.height() * 0.5f); | 
|  | 38     canvas->DrawCircle(midpoint, circle_radius_, paint); | 
|  | 39   } else { | 
|  | 40     canvas->DrawRoundRect(bounds, rounded_rect_corner_radius_, paint); | 
|  | 41   } | 
|  | 42 } | 
|  | 43 | 
|  | 44 void InkDropDelegate::OnDelegatedFrameDamage( | 
|  | 45     const gfx::Rect& damage_rect_in_dip) {} | 
|  | 46 | 
|  | 47 void InkDropDelegate::OnDeviceScaleFactorChanged(float device_scale_factor) {} | 
|  | 48 | 
|  | 49 base::Closure InkDropDelegate::PrepareForLayerBoundsChange() { | 
|  | 50   return base::Closure(); | 
|  | 51 } | 
|  | 52 | 
|  | 53 }  // namespace views | 
| OLD | NEW | 
|---|