diff options
author | glen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-09 19:49:32 +0000 |
---|---|---|
committer | glen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-09 19:49:32 +0000 |
commit | 5d870f2ee49dfb4fb11b4289048547a0bd3c23e5 (patch) | |
tree | b46a4c912b7f3361d0aa141790635e9689373420 | |
parent | 357cf11306e0f7d56fbb808076276fa9519a4967 (diff) | |
download | chromium_src-5d870f2ee49dfb4fb11b4289048547a0bd3c23e5.zip chromium_src-5d870f2ee49dfb4fb11b4289048547a0bd3c23e5.tar.gz chromium_src-5d870f2ee49dfb4fb11b4289048547a0bd3c23e5.tar.bz2 |
Make the bottom edges of the opaque frame rounded.
BUG=40024
TEST=On a non-AeroGlass Windows machine, verify that the bottom edges of the Window are rounded.
Review URL: http://codereview.chromium.org/1560021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44115 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | app/resources/window_bottom_left_corner.png | bin | 139 -> 151 bytes | |||
-rw-r--r-- | app/resources/window_bottom_right_corner.png | bin | 129 -> 152 bytes | |||
-rw-r--r-- | chrome/browser/views/constrained_window_win.cc | 20 | ||||
-rw-r--r-- | chrome/browser/views/frame/opaque_browser_frame_view.cc | 19 | ||||
-rw-r--r-- | views/views.gyp | 2 | ||||
-rw-r--r-- | views/window/custom_frame_view.cc | 20 | ||||
-rw-r--r-- | views/window/window_shape.cc | 46 | ||||
-rw-r--r-- | views/window/window_shape.h | 21 |
8 files changed, 75 insertions, 53 deletions
diff --git a/app/resources/window_bottom_left_corner.png b/app/resources/window_bottom_left_corner.png Binary files differindex 1d3c066..88c420c 100644 --- a/app/resources/window_bottom_left_corner.png +++ b/app/resources/window_bottom_left_corner.png diff --git a/app/resources/window_bottom_right_corner.png b/app/resources/window_bottom_right_corner.png Binary files differindex 83cf5b9..2595f0c 100644 --- a/app/resources/window_bottom_right_corner.png +++ b/app/resources/window_bottom_right_corner.png diff --git a/chrome/browser/views/constrained_window_win.cc b/chrome/browser/views/constrained_window_win.cc index 488f1a4..c70ec75 100644 --- a/chrome/browser/views/constrained_window_win.cc +++ b/chrome/browser/views/constrained_window_win.cc @@ -34,6 +34,7 @@ #include "views/window/client_view.h" #include "views/window/non_client_view.h" #include "views/window/window_resources.h" +#include "views/window/window_shape.h" using base::TimeDelta; @@ -349,24 +350,7 @@ int ConstrainedWindowFrameView::NonClientHitTest(const gfx::Point& point) { void ConstrainedWindowFrameView::GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) { DCHECK(window_mask); - - // Redefine the window visible region for the new size. - window_mask->moveTo(0, 3); - window_mask->lineTo(1, 2); - window_mask->lineTo(1, 1); - window_mask->lineTo(2, 1); - window_mask->lineTo(3, 0); - - window_mask->lineTo(SkIntToScalar(size.width() - 3), 0); - window_mask->lineTo(SkIntToScalar(size.width() - 2), 1); - window_mask->lineTo(SkIntToScalar(size.width() - 1), 1); - window_mask->lineTo(SkIntToScalar(size.width() - 1), 2); - window_mask->lineTo(SkIntToScalar(size.width()), 3); - - window_mask->lineTo(SkIntToScalar(size.width()), - SkIntToScalar(size.height())); - window_mask->lineTo(0, SkIntToScalar(size.height())); - window_mask->close(); + views::GetDefaultWindowMask(size, window_mask); } void ConstrainedWindowFrameView::EnableClose(bool enable) { diff --git a/chrome/browser/views/frame/opaque_browser_frame_view.cc b/chrome/browser/views/frame/opaque_browser_frame_view.cc index e9276f8..6d993d9 100644 --- a/chrome/browser/views/frame/opaque_browser_frame_view.cc +++ b/chrome/browser/views/frame/opaque_browser_frame_view.cc @@ -26,6 +26,7 @@ #include "views/widget/root_view.h" #include "views/window/window.h" #include "views/window/window_resources.h" +#include "views/window/window_shape.h" #if defined(OS_WIN) #include "app/win_util.h" @@ -298,23 +299,7 @@ void OpaqueBrowserFrameView::GetWindowMask(const gfx::Size& size, if (frame_->GetWindow()->IsMaximized() || frame_->GetWindow()->IsFullscreen()) return; - // Redefine the window visible region for the new size. - window_mask->moveTo(0, 3); - window_mask->lineTo(1, 2); - window_mask->lineTo(1, 1); - window_mask->lineTo(2, 1); - window_mask->lineTo(3, 0); - - window_mask->lineTo(SkIntToScalar(size.width() - 3), 0); - window_mask->lineTo(SkIntToScalar(size.width() - 2), 1); - window_mask->lineTo(SkIntToScalar(size.width() - 1), 1); - window_mask->lineTo(SkIntToScalar(size.width() - 1), 2); - window_mask->lineTo(SkIntToScalar(size.width()), 3); - - window_mask->lineTo(SkIntToScalar(size.width()), - SkIntToScalar(size.height())); - window_mask->lineTo(0, SkIntToScalar(size.height())); - window_mask->close(); + views::GetDefaultWindowMask(size, window_mask); } void OpaqueBrowserFrameView::EnableClose(bool enable) { diff --git a/views/views.gyp b/views/views.gyp index 6743959..3369546 100644 --- a/views/views.gyp +++ b/views/views.gyp @@ -300,6 +300,8 @@ 'window/window_resources.h', 'window/window_gtk.cc', 'window/window_gtk.h', + 'window/window_shape.cc', + 'window/window_shape.h', 'window/window_win.cc', 'window/window_win.h', ], diff --git a/views/window/custom_frame_view.cc b/views/window/custom_frame_view.cc index 1598bdd..8bdb3c4 100644 --- a/views/window/custom_frame_view.cc +++ b/views/window/custom_frame_view.cc @@ -17,6 +17,7 @@ #include "grit/app_resources.h" #include "grit/app_strings.h" #include "views/window/client_view.h" +#include "views/window/window_shape.h" #if defined(OS_LINUX) #include "views/window/hit_test.h" #endif @@ -185,27 +186,10 @@ int CustomFrameView::NonClientHitTest(const gfx::Point& point) { void CustomFrameView::GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) { DCHECK(window_mask); - if (frame_->IsMaximized()) return; - // Redefine the window visible region for the new size. - window_mask->moveTo(0, 3); - window_mask->lineTo(1, 2); - window_mask->lineTo(1, 1); - window_mask->lineTo(2, 1); - window_mask->lineTo(3, 0); - - window_mask->lineTo(SkIntToScalar(size.width() - 3), 0); - window_mask->lineTo(SkIntToScalar(size.width() - 2), 1); - window_mask->lineTo(SkIntToScalar(size.width() - 1), 1); - window_mask->lineTo(SkIntToScalar(size.width() - 1), 2); - window_mask->lineTo(SkIntToScalar(size.width()), 3); - - window_mask->lineTo(SkIntToScalar(size.width()), - SkIntToScalar(size.height())); - window_mask->lineTo(0, SkIntToScalar(size.height())); - window_mask->close(); + views::GetDefaultWindowMask(size, window_mask); } void CustomFrameView::EnableClose(bool enable) { diff --git a/views/window/window_shape.cc b/views/window/window_shape.cc new file mode 100644 index 0000000..692602d --- /dev/null +++ b/views/window/window_shape.cc @@ -0,0 +1,46 @@ +// Copyright (c) 2010 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 "views/window/window_shape.h" + +#include "gfx/path.h" +#include "gfx/size.h" + +namespace views { + +void GetDefaultWindowMask(const gfx::Size &size, gfx::Path *window_mask) { + // Redefine the window visible region for the new size. + window_mask->moveTo(0, 3); + window_mask->lineTo(1, 2); + window_mask->lineTo(1, 1); + window_mask->lineTo(2, 1); + window_mask->lineTo(3, 0); + + window_mask->lineTo(SkIntToScalar(size.width() - 3), 0); + window_mask->lineTo(SkIntToScalar(size.width() - 2), 1); + window_mask->lineTo(SkIntToScalar(size.width() - 1), 1); + window_mask->lineTo(SkIntToScalar(size.width() - 1), 2); + window_mask->lineTo(SkIntToScalar(size.width()), 3); + + window_mask->lineTo(SkIntToScalar(size.width()), + SkIntToScalar(size.height() - 3)); + window_mask->lineTo(SkIntToScalar(size.width() - 1), + SkIntToScalar(size.height() - 3)); + window_mask->lineTo(SkIntToScalar(size.width() - 1), + SkIntToScalar(size.height() - 1)); + window_mask->lineTo(SkIntToScalar(size.width() - 3), + SkIntToScalar(size.height() - 2)); + window_mask->lineTo(SkIntToScalar(size.width() - 3), + SkIntToScalar(size.height())); + + window_mask->lineTo(3, SkIntToScalar(size.height())); + window_mask->lineTo(2, SkIntToScalar(size.height() - 2)); + window_mask->lineTo(1, SkIntToScalar(size.height() - 1)); + window_mask->lineTo(1, SkIntToScalar(size.height() - 3)); + window_mask->lineTo(0, SkIntToScalar(size.height() - 3)); + + window_mask->close(); +} + +} // namespace views
\ No newline at end of file diff --git a/views/window/window_shape.h b/views/window/window_shape.h new file mode 100644 index 0000000..5b47415 --- /dev/null +++ b/views/window/window_shape.h @@ -0,0 +1,21 @@ +// Copyright (c) 2010 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 VIEWS_WINDOW_WINDOW_SHAPE_H_ +#define VIEWS_WINDOW_WINDOW_SHAPE_H_ + +namespace gfx { +class Size; +class Path; +} + +namespace views { + +// Sets the window mask to a style that most likely matches +// app/resources/window_* +void GetDefaultWindowMask(const gfx::Size& size, gfx::Path* window_mask); + +} // namespace views + +#endif // #ifndef VIEWS_WINDOW_WINDOW_SHAPE_H_ |