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

Side by Side Diff: ui/surface/accelerated_surface_win.cc

Issue 11953054: Fix high-DPI on Windows to make use of DIP scaling in WebKit. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix failing unit tests. Created 7 years, 10 months 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
« ui/base/win/dpi.cc ('K') | « ui/gfx/screen_win.cc ('k') | no next file » | 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 "ui/surface/accelerated_surface_win.h" 5 #include "ui/surface/accelerated_surface_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <algorithm> 8 #include <algorithm>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/debug/trace_event.h" 14 #include "base/debug/trace_event.h"
15 #include "base/file_path.h" 15 #include "base/file_path.h"
16 #include "base/lazy_instance.h" 16 #include "base/lazy_instance.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/message_loop_proxy.h" 18 #include "base/message_loop_proxy.h"
19 #include "base/scoped_native_library.h" 19 #include "base/scoped_native_library.h"
20 #include "base/stringprintf.h" 20 #include "base/stringprintf.h"
21 #include "base/synchronization/waitable_event.h" 21 #include "base/synchronization/waitable_event.h"
22 #include "base/threading/thread.h" 22 #include "base/threading/thread.h"
23 #include "base/threading/thread_restrictions.h" 23 #include "base/threading/thread_restrictions.h"
24 #include "base/time.h" 24 #include "base/time.h"
25 #include "base/win/wrapped_window_proc.h" 25 #include "base/win/wrapped_window_proc.h"
26 #include "ui/base/win/dpi.h"
26 #include "ui/base/win/hwnd_util.h" 27 #include "ui/base/win/hwnd_util.h"
27 #include "ui/gfx/rect.h" 28 #include "ui/gfx/rect.h"
28 #include "ui/gl/gl_switches.h" 29 #include "ui/gl/gl_switches.h"
29 #include "ui/surface/accelerated_surface_transformer_win.h" 30 #include "ui/surface/accelerated_surface_transformer_win.h"
30 #include "ui/surface/d3d9_utils_win.h" 31 #include "ui/surface/d3d9_utils_win.h"
31 32
32 namespace d3d_utils = ui_surface_d3d9_utils; 33 namespace d3d_utils = ui_surface_d3d9_utils;
33 34
34 namespace { 35 namespace {
35 36
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 // If invalidated, do nothing, the window is gone. 470 // If invalidated, do nothing, the window is gone.
470 if (!window_) { 471 if (!window_) {
471 TRACE_EVENT0("gpu", "EarlyOut_NoWindow"); 472 TRACE_EVENT0("gpu", "EarlyOut_NoWindow");
472 return; 473 return;
473 } 474 }
474 475
475 #if !defined(USE_AURA) 476 #if !defined(USE_AURA)
476 // If the window is a different size than the swap chain that is being 477 // If the window is a different size than the swap chain that is being
477 // presented then drop the frame. 478 // presented then drop the frame.
478 gfx::Size window_size = GetWindowSize(); 479 gfx::Size window_size = GetWindowSize();
479 if (hidden_ && size != window_size) { 480 #if defined(ENABLE_HIDPI)
481 // Check if the size mismatch is within allowable round off or truncation
482 // error.
483 gfx::Size dip_size = ui::win::ScreenToDIPSize(window_size);
sky 2013/01/28 20:56:35 Does this ifdef mean GetWindowSize has different m
kevers 2013/01/28 22:53:40 The size mismatch on Windows with high-DPI enabled
484 gfx::Size pixel_size = ui::win::DIPToScreenSize(dip_size);
485 bool size_mismatch = abs(window_size.width() - size.width()) >
486 abs(window_size.width() - pixel_size.width()) ||
487 abs(window_size.height() - size.height()) >
488 abs(window_size.height() - pixel_size.height());
489 #else
490 bool size_mismatch = size != window_size;
491 #endif
492 if (hidden_ && size_mismatch) {
480 TRACE_EVENT2("gpu", "EarlyOut_WrongWindowSize", 493 TRACE_EVENT2("gpu", "EarlyOut_WrongWindowSize",
481 "backwidth", size.width(), "backheight", size.height()); 494 "backwidth", size.width(), "backheight", size.height());
482 TRACE_EVENT2("gpu", "EarlyOut_WrongWindowSize2", 495 TRACE_EVENT2("gpu", "EarlyOut_WrongWindowSize2",
483 "windowwidth", window_size.width(), 496 "windowwidth", window_size.width(),
484 "windowheight", window_size.height()); 497 "windowheight", window_size.height());
485 return; 498 return;
486 } 499 }
487 #endif 500 #endif
488 501
489 // Round up size so the swap chain is not continuously resized with the 502 // Round up size so the swap chain is not continuously resized with the
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 presenter_->AsyncCopyTo(src_subrect, dst_size, buf, callback); 785 presenter_->AsyncCopyTo(src_subrect, dst_size, buf, callback);
773 } 786 }
774 787
775 void AcceleratedSurface::Suspend() { 788 void AcceleratedSurface::Suspend() {
776 presenter_->Suspend(); 789 presenter_->Suspend();
777 } 790 }
778 791
779 void AcceleratedSurface::WasHidden() { 792 void AcceleratedSurface::WasHidden() {
780 presenter_->WasHidden(); 793 presenter_->WasHidden();
781 } 794 }
OLDNEW
« ui/base/win/dpi.cc ('K') | « ui/gfx/screen_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698