wm: Remove trilinear filtering from window mirror view
All callsites are false, making this dead code. Check the feature flag (which has been disabled by default for a long time). Test: existing tests Bug: none Change-Id: Ib9316df62716d1e5e4fa1e907cee12303242fb06 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4494657 Reviewed-by: Toni Barzic <tbarzic@chromium.org> Reviewed-by: Xiaodan Zhu <zxdan@chromium.org> Commit-Queue: Sammie Quon <sammiequon@chromium.org> Cr-Commit-Position: refs/heads/main@{#1138043}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
c7e3a3ec04
commit
ed08c80cfe
@ -38,8 +38,7 @@ constexpr int kPreviewBorderRadius = 4;
|
||||
|
||||
WindowPreview::WindowPreview(aura::Window* window, Delegate* delegate)
|
||||
: delegate_(delegate) {
|
||||
preview_view_ =
|
||||
new WindowPreviewView(window, /*trilinear_filtering_on_init=*/false);
|
||||
preview_view_ = new WindowPreviewView(window);
|
||||
preview_container_view_ = new views::View();
|
||||
preview_container_view_->SetBackground(views::CreateRoundedRectBackground(
|
||||
kPreviewContainerBgColor, kPreviewBorderRadius));
|
||||
|
@ -121,14 +121,13 @@ class DragWindowController::DragWindowDetails {
|
||||
widget_->set_focus_on_creation(false);
|
||||
widget_->Init(std::move(params));
|
||||
|
||||
// TODO(crbug.com/1026746): Change this to WindowPreviewView.
|
||||
// TODO(b/252525521): Change this to WindowPreviewView.
|
||||
// WindowPreviewView can show transient children, but currently does not
|
||||
// show popups due to performance reasons. WindowPreviewView also needs to
|
||||
// be modified so that it can optionally be clipped to the main window's
|
||||
// bounds.
|
||||
widget_->SetContentsView(std::make_unique<WindowMirrorView>(
|
||||
original_window, /*trilinear_filtering_on_init=*/false,
|
||||
/*show_non_client_view=*/true));
|
||||
original_window, /*show_non_client_view=*/true));
|
||||
|
||||
aura::Window* window = widget_->GetNativeWindow();
|
||||
window->SetId(kShellWindowId_PhantomWindow);
|
||||
|
@ -108,9 +108,8 @@ void WindowMiniView::SetShowPreview(bool show) {
|
||||
return;
|
||||
}
|
||||
|
||||
preview_view_ = AddChildView(std::make_unique<WindowPreviewView>(
|
||||
source_window_,
|
||||
/*trilinear_filtering_on_init=*/false));
|
||||
preview_view_ =
|
||||
AddChildView(std::make_unique<WindowPreviewView>(source_window_));
|
||||
preview_view_->SetPaintToLayer();
|
||||
preview_view_->layer()->SetFillsBoundsOpaquely(false);
|
||||
Layout();
|
||||
|
@ -32,11 +32,8 @@ void EnsureAllChildrenAreVisible(ui::Layer* layer) {
|
||||
} // namespace
|
||||
|
||||
WindowMirrorView::WindowMirrorView(aura::Window* source,
|
||||
bool trilinear_filtering_on_init,
|
||||
bool show_non_client_view)
|
||||
: source_(source),
|
||||
trilinear_filtering_on_init_(trilinear_filtering_on_init),
|
||||
show_non_client_view_(show_non_client_view) {
|
||||
: source_(source), show_non_client_view_(show_non_client_view) {
|
||||
source_->AddObserver(this);
|
||||
DCHECK(source);
|
||||
}
|
||||
@ -147,11 +144,6 @@ void WindowMirrorView::InitLayerOwner() {
|
||||
EnsureAllChildrenAreVisible(mirror_layer);
|
||||
}
|
||||
|
||||
if (trilinear_filtering_on_init_) {
|
||||
mirror_layer->AddCacheRenderSurfaceRequest();
|
||||
mirror_layer->AddTrilinearFilteringRequest();
|
||||
}
|
||||
|
||||
Layout();
|
||||
}
|
||||
|
||||
|
@ -27,9 +27,8 @@ namespace ash {
|
||||
class ASH_EXPORT WindowMirrorView : public views::View,
|
||||
public aura::WindowObserver {
|
||||
public:
|
||||
WindowMirrorView(aura::Window* source,
|
||||
bool trilinear_filtering_on_init,
|
||||
bool show_non_client_view = false);
|
||||
explicit WindowMirrorView(aura::Window* source,
|
||||
bool show_non_client_view = false);
|
||||
|
||||
WindowMirrorView(const WindowMirrorView&) = delete;
|
||||
WindowMirrorView& operator=(const WindowMirrorView&) = delete;
|
||||
@ -77,10 +76,6 @@ class ASH_EXPORT WindowMirrorView : public views::View,
|
||||
// the first time the view becomes visible.
|
||||
std::unique_ptr<ui::LayerTreeOwner> layer_owner_;
|
||||
|
||||
// True if trilinear filtering should be performed on the layer in
|
||||
// InitLayerOwner().
|
||||
const bool trilinear_filtering_on_init_;
|
||||
|
||||
// If true, shows the non client view in the mirror.
|
||||
const bool show_non_client_view_;
|
||||
|
||||
|
@ -6,9 +6,8 @@
|
||||
|
||||
namespace ash {
|
||||
|
||||
WindowMirrorViewPip::WindowMirrorViewPip(aura::Window* source,
|
||||
bool trilinear_filtering_on_init)
|
||||
: WindowMirrorView(source, trilinear_filtering_on_init) {}
|
||||
WindowMirrorViewPip::WindowMirrorViewPip(aura::Window* source)
|
||||
: WindowMirrorView(source) {}
|
||||
|
||||
WindowMirrorViewPip::~WindowMirrorViewPip() = default;
|
||||
|
||||
|
@ -14,7 +14,7 @@ namespace ash {
|
||||
// PIP windows with the controls not shown.
|
||||
class WindowMirrorViewPip : public WindowMirrorView {
|
||||
public:
|
||||
WindowMirrorViewPip(aura::Window* source, bool trilinear_filtering_on_init);
|
||||
explicit WindowMirrorViewPip(aura::Window* source);
|
||||
|
||||
WindowMirrorViewPip(const WindowMirrorViewPip&) = delete;
|
||||
WindowMirrorViewPip& operator=(const WindowMirrorViewPip&) = delete;
|
||||
|
@ -27,8 +27,7 @@ TEST_F(WindowMirrorViewTest, LocalWindowOcclusionMadeVisible) {
|
||||
widget_window->GetOcclusionState());
|
||||
|
||||
auto mirror_widget = CreateTestWidget();
|
||||
auto mirror_view = std::make_unique<WindowMirrorView>(
|
||||
widget_window, /*trilinear_filtering_on_init=*/false);
|
||||
auto mirror_view = std::make_unique<WindowMirrorView>(widget_window);
|
||||
mirror_widget->widget_delegate()->GetContentsView()->AddChildView(
|
||||
mirror_view.get());
|
||||
|
||||
@ -51,8 +50,7 @@ TEST_F(WindowMirrorViewTest, MirrorLayerHasNoTransformWhenNonClientViewShown) {
|
||||
|
||||
auto mirror_widget = CreateTestWidget();
|
||||
auto mirror_view = std::make_unique<WindowMirrorView>(
|
||||
widget_window, /*trilinear_filtering_on_init=*/false,
|
||||
/*show_non_client_view=*/true);
|
||||
widget_window, /*show_non_client_view=*/true);
|
||||
mirror_view->RecreateMirrorLayers();
|
||||
|
||||
EXPECT_TRUE(
|
||||
|
@ -41,10 +41,7 @@ gfx::Rect GetClientAreaBoundsInScreen(aura::Window* window) {
|
||||
|
||||
} // namespace
|
||||
|
||||
WindowPreviewView::WindowPreviewView(aura::Window* window,
|
||||
bool trilinear_filtering_on_init)
|
||||
: window_(window),
|
||||
trilinear_filtering_on_init_(trilinear_filtering_on_init) {
|
||||
WindowPreviewView::WindowPreviewView(aura::Window* window) : window_(window) {
|
||||
DCHECK(window);
|
||||
aura::client::GetTransientWindowClient()->AddObserver(this);
|
||||
|
||||
@ -158,12 +155,11 @@ void WindowPreviewView::AddWindow(aura::Window* window) {
|
||||
if (!window->HasObserver(this))
|
||||
window->AddObserver(this);
|
||||
|
||||
auto* mirror_view =
|
||||
window_util::IsArcPipWindow(window)
|
||||
? new WindowMirrorViewPip(window, trilinear_filtering_on_init_)
|
||||
: new WindowMirrorView(window, trilinear_filtering_on_init_);
|
||||
mirror_views_[window] = mirror_view;
|
||||
AddChildView(mirror_view);
|
||||
auto mirror_view = window_util::IsArcPipWindow(window)
|
||||
? std::make_unique<WindowMirrorViewPip>(window)
|
||||
: std::make_unique<WindowMirrorView>(window);
|
||||
mirror_views_[window] = mirror_view.get();
|
||||
AddChildView(std::move(mirror_view));
|
||||
}
|
||||
|
||||
void WindowPreviewView::RemoveWindow(aura::Window* window) {
|
||||
@ -180,11 +176,10 @@ void WindowPreviewView::RemoveWindow(aura::Window* window) {
|
||||
return;
|
||||
|
||||
auto* view = it->second;
|
||||
RemoveChildView(view);
|
||||
RemoveChildViewT(view);
|
||||
it->first->RemoveObserver(this);
|
||||
|
||||
mirror_views_.erase(it);
|
||||
delete view;
|
||||
}
|
||||
|
||||
gfx::RectF WindowPreviewView::GetUnionRect() const {
|
||||
|
@ -24,7 +24,7 @@ class ASH_EXPORT WindowPreviewView
|
||||
public aura::client::TransientWindowClientObserver,
|
||||
public aura::WindowObserver {
|
||||
public:
|
||||
WindowPreviewView(aura::Window* window, bool trilinear_filtering_on_init);
|
||||
explicit WindowPreviewView(aura::Window* window);
|
||||
|
||||
WindowPreviewView(const WindowPreviewView&) = delete;
|
||||
WindowPreviewView& operator=(const WindowPreviewView&) = delete;
|
||||
@ -63,7 +63,6 @@ class ASH_EXPORT WindowPreviewView
|
||||
gfx::RectF GetUnionRect() const;
|
||||
|
||||
raw_ptr<aura::Window, ExperimentalAsh> window_;
|
||||
bool trilinear_filtering_on_init_;
|
||||
|
||||
base::flat_map<aura::Window*, WindowMirrorView*> mirror_views_;
|
||||
|
||||
|
@ -27,7 +27,7 @@ std::unique_ptr<views::Widget> CreateTransientChild(
|
||||
params.bounds = gfx::Rect{40, 50};
|
||||
params.context = params.parent = parent_widget->GetNativeWindow();
|
||||
params.init_properties_container.SetProperty(
|
||||
aura::client::kAppType, static_cast<int>(ash::AppType::ARC_APP));
|
||||
aura::client::kAppType, static_cast<int>(AppType::ARC_APP));
|
||||
widget->Init(std::move(params));
|
||||
widget->Show();
|
||||
return widget;
|
||||
@ -40,10 +40,9 @@ TEST_F(WindowPreviewViewTest, Basic) {
|
||||
auto widget1 = CreateTestWidget();
|
||||
auto widget2 = CreateTestWidget();
|
||||
|
||||
::wm::AddTransientChild(widget1->GetNativeWindow(),
|
||||
widget2->GetNativeWindow());
|
||||
auto preview_view = std::make_unique<WindowPreviewView>(
|
||||
widget1->GetNativeWindow(), /*trilinear_filtering_on_init=*/false);
|
||||
wm::AddTransientChild(widget1->GetNativeWindow(), widget2->GetNativeWindow());
|
||||
auto preview_view =
|
||||
std::make_unique<WindowPreviewView>(widget1->GetNativeWindow());
|
||||
WindowPreviewViewTestApi test_api(preview_view.get());
|
||||
EXPECT_EQ(2u, test_api.GetMirrorViews().size());
|
||||
EXPECT_TRUE(test_api.GetMirrorViews().contains(widget1->GetNativeWindow()));
|
||||
@ -56,8 +55,7 @@ TEST_F(WindowPreviewViewTest, AspectRatio) {
|
||||
// Default frame header is 32dp, so we expect a window of size 300, 300 to
|
||||
// have a preview of 1:1 ratio.
|
||||
auto window = CreateAppWindow(gfx::Rect(300, 332));
|
||||
auto preview_view = std::make_unique<WindowPreviewView>(
|
||||
window.get(), /*trilinear_filtering_on_init=*/false);
|
||||
auto preview_view = std::make_unique<WindowPreviewView>(window.get());
|
||||
|
||||
const gfx::SizeF preferred_size(preview_view->GetPreferredSize());
|
||||
EXPECT_EQ(1.f, preferred_size.width() / preferred_size.height());
|
||||
@ -72,8 +70,8 @@ TEST_F(WindowPreviewViewTest, TransientChildAddedAndRemoved) {
|
||||
|
||||
::wm::AddTransientChild(widget1->GetNativeWindow(),
|
||||
widget2->GetNativeWindow());
|
||||
auto preview_view = std::make_unique<WindowPreviewView>(
|
||||
widget1->GetNativeWindow(), /*trilinear_filtering_on_init=*/false);
|
||||
auto preview_view =
|
||||
std::make_unique<WindowPreviewView>(widget1->GetNativeWindow());
|
||||
WindowPreviewViewTestApi test_api(preview_view.get());
|
||||
ASSERT_EQ(2u, test_api.GetMirrorViews().size());
|
||||
|
||||
@ -99,8 +97,8 @@ TEST_F(WindowPreviewViewTest, NoCrashWithTransientChildWithNoWindowState) {
|
||||
EXPECT_EQ(widget1->GetNativeWindow(),
|
||||
wm::GetTransientParent(transient_child1->GetNativeWindow()));
|
||||
|
||||
auto preview_view = std::make_unique<WindowPreviewView>(
|
||||
widget1->GetNativeWindow(), /*trilinear_filtering_on_init=*/false);
|
||||
auto preview_view =
|
||||
std::make_unique<WindowPreviewView>(widget1->GetNativeWindow());
|
||||
WindowPreviewViewTestApi test_api(preview_view.get());
|
||||
ASSERT_EQ(2u, test_api.GetMirrorViews().size());
|
||||
|
||||
@ -135,8 +133,8 @@ TEST_F(WindowPreviewViewTest,
|
||||
NoCrashWhenWindowCyclingIsCanceledWithATransientPopup) {
|
||||
auto widget1 = CreateTestWidget();
|
||||
|
||||
auto preview_view = std::make_unique<WindowPreviewView>(
|
||||
widget1->GetNativeWindow(), /*trilinear_filtering_on_init=*/false);
|
||||
auto preview_view =
|
||||
std::make_unique<WindowPreviewView>(widget1->GetNativeWindow());
|
||||
WindowPreviewViewTestApi test_api(preview_view.get());
|
||||
ASSERT_EQ(1u, test_api.GetMirrorViews().size());
|
||||
|
||||
@ -163,8 +161,8 @@ TEST_F(WindowPreviewViewTest, LayoutChildWithinParentBounds) {
|
||||
widget2->GetNativeWindow());
|
||||
|
||||
// The top inset is excluded from GetUnionRect() calculations.
|
||||
auto preview_view = std::make_unique<WindowPreviewView>(
|
||||
widget1->GetNativeWindow(), /*trilinear_filtering_on_init=*/false);
|
||||
auto preview_view =
|
||||
std::make_unique<WindowPreviewView>(widget1->GetNativeWindow());
|
||||
WindowPreviewViewTestApi test_api(preview_view.get());
|
||||
EXPECT_EQ(gfx::RectF(100.f, 100.f), test_api.GetUnionRect());
|
||||
|
||||
@ -196,8 +194,8 @@ TEST_F(WindowPreviewViewTest, LayoutChildOutsideParentBounds) {
|
||||
|
||||
// Get the union rect of the two windows. The top inset is excluded from
|
||||
// calculations.
|
||||
auto preview_view = std::make_unique<WindowPreviewView>(
|
||||
widget1->GetNativeWindow(), /*trilinear_filtering_on_init=*/false);
|
||||
auto preview_view =
|
||||
std::make_unique<WindowPreviewView>(widget1->GetNativeWindow());
|
||||
WindowPreviewViewTestApi test_api(preview_view.get());
|
||||
EXPECT_EQ(gfx::RectF(400.f, 400.f), test_api.GetUnionRect());
|
||||
|
||||
|
Reference in New Issue
Block a user