diff options
author | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-18 17:11:55 +0000 |
---|---|---|
committer | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-18 17:11:55 +0000 |
commit | 82d74e9fa0d494c033b5801e72df15a41077db6e (patch) | |
tree | 4a06ca0f04f1712b0f4bb449a5374c054a3b0add /ui/gfx/gdi_util.cc | |
parent | d911354e05fb4353c722511da27d09e133efd70e (diff) | |
download | chromium_src-82d74e9fa0d494c033b5801e72df15a41077db6e.zip chromium_src-82d74e9fa0d494c033b5801e72df15a41077db6e.tar.gz chromium_src-82d74e9fa0d494c033b5801e72df15a41077db6e.tar.bz2 |
basic nc paint, moving, resizing for views_examples_exe on win non-aero
Pull over some code from native_widget_win to get aura drawing a bit better on Windows. There's still lots of things not working, but the sizing and painting work better now.
Review URL: https://chromiumcodereview.appspot.com/10662037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147255 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/gdi_util.cc')
-rw-r--r-- | ui/gfx/gdi_util.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/ui/gfx/gdi_util.cc b/ui/gfx/gdi_util.cc index 5ba5d72..f548628 100644 --- a/ui/gfx/gdi_util.cc +++ b/ui/gfx/gdi_util.cc @@ -4,6 +4,8 @@ #include "ui/gfx/gdi_util.h" +#include "base/memory/scoped_ptr.h" + namespace gfx { void CreateBitmapHeader(int width, int height, BITMAPINFOHEADER* hdr) { @@ -76,6 +78,24 @@ void SubtractRectanglesFromRegion(HRGN hrgn, } } +HRGN ConvertPathToHRGN(const gfx::Path& path) { +#if defined(USE_AURA) + int point_count = path.getPoints(NULL, 0); + scoped_array<SkPoint> points(new SkPoint[point_count]); + path.getPoints(points.get(), point_count); + scoped_array<POINT> windows_points(new POINT[point_count]); + for (int i = 0; i < point_count; ++i) { + windows_points[i].x = SkScalarRound(points[i].fX); + windows_points[i].y = SkScalarRound(points[i].fY); + } + + return ::CreatePolygonRgn(windows_points.get(), point_count, ALTERNATE); +#elif defined(OS_WIN) + return path.CreateNativeRegion(); +#endif +} + + double CalculatePageScale(HDC dc, int page_width, int page_height) { int dc_width = GetDeviceCaps(dc, HORZRES); int dc_height = GetDeviceCaps(dc, VERTRES); |