| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/animation/ink_drop_mask.h" | 5 #include "ui/views/animation/ink_drop_mask.h" |
| 6 | 6 |
| 7 #include "skia/ext/cdl_paint.h" |
| 7 #include "third_party/skia/include/core/SkPaint.h" | 8 #include "third_party/skia/include/core/SkPaint.h" |
| 8 #include "ui/compositor/paint_recorder.h" | 9 #include "ui/compositor/paint_recorder.h" |
| 9 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
| 10 | 11 |
| 11 namespace views { | 12 namespace views { |
| 12 | 13 |
| 13 // InkDropMask | 14 // InkDropMask |
| 14 | 15 |
| 15 InkDropMask::InkDropMask(const gfx::Size& layer_size) | 16 InkDropMask::InkDropMask(const gfx::Size& layer_size) |
| 16 : layer_(ui::LAYER_TEXTURED) { | 17 : layer_(ui::LAYER_TEXTURED) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 35 // RoundRectInkDropMask | 36 // RoundRectInkDropMask |
| 36 | 37 |
| 37 RoundRectInkDropMask::RoundRectInkDropMask(const gfx::Size& layer_size, | 38 RoundRectInkDropMask::RoundRectInkDropMask(const gfx::Size& layer_size, |
| 38 const gfx::Insets& mask_insets, | 39 const gfx::Insets& mask_insets, |
| 39 int corner_radius) | 40 int corner_radius) |
| 40 : InkDropMask(layer_size), | 41 : InkDropMask(layer_size), |
| 41 mask_insets_(mask_insets), | 42 mask_insets_(mask_insets), |
| 42 corner_radius_(corner_radius) {} | 43 corner_radius_(corner_radius) {} |
| 43 | 44 |
| 44 void RoundRectInkDropMask::OnPaintLayer(const ui::PaintContext& context) { | 45 void RoundRectInkDropMask::OnPaintLayer(const ui::PaintContext& context) { |
| 45 SkPaint paint; | 46 CdlPaint paint; |
| 46 paint.setAlpha(255); | 47 paint.setAlpha(255); |
| 47 paint.setStyle(SkPaint::kFill_Style); | 48 paint.setStyle(CdlPaint::kFill_Style); |
| 48 paint.setAntiAlias(true); | 49 paint.setAntiAlias(true); |
| 49 | 50 |
| 50 ui::PaintRecorder recorder(context, layer()->size()); | 51 ui::PaintRecorder recorder(context, layer()->size()); |
| 51 gfx::Rect bounds = layer()->bounds(); | 52 gfx::Rect bounds = layer()->bounds(); |
| 52 bounds.Inset(mask_insets_); | 53 bounds.Inset(mask_insets_); |
| 53 recorder.canvas()->DrawRoundRect(bounds, corner_radius_, paint); | 54 recorder.canvas()->DrawRoundRect(bounds, corner_radius_, paint); |
| 54 } | 55 } |
| 55 | 56 |
| 56 // CircleInkDropMask | 57 // CircleInkDropMask |
| 57 | 58 |
| 58 CircleInkDropMask::CircleInkDropMask(const gfx::Size& layer_size, | 59 CircleInkDropMask::CircleInkDropMask(const gfx::Size& layer_size, |
| 59 const gfx::Point& mask_center, | 60 const gfx::Point& mask_center, |
| 60 int mask_radius) | 61 int mask_radius) |
| 61 : InkDropMask(layer_size), | 62 : InkDropMask(layer_size), |
| 62 mask_center_(mask_center), | 63 mask_center_(mask_center), |
| 63 mask_radius_(mask_radius) {} | 64 mask_radius_(mask_radius) {} |
| 64 | 65 |
| 65 void CircleInkDropMask::OnPaintLayer(const ui::PaintContext& context) { | 66 void CircleInkDropMask::OnPaintLayer(const ui::PaintContext& context) { |
| 66 SkPaint paint; | 67 CdlPaint paint; |
| 67 paint.setAlpha(255); | 68 paint.setAlpha(255); |
| 68 paint.setStyle(SkPaint::kFill_Style); | 69 paint.setStyle(CdlPaint::kFill_Style); |
| 69 paint.setAntiAlias(true); | 70 paint.setAntiAlias(true); |
| 70 | 71 |
| 71 ui::PaintRecorder recorder(context, layer()->size()); | 72 ui::PaintRecorder recorder(context, layer()->size()); |
| 72 recorder.canvas()->DrawCircle(mask_center_, mask_radius_, paint); | 73 recorder.canvas()->DrawCircle(mask_center_, mask_radius_, paint); |
| 73 } | 74 } |
| 74 | 75 |
| 75 } // namespace views | 76 } // namespace views |
| OLD | NEW |