Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: chrome/browser/ui/views/panels/panel_frame_view.cc

Issue 673623002: Fix regions generation on windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/gfx/gfx_tests.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/views/panels/panel_frame_view.h" 5 #include "chrome/browser/ui/views/panels/panel_frame_view.h"
6 6
7 #include "chrome/browser/ui/panels/panel.h" 7 #include "chrome/browser/ui/panels/panel.h"
8 #include "chrome/browser/ui/panels/panel_constants.h" 8 #include "chrome/browser/ui/panels/panel_constants.h"
9 #include "chrome/browser/ui/views/panels/panel_view.h" 9 #include "chrome/browser/ui/views/panels/panel_view.h"
10 #include "chrome/browser/ui/views/tab_icon_view.h" 10 #include "chrome/browser/ui/views/tab_icon_view.h"
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 348
349 #if defined(OS_WIN) 349 #if defined(OS_WIN)
350 // Changing the window region is going to force a paint. Only change the 350 // Changing the window region is going to force a paint. Only change the
351 // window region if the region really differs. 351 // window region if the region really differs.
352 HWND native_window = views::HWNDForWidget(panel_view_->window()); 352 HWND native_window = views::HWNDForWidget(panel_view_->window());
353 base::win::ScopedRegion current_region(::CreateRectRgn(0, 0, 0, 0)); 353 base::win::ScopedRegion current_region(::CreateRectRgn(0, 0, 0, 0));
354 int current_region_result = ::GetWindowRgn(native_window, current_region); 354 int current_region_result = ::GetWindowRgn(native_window, current_region);
355 355
356 gfx::Path window_mask; 356 gfx::Path window_mask;
357 GetWindowMask(size(), &window_mask); 357 GetWindowMask(size(), &window_mask);
358 base::win::ScopedRegion new_region(gfx::CreateHRGNFromSkPath(window_mask)); 358 base::win::ScopedRegion new_region;
359 if (!window_mask.isEmpty())
360 new_region.Set(gfx::CreateHRGNFromSkPath(window_mask));
359 361
360 if (current_region_result == ERROR || 362 const bool has_current_region = current_region != NULL;
361 !::EqualRgn(current_region, new_region)) { 363 const bool has_new_region = new_region != NULL;
364 if (has_current_region != has_new_region ||
365 (has_current_region && !::EqualRgn(current_region, new_region))) {
362 // SetWindowRgn takes ownership of the new_region. 366 // SetWindowRgn takes ownership of the new_region.
363 ::SetWindowRgn(native_window, new_region.release(), TRUE); 367 ::SetWindowRgn(native_window, new_region.release(), TRUE);
364 } 368 }
365 #endif 369 #endif
366 } 370 }
367 371
368 gfx::Rect PanelFrameView::GetBoundsForClientView() const { 372 gfx::Rect PanelFrameView::GetBoundsForClientView() const {
369 // The origin of client-area bounds starts after left border and titlebar and 373 // The origin of client-area bounds starts after left border and titlebar and
370 // spans until hitting the right and bottom borders. 374 // spans until hitting the right and bottom borders.
371 // +------------------------------+ 375 // +------------------------------+
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 #endif 774 #endif
771 } 775 }
772 776
773 bool PanelFrameView::IsWithinResizingArea( 777 bool PanelFrameView::IsWithinResizingArea(
774 const gfx::Point& mouse_location) const { 778 const gfx::Point& mouse_location) const {
775 panel::Resizability resizability = panel_view_->panel()->CanResizeByMouse(); 779 panel::Resizability resizability = panel_view_->panel()->CanResizeByMouse();
776 int edge_hittest = GetFrameEdgeHitTest( 780 int edge_hittest = GetFrameEdgeHitTest(
777 mouse_location, size(), PanelView::kResizeInsideBoundsSize, resizability); 781 mouse_location, size(), PanelView::kResizeInsideBoundsSize, resizability);
778 return edge_hittest != HTNOWHERE; 782 return edge_hittest != HTNOWHERE;
779 } 783 }
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/gfx_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698