[MacViews] Show comboboxes with a native NSMenu
[chromium-blink-merge.git] / ui / views / animation / ink_drop_delegate.cc
blobd2b3c7124cf474dbe86a04e956c74b9e0341d9a4
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.
5 #include "ui/views/animation/ink_drop_delegate.h"
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"
12 namespace views {
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) {}
24 InkDropDelegate::~InkDropDelegate() {}
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);
32 gfx::Rect bounds = layer_->bounds();
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);
44 void InkDropDelegate::OnDelegatedFrameDamage(
45 const gfx::Rect& damage_rect_in_dip) {}
47 void InkDropDelegate::OnDeviceScaleFactorChanged(float device_scale_factor) {}
49 base::Closure InkDropDelegate::PrepareForLayerBoundsChange() {
50 return base::Closure();
53 } // namespace views