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

Side by Side Diff: ui/gfx/path_gtk.cc

Issue 122443005: replace deprecated SkScalarRound/Floor/Ceil calls with more explicit variants (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gfx/gdi_util.cc ('k') | ui/gfx/path_win.cc » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/path.h" 5 #include "ui/gfx/path.h"
6 6
7 #include <gdk/gdk.h> 7 #include <gdk/gdk.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 11
12 namespace gfx { 12 namespace gfx {
13 13
14 GdkRegion* Path::CreateNativeRegion() const { 14 GdkRegion* Path::CreateNativeRegion() const {
15 int point_count = getPoints(NULL, 0); 15 int point_count = getPoints(NULL, 0);
16 if (point_count <= 1) { 16 if (point_count <= 1) {
17 // NOTE: ideally this would return gdk_empty_region, but that returns a 17 // NOTE: ideally this would return gdk_empty_region, but that returns a
18 // region with nothing in it. 18 // region with nothing in it.
19 return NULL; 19 return NULL;
20 } 20 }
21 21
22 scoped_ptr<SkPoint[]> points(new SkPoint[point_count]); 22 scoped_ptr<SkPoint[]> points(new SkPoint[point_count]);
23 getPoints(points.get(), point_count); 23 getPoints(points.get(), point_count);
24 24
25 scoped_ptr<GdkPoint[]> gdk_points(new GdkPoint[point_count]); 25 scoped_ptr<GdkPoint[]> gdk_points(new GdkPoint[point_count]);
26 for (int i = 0; i < point_count; ++i) { 26 for (int i = 0; i < point_count; ++i) {
27 gdk_points[i].x = SkScalarRound(points[i].fX); 27 gdk_points[i].x = SkScalarRoundToInt(points[i].fX);
28 gdk_points[i].y = SkScalarRound(points[i].fY); 28 gdk_points[i].y = SkScalarRoundToInt(points[i].fY);
29 } 29 }
30 30
31 return gdk_region_polygon(gdk_points.get(), point_count, GDK_EVEN_ODD_RULE); 31 return gdk_region_polygon(gdk_points.get(), point_count, GDK_EVEN_ODD_RULE);
32 } 32 }
33 33
34 // static 34 // static
35 NativeRegion Path::IntersectRegions(NativeRegion r1, NativeRegion r2) { 35 NativeRegion Path::IntersectRegions(NativeRegion r1, NativeRegion r2) {
36 GdkRegion* copy = gdk_region_copy(r1); 36 GdkRegion* copy = gdk_region_copy(r1);
37 gdk_region_intersect(copy, r2); 37 gdk_region_intersect(copy, r2);
38 return copy; 38 return copy;
39 } 39 }
40 40
41 // static 41 // static
42 NativeRegion Path::CombineRegions(NativeRegion r1, NativeRegion r2) { 42 NativeRegion Path::CombineRegions(NativeRegion r1, NativeRegion r2) {
43 GdkRegion* copy = gdk_region_copy(r1); 43 GdkRegion* copy = gdk_region_copy(r1);
44 gdk_region_union(copy, r2); 44 gdk_region_union(copy, r2);
45 return copy; 45 return copy;
46 } 46 }
47 47
48 // static 48 // static
49 NativeRegion Path::SubtractRegion(NativeRegion r1, NativeRegion r2) { 49 NativeRegion Path::SubtractRegion(NativeRegion r1, NativeRegion r2) {
50 GdkRegion* copy = gdk_region_copy(r1); 50 GdkRegion* copy = gdk_region_copy(r1);
51 gdk_region_subtract(copy, r2); 51 gdk_region_subtract(copy, r2);
52 return copy; 52 return copy;
53 } 53 }
54 54
55 } // namespace gfx 55 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/gdi_util.cc ('k') | ui/gfx/path_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698