summaryrefslogtreecommitdiffstats
path: root/o3d
diff options
context:
space:
mode:
authorgangji@google.com <gangji@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-08 21:22:35 +0000
committergangji@google.com <gangji@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-08 21:22:35 +0000
commit4f16c832c1aff0caf218efd4ceb15a60e018d02a (patch)
tree380d896ef2b496fbd03f95904eb093ccd2284087 /o3d
parentd44992ced69fdd2e88502aea04fd8e312366e268 (diff)
downloadchromium_src-4f16c832c1aff0caf218efd4ceb15a60e018d02a.zip
chromium_src-4f16c832c1aff0caf218efd4ceb15a60e018d02a.tar.gz
chromium_src-4f16c832c1aff0caf218efd4ceb15a60e018d02a.tar.bz2
Fixing random resizing issues under Windows. When resizing under Windows,
sometimes, the windows is not updated when creating the surface. Now update the clip region and surface parameters when this happens. Review URL: http://codereview.chromium.org/6626080 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77334 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r--o3d/build/libs.gyp1
-rw-r--r--o3d/core/cross/cairo/renderer_cairo.cc47
2 files changed, 27 insertions, 21 deletions
diff --git a/o3d/build/libs.gyp b/o3d/build/libs.gyp
index f398bd7..0386e9f 100644
--- a/o3d/build/libs.gyp
+++ b/o3d/build/libs.gyp
@@ -76,6 +76,7 @@
],
'include_dirs': [
'../../<(cairodir)/src',
+ '../../<(pixmandir)/pixman',
'../build/misc',
],
},
diff --git a/o3d/core/cross/cairo/renderer_cairo.cc b/o3d/core/cross/cairo/renderer_cairo.cc
index 22301d06..ba88cd4 100644
--- a/o3d/core/cross/cairo/renderer_cairo.cc
+++ b/o3d/core/cross/cairo/renderer_cairo.cc
@@ -38,6 +38,7 @@
#elif defined(OS_MACOSX)
#include <cairo-quartz.h>
#elif defined(OS_WIN)
+#include <cairo-win32-private.h>
#include <cairo-win32.h>
#endif
@@ -274,30 +275,34 @@ void RendererCairo::CreateCairoSurface() {
display_height());
#elif defined(OS_WIN)
HDC hdc = GetDC(hwnd_);
- if (display_width() > 0 && display_height() > 0) {
- RECT rect;
- GetClipBox(hdc, &rect);
- if (rect.right - rect.left != display_width() ||
- rect.bottom - rect.top != display_height()) {
- // The hdc doesn't have the right clip box.
- // Need to reset the clip box on hdc.
- DLOG(WARNING) << "CreateCairoSurface clip box (" << rect.left << ","
- << rect.top << "," << rect.right << "," << rect.bottom
- << ") doesn't match the image size " << display_width()
- << "x" << display_height();
- HRGN hRegion = CreateRectRgn(0, 0, display_width(), display_height());
- int result = SelectClipRgn(hdc, hRegion);
- if (result == ERROR) {
- LOG(ERROR) << "CreateCairoSurface SelectClipRgn returns ERROR";
- } else if (result == NULLREGION) {
- // This should not happen since the ShowWindow is called.
- LOG(ERROR) << "CreateCairoSurface SelectClipRgn returns NULLREGION";
- }
- DeleteObject(hRegion);
+
+ main_surface_ = cairo_win32_surface_create(hdc);
+
+ // Check the surface to make sure it has the correct clip box.
+ cairo_win32_surface_t* cairo_surface =
+ reinterpret_cast<cairo_win32_surface_t*>(main_surface_);
+ if (cairo_surface->extents.width != display_width() ||
+ cairo_surface->extents.height != display_height()) {
+ // The clip box doesn't have the right info. Need to do the following:
+ // 1. Update the surface parameters to the right rectangle.
+ // 2. Try to update the DC clip region.
+ DLOG(WARNING) << "CreateCairoSurface updates clip box from (0,0,"
+ << cairo_surface->extents.width << ","
+ << cairo_surface->extents.height << ") to (0,0,"
+ << display_width() << "," << display_height() << ").";
+ HRGN hRegion = CreateRectRgn(0, 0, display_width(), display_height());
+ int result = SelectClipRgn(hdc, hRegion);
+ if (result == ERROR) {
+ LOG(ERROR) << "CreateCairoSurface SelectClipRgn returns ERROR";
+ } else if (result == NULLREGION) {
+ // This should not happen since the ShowWindow is called.
+ LOG(ERROR) << "CreateCairoSurface SelectClipRgn returns NULLREGION";
}
+ DeleteObject(hRegion);
+ cairo_surface->extents.width = display_width();
+ cairo_surface->extents.height = display_height();
}
- main_surface_ = cairo_win32_surface_create(hdc);
ReleaseDC(hwnd_, hdc);
#endif
}