OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 "mash/wm/shadow.h" | 5 #include "mash/wm/shadow.h" |
6 | 6 |
7 #include "mash/wm/property_util.h" | 7 #include "mash/wm/property_util.h" |
8 #include "third_party/skia/include/core/SkBitmap.h" | 8 #include "third_party/skia/include/core/SkBitmap.h" |
9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
10 #include "ui/compositor/layer.h" | 10 #include "ui/compositor/layer.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 192 |
193 // Update the shadow aperture and border for style. Note that border is in | 193 // Update the shadow aperture and border for style. Note that border is in |
194 // layer space and it cannot exceed the bounds of the layer. | 194 // layer space and it cannot exceed the bounds of the layer. |
195 int aperture = GetShadowApertureForStyle(style_); | 195 int aperture = GetShadowApertureForStyle(style_); |
196 int aperture_x = std::min(aperture, layer_bounds.width() / 2); | 196 int aperture_x = std::min(aperture, layer_bounds.width() / 2); |
197 int aperture_y = std::min(aperture, layer_bounds.height() / 2); | 197 int aperture_y = std::min(aperture, layer_bounds.height() / 2); |
198 shadow_layer_->UpdateNinePatchLayerAperture( | 198 shadow_layer_->UpdateNinePatchLayerAperture( |
199 gfx::Rect(aperture_x, aperture_y, | 199 gfx::Rect(aperture_x, aperture_y, |
200 image_size_.width() - aperture_x * 2, | 200 image_size_.width() - aperture_x * 2, |
201 image_size_.height() - aperture_y * 2)); | 201 image_size_.height() - aperture_y * 2)); |
202 shadow_layer_->UpdateNinePatchOcclusion( | 202 shadow_layer_->UpdateNinePatchLayerBorder( |
203 content_bounds_ + gfx::Vector2d(interior_inset_, interior_inset_)); | 203 gfx::Rect(aperture_x, aperture_y, aperture_x * 2, aperture_y * 2)); |
204 } | 204 } |
205 | 205 |
206 void Shadow::OnWindowDestroyed(mus::Window* window) { | 206 void Shadow::OnWindowDestroyed(mus::Window* window) { |
207 DCHECK_EQ(window_, window); | 207 DCHECK_EQ(window_, window); |
208 window_ = nullptr; | 208 window_ = nullptr; |
209 } | 209 } |
210 | 210 |
211 } // namespace wm | 211 } // namespace wm |
212 } // namespace mash | 212 } // namespace mash |
OLD | NEW |