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 "ash/mus/shadow.h" | 5 #include "ash/mus/shadow.h" |
6 | 6 |
7 #include "ash/mus/property_util.h" | 7 #include "ash/mus/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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 int aperture_y = std::min(aperture, layer_bounds.height() / 2); | 200 int aperture_y = std::min(aperture, layer_bounds.height() / 2); |
201 gfx::Rect aperture_rect(aperture_x, aperture_y, | 201 gfx::Rect aperture_rect(aperture_x, aperture_y, |
202 image_size_.width() - aperture_x * 2, | 202 image_size_.width() - aperture_x * 2, |
203 image_size_.height() - aperture_y * 2); | 203 image_size_.height() - aperture_y * 2); |
204 | 204 |
205 shadow_layer_->UpdateNinePatchLayerAperture(aperture_rect); | 205 shadow_layer_->UpdateNinePatchLayerAperture(aperture_rect); |
206 shadow_layer_->UpdateNinePatchLayerBorder( | 206 shadow_layer_->UpdateNinePatchLayerBorder( |
207 gfx::Rect(aperture_x, aperture_y, aperture_x * 2, aperture_y * 2)); | 207 gfx::Rect(aperture_x, aperture_y, aperture_x * 2, aperture_y * 2)); |
208 | 208 |
209 // The content bounds in the shadow's layer space are offsetted by | 209 // The content bounds in the shadow's layer space are offsetted by |
210 // |interior_inset_|. The occlusion area also has to be shrinked to | 210 // |interior_inset_|. The occlusion area also has to be shrunk to allow |
211 // allow rounded corners overdrawing on top of the window's content. | 211 // rounded corners overdrawing on top of the window's content. |
212 gfx::Rect content_bounds( | 212 gfx::Rect content_bounds(interior_inset_ + kRoundedCornerRadius, |
213 content_bounds_.x() + interior_inset_ + kRoundedCornerRadius, | 213 interior_inset_ + kRoundedCornerRadius, |
214 content_bounds_.y() + interior_inset_ + kRoundedCornerRadius, | 214 content_bounds_.width() - 2 * kRoundedCornerRadius, |
215 content_bounds_.width() - 2 * kRoundedCornerRadius, | 215 content_bounds_.height() - 2 * kRoundedCornerRadius); |
216 content_bounds_.height() - 2 * kRoundedCornerRadius); | |
217 shadow_layer_->UpdateNinePatchOcclusion(content_bounds); | 216 shadow_layer_->UpdateNinePatchOcclusion(content_bounds); |
218 } | 217 } |
219 | 218 |
220 void Shadow::OnWindowDestroyed(ui::Window* window) { | 219 void Shadow::OnWindowDestroyed(ui::Window* window) { |
221 DCHECK_EQ(window_, window); | 220 DCHECK_EQ(window_, window); |
222 window_ = nullptr; | 221 window_ = nullptr; |
223 } | 222 } |
224 | 223 |
225 } // namespace mus | 224 } // namespace mus |
226 } // namespace ash | 225 } // namespace ash |
OLD | NEW |