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

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: Remove redundant comments. 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
« no previous file with comments | « 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 #include "ui/surface/surface_switches.h" 32 #include "ui/surface/surface_switches.h"
32 33
33 namespace d3d_utils = ui_surface_d3d9_utils; 34 namespace d3d_utils = ui_surface_d3d9_utils;
34 35
35 namespace { 36 namespace {
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 // If invalidated, do nothing, the window is gone. 483 // If invalidated, do nothing, the window is gone.
483 if (!window_) { 484 if (!window_) {
484 TRACE_EVENT0("gpu", "EarlyOut_NoWindow"); 485 TRACE_EVENT0("gpu", "EarlyOut_NoWindow");
485 return; 486 return;
486 } 487 }
487 488
488 #if !defined(USE_AURA) 489 #if !defined(USE_AURA)
489 // If the window is a different size than the swap chain that is being 490 // If the window is a different size than the swap chain that is being
490 // presented then drop the frame. 491 // presented then drop the frame.
491 gfx::Size window_size = GetWindowSize(); 492 gfx::Size window_size = GetWindowSize();
492 if (hidden_ && size != window_size) { 493 #if defined(ENABLE_HIDPI)
494 // Check if the size mismatch is within allowable round off or truncation
495 // error.
496 gfx::Size dip_size = ui::win::ScreenToDIPSize(window_size);
497 gfx::Size pixel_size = ui::win::DIPToScreenSize(dip_size);
498 bool size_mismatch = abs(window_size.width() - size.width()) >
499 abs(window_size.width() - pixel_size.width()) ||
500 abs(window_size.height() - size.height()) >
501 abs(window_size.height() - pixel_size.height());
502 #else
503 bool size_mismatch = size != window_size;
504 #endif
505 if (hidden_ && size_mismatch) {
493 TRACE_EVENT2("gpu", "EarlyOut_WrongWindowSize", 506 TRACE_EVENT2("gpu", "EarlyOut_WrongWindowSize",
494 "backwidth", size.width(), "backheight", size.height()); 507 "backwidth", size.width(), "backheight", size.height());
495 TRACE_EVENT2("gpu", "EarlyOut_WrongWindowSize2", 508 TRACE_EVENT2("gpu", "EarlyOut_WrongWindowSize2",
496 "windowwidth", window_size.width(), 509 "windowwidth", window_size.width(),
497 "windowheight", window_size.height()); 510 "windowheight", window_size.height());
498 return; 511 return;
499 } 512 }
500 #endif 513 #endif
501 514
502 // Round up size so the swap chain is not continuously resized with the 515 // Round up size so the swap chain is not continuously resized with the
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 presenter_->AsyncCopyTo(src_subrect, dst_size, buf, callback); 805 presenter_->AsyncCopyTo(src_subrect, dst_size, buf, callback);
793 } 806 }
794 807
795 void AcceleratedSurface::Suspend() { 808 void AcceleratedSurface::Suspend() {
796 presenter_->Suspend(); 809 presenter_->Suspend();
797 } 810 }
798 811
799 void AcceleratedSurface::WasHidden() { 812 void AcceleratedSurface::WasHidden() {
800 presenter_->WasHidden(); 813 presenter_->WasHidden();
801 } 814 }
OLDNEW
« no previous file with comments | « ui/gfx/screen_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698