-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ash: Simplify code for PIP rounded corners
Bug: 1217288 Test: manual Change-Id: Ic92ea44815bb3ce0d08e61f120cfb726aba3d6ad Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2964245 Reviewed-by: Mitsuru Oshima <oshima@chromium.org> Reviewed-by: Dana Fried <dfried@chromium.org> Commit-Queue: Avery Musbach <amusbach@chromium.org> Cr-Commit-Position: refs/heads/master@{#892769}
- Loading branch information
Avery Musbach
authored and
Chromium LUCI CQ
committed
Jun 15, 2021
1 parent
d06ee5f
commit 7a7fbd3
Showing
11 changed files
with
74 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (c) 2021 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "ash/public/cpp/rounded_corner_utils.h" | ||
|
||
#include "ui/aura/window.h" | ||
#include "ui/compositor/layer.h" | ||
#include "ui/compositor_extra/shadow.h" | ||
#include "ui/gfx/geometry/rounded_corners_f.h" | ||
#include "ui/wm/core/shadow_controller.h" | ||
|
||
namespace ash { | ||
|
||
void SetCornerRadius(aura::Window* shadow_window, | ||
ui::Layer* layer, | ||
int radius) { | ||
layer->SetRoundedCornerRadius({radius, radius, radius, radius}); | ||
layer->SetIsFastRoundedCorner(true); | ||
|
||
ui::Shadow* shadow = wm::ShadowController::GetShadowForWindow(shadow_window); | ||
if (shadow) | ||
shadow->SetRoundedCornerRadius(radius); | ||
} | ||
|
||
} // namespace ash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) 2021 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef ASH_PUBLIC_CPP_ROUNDED_CORNER_UTILS_H_ | ||
#define ASH_PUBLIC_CPP_ROUNDED_CORNER_UTILS_H_ | ||
|
||
#include "ash/public/cpp/ash_public_export.h" | ||
|
||
namespace aura { | ||
class Window; | ||
} | ||
|
||
namespace ui { | ||
class Layer; | ||
} | ||
|
||
namespace ash { | ||
|
||
// Puts rounded corners with |radius| on |layer|, and on |shadow_window|'s | ||
// shadow if it has one. Enables fast rounded corners on |layer|. | ||
ASH_PUBLIC_EXPORT void SetCornerRadius(aura::Window* shadow_window, | ||
ui::Layer* layer, | ||
int radius); | ||
|
||
} // namespace ash | ||
|
||
#endif // ASH_PUBLIC_CPP_ROUNDED_CORNER_UTILS_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters