Index: ui/wm/core/shadow.cc |
diff --git a/ui/wm/core/shadow.cc b/ui/wm/core/shadow.cc |
index 0395a4a3c9919096a6f9237caef7507a25ef0ac3..b473a14099573630fb51d5de2b0d1e941bf0e30d 100644 |
--- a/ui/wm/core/shadow.cc |
+++ b/ui/wm/core/shadow.cc |
@@ -172,15 +172,11 @@ void Shadow::UpdateImagesForStyle() { |
break; |
} |
- // Calculate shadow aperture for style. |
- int shadow_aperture = GetShadowApertureForStyle(style_); |
- gfx::Rect aperture(shadow_aperture, |
- shadow_aperture, |
- image.Width() - shadow_aperture * 2, |
- image.Height() - shadow_aperture * 2); |
- |
// Update nine-patch layer with new bitmap and aperture. |
danakj
2014/09/18 21:28:18
this isn't setting the aperture anymore is it?
hshi1
2014/09/18 21:31:21
Done.
|
- shadow_layer_->UpdateNinePatchLayerBitmap(image.AsBitmap(), aperture); |
+ shadow_layer_->UpdateNinePatchLayerBitmap(image.AsBitmap()); |
+ |
+ // Update shadow image size. |
+ image_size_ = gfx::Size(image.Width(), image.Height()); |
danakj
2014/09/18 21:28:18
image_size_ = image.Size(); ?
hshi1
2014/09/18 21:31:21
Done.
|
// Update interior inset for style. |
interior_inset_ = GetInteriorInsetForStyle(style_); |
@@ -196,18 +192,17 @@ void Shadow::UpdateLayerBounds() { |
layer()->SetBounds(layer_bounds); |
shadow_layer_->SetBounds(gfx::Rect(layer_bounds.size())); |
- // Calculate shadow border for style. Note that border is in layer space |
- // and it cannot exceed the bounds of the layer. |
- int shadow_aperture = GetShadowApertureForStyle(style_); |
- gfx::Rect border(shadow_aperture, shadow_aperture, |
- shadow_aperture * 2, shadow_aperture * 2); |
- if (layer_bounds.width() < border.width() || |
- layer_bounds.height() < border.height()) { |
- shadow_layer_->SetVisible(false); |
- } else { |
- shadow_layer_->SetVisible(true); |
- shadow_layer_->UpdateNinePatchLayerBorder(border); |
- } |
+ // Update the shadow aperture and border for style. Note that border is in |
+ // layer space and it cannot exceed the bounds of the layer. |
+ int aperture = GetShadowApertureForStyle(style_); |
+ int aperture_x = std::min(aperture, layer_bounds.width() / 2); |
+ int aperture_y = std::min(aperture, layer_bounds.height() / 2); |
+ shadow_layer_->UpdateNinePatchLayerAperture( |
+ gfx::Rect(aperture_x, aperture_y, |
+ image_size_.width() - aperture_x * 2, |
+ image_size_.height() - aperture_y * 2)); |
+ shadow_layer_->UpdateNinePatchLayerBorder( |
+ gfx::Rect(aperture_x, aperture_y, aperture_x * 2, aperture_y * 2)); |
} |
} // namespace wm |