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

Unified 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 experimental changes to resource handling. Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« ui/gfx/screen_win.cc ('K') | « ui/gfx/screen_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/surface/accelerated_surface_win.cc
diff --git a/ui/surface/accelerated_surface_win.cc b/ui/surface/accelerated_surface_win.cc
index 6b4e1b1965e13ec3cec574b5c71db97d3abb4eb0..e564271562e2c56fc284a555fc366bf1a4b4496e 100644
--- a/ui/surface/accelerated_surface_win.cc
+++ b/ui/surface/accelerated_surface_win.cc
@@ -26,6 +26,7 @@
#include "base/time.h"
#include "base/tracked_objects.h"
#include "base/win/wrapped_window_proc.h"
+#include "ui/base/win/dpi.h"
#include "ui/base/win/hwnd_util.h"
#include "ui/gfx/rect.h"
#include "ui/gl/gl_switches.h"
@@ -503,7 +504,19 @@ void AcceleratedPresenter::DoPresentAndAcknowledge(
// If the window is a different size than the swap chain that is being
// presented then drop the frame.
gfx::Size window_size = GetWindowSize();
- if (hidden_ && size != window_size) {
+#if defined(ENABLE_HIDPI)
+ // Check if the size mismatch is within allowable round off or truncation
+ // error.
+ gfx::Size dip_size = ui::win::ScreenToDIPSize(window_size);
+ gfx::Size pixel_size = ui::win::DIPToScreenSize(dip_size);
+ bool size_mismatch = abs(window_size.width() - size.width()) >
+ abs(window_size.width() - pixel_size.width()) ||
+ abs(window_size.height() - size.height()) >
+ abs(window_size.height() - pixel_size.height());
+#else
+ bool size_mismatch = size != window_size;
+#endif
+ if (hidden_ && size_mismatch) {
TRACE_EVENT2("gpu", "EarlyOut_WrongWindowSize",
"backwidth", size.width(), "backheight", size.height());
TRACE_EVENT2("gpu", "EarlyOut_WrongWindowSize2",
@@ -688,7 +701,6 @@ void AcceleratedPresenter::DoReleaseSurface() {
void AcceleratedPresenter::PresentWithGDI(HDC dc) {
TRACE_EVENT0("gpu", "PresentWithGDI");
-
pkotwicz 2013/01/23 19:39:23 Nit: Keep the extra line
kevers 2013/01/23 21:37:00 Done.
if (!present_thread_->device())
return;
« ui/gfx/screen_win.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