OLD | NEW |
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/gfx/gdi_util.h" | 5 #include "ui/gfx/gdi_util.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 | 9 |
10 namespace gfx { | 10 namespace gfx { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 } | 78 } |
79 } | 79 } |
80 | 80 |
81 HRGN ConvertPathToHRGN(const gfx::Path& path) { | 81 HRGN ConvertPathToHRGN(const gfx::Path& path) { |
82 #if defined(USE_AURA) | 82 #if defined(USE_AURA) |
83 int point_count = path.getPoints(NULL, 0); | 83 int point_count = path.getPoints(NULL, 0); |
84 scoped_ptr<SkPoint[]> points(new SkPoint[point_count]); | 84 scoped_ptr<SkPoint[]> points(new SkPoint[point_count]); |
85 path.getPoints(points.get(), point_count); | 85 path.getPoints(points.get(), point_count); |
86 scoped_ptr<POINT[]> windows_points(new POINT[point_count]); | 86 scoped_ptr<POINT[]> windows_points(new POINT[point_count]); |
87 for (int i = 0; i < point_count; ++i) { | 87 for (int i = 0; i < point_count; ++i) { |
88 windows_points[i].x = SkScalarRound(points[i].fX); | 88 windows_points[i].x = SkScalarRoundToInt(points[i].fX); |
89 windows_points[i].y = SkScalarRound(points[i].fY); | 89 windows_points[i].y = SkScalarRoundToInt(points[i].fY); |
90 } | 90 } |
91 | 91 |
92 return ::CreatePolygonRgn(windows_points.get(), point_count, ALTERNATE); | 92 return ::CreatePolygonRgn(windows_points.get(), point_count, ALTERNATE); |
93 #elif defined(OS_WIN) | 93 #elif defined(OS_WIN) |
94 return path.CreateNativeRegion(); | 94 return path.CreateNativeRegion(); |
95 #endif | 95 #endif |
96 } | 96 } |
97 | 97 |
98 | 98 |
99 double CalculatePageScale(HDC dc, int page_width, int page_height) { | 99 double CalculatePageScale(HDC dc, int page_width, int page_height) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 } else { | 136 } else { |
137 rv = ::StretchDIBits(hdc, | 137 rv = ::StretchDIBits(hdc, |
138 dest_x, dest_y, dest_w, dest_h, | 138 dest_x, dest_y, dest_w, dest_h, |
139 src_x, bottom_up_src_y, src_w, src_h, | 139 src_x, bottom_up_src_y, src_w, src_h, |
140 pixels, bitmap_info, DIB_RGB_COLORS, SRCCOPY); | 140 pixels, bitmap_info, DIB_RGB_COLORS, SRCCOPY); |
141 } | 141 } |
142 DCHECK(rv != GDI_ERROR); | 142 DCHECK(rv != GDI_ERROR); |
143 } | 143 } |
144 | 144 |
145 } // namespace gfx | 145 } // namespace gfx |
OLD | NEW |