Index: ui/views/animation/ink_drop_painted_layer_delegates.cc |
diff --git a/ui/views/animation/ink_drop_painted_layer_delegates.cc b/ui/views/animation/ink_drop_painted_layer_delegates.cc |
index 6eb553435999ac81bc9687bff87b23493f53d1be..75609d7a2fc97c3c6bbccf04b83e8fbb66d1434b 100644 |
--- a/ui/views/animation/ink_drop_painted_layer_delegates.cc |
+++ b/ui/views/animation/ink_drop_painted_layer_delegates.cc |
@@ -6,6 +6,7 @@ |
#include "third_party/skia/include/core/SkDrawLooper.h" |
#include "third_party/skia/include/core/SkPaint.h" |
+#include "third_party/skia/include/core/SkRRect.h" |
#include "ui/compositor/paint_recorder.h" |
#include "ui/gfx/canvas.h" |
#include "ui/gfx/color_palette.h" |
@@ -132,10 +133,12 @@ void RoundedRectangleLayerDelegate::OnPaintLayer( |
BorderShadowLayerDelegate::BorderShadowLayerDelegate( |
const std::vector<gfx::ShadowValue>& shadows, |
const gfx::Rect& shadowed_area_bounds, |
+ SkColor fill_color, |
int corner_radius) |
: BasePaintedLayerDelegate(gfx::kPlaceholderColor), |
shadows_(shadows), |
bounds_(shadowed_area_bounds), |
+ fill_color_(fill_color), |
corner_radius_(corner_radius) {} |
BorderShadowLayerDelegate::~BorderShadowLayerDelegate() {} |
@@ -152,22 +155,24 @@ gfx::Vector2dF BorderShadowLayerDelegate::GetCenteringOffset() const { |
void BorderShadowLayerDelegate::OnPaintLayer(const ui::PaintContext& context) { |
SkPaint paint; |
- paint.setLooper(gfx::CreateShadowDrawLooperCorrectBlur(shadows_)); |
paint.setStyle(SkPaint::kFill_Style); |
paint.setAntiAlias(true); |
- paint.setColor(SK_ColorTRANSPARENT); |
+ paint.setColor(fill_color_); |
+ |
gfx::RectF rrect_bounds = |
gfx::RectF(bounds_ - GetPaintedBounds().OffsetFromOrigin()); |
+ SkRRect r_rect = SkRRect::MakeRectXY(gfx::RectFToSkRect(rrect_bounds), |
+ corner_radius_, corner_radius_); |
+ // First the fill color. |
ui::PaintRecorder recorder(context, GetPaintedBounds().size()); |
- recorder.canvas()->DrawRoundRect(rrect_bounds, corner_radius_, paint); |
- |
- SkPaint clear_paint; |
- clear_paint.setAntiAlias(true); |
- clear_paint.setXfermodeMode(SkXfermode::kClear_Mode); |
- // If we don't care about actually clearing preexisting buffer content, |
- // this could be replaced with a kDifference clip for the draw above. |
- recorder.canvas()->DrawRoundRect(rrect_bounds, corner_radius_, clear_paint); |
+ recorder.canvas()->sk_canvas()->drawRRect(r_rect, paint); |
+ |
+ // Now the shadow. |
+ paint.setLooper(gfx::CreateShadowDrawLooperCorrectBlur(shadows_)); |
+ recorder.canvas()->sk_canvas()->clipRRect(r_rect, SkRegion::kDifference_Op, |
+ true); |
+ recorder.canvas()->sk_canvas()->drawRRect(r_rect, paint); |
} |
} // namespace views |