Chromium Code Reviews| Index: ash/wm/resize_shadow.cc |
| diff --git a/ash/wm/resize_shadow.cc b/ash/wm/resize_shadow.cc |
| index 847ded20d50b79547df4ea0161a9a8c7ef7a2281..959fe6a6602bbea75b84c643eb5b78b4d733f74a 100644 |
| --- a/ash/wm/resize_shadow.cc |
| +++ b/ash/wm/resize_shadow.cc |
| @@ -19,6 +19,11 @@ namespace { |
| // window. |
| constexpr int kVisualThickness = 8; |
| +// The corner radius of the resize shadow, which not coincidentally matches |
| +// the corner radius of the actual window. |
|
varkha
2017/04/18 22:31:58
Should one just be equal to the other, even if you
Evan Stade
2017/04/19 13:23:10
Arguably. I actually think it's easier to read lik
|
| +static constexpr int kCornerRadiusOfResizeShadow = 2; |
| +static constexpr int kCornerRadiusOfWindow = 2; |
| + |
| // This class simply draws a roundrect. The layout and tiling is handled by |
| // ResizeShadow and NinePatchLayer. |
| class ResizeShadowImageSource : public gfx::CanvasImageSource { |
| @@ -34,12 +39,16 @@ class ResizeShadowImageSource : public gfx::CanvasImageSource { |
| cc::PaintFlags paint; |
| paint.setAntiAlias(true); |
| paint.setColor(SK_ColorBLACK); |
| - canvas->DrawRoundRect(gfx::RectF(gfx::SizeF(size())), kCornerRadius, paint); |
| + canvas->DrawRoundRect(gfx::RectF(gfx::SizeF(size())), |
| + kCornerRadiusOfResizeShadow, paint); |
| } |
| private: |
| - static constexpr int kCornerRadius = 2; |
| - static constexpr int kImageSide = 2 * kVisualThickness + 1; |
| + // The image has to have enough space to depict the visual thickness (left and |
| + // right) plus an inset for extending beneath the window's rounded corner plus |
| + // one pixel for the center of the nine patch. |
| + static constexpr int kImageSide = |
| + 2 * (kVisualThickness + kCornerRadiusOfWindow) + 1; |
| DISALLOW_COPY_AND_ASSIGN(ResizeShadowImageSource); |
| }; |
| @@ -69,7 +78,8 @@ ResizeShadow::ResizeShadow(aura::Window* window) |
| } |
| layer_->UpdateNinePatchLayerImage(*g_shadow_image.Get()); |
| gfx::Rect aperture(g_shadow_image.Get()->size()); |
| - constexpr gfx::Insets kApertureInsets(kVisualThickness); |
| + constexpr gfx::Insets kApertureInsets(kVisualThickness + |
| + kCornerRadiusOfWindow); |
| aperture.Inset(kApertureInsets); |
| layer_->UpdateNinePatchLayerAperture(aperture); |
| layer_->UpdateNinePatchLayerBorder( |