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

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

Issue 7467007: Adding Wayland support for ui/gfx (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Replaced the way WaylandDisplay is being retrieved Created 9 years, 5 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
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/gtk_util.h" 5 #include "ui/gfx/gtk_util.h"
6 6
7 #include <gdk/gdk.h> 7 #include <gdk/gdk.h>
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 10
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // TODO(deanm): It would be nice to be able to reuse the GdkRegion here. 162 // TODO(deanm): It would be nice to be able to reuse the GdkRegion here.
163 gdk_region_destroy(rect_region); 163 gdk_region_destroy(rect_region);
164 } 164 }
165 } 165 }
166 166
167 double GetPangoResolution() { 167 double GetPangoResolution() {
168 static double resolution; 168 static double resolution;
169 static bool determined_resolution = false; 169 static bool determined_resolution = false;
170 if (!determined_resolution) { 170 if (!determined_resolution) {
171 determined_resolution = true; 171 determined_resolution = true;
172 PangoContext* default_context = gdk_pango_context_get(); 172 PangoFontMap* font_map = pango_cairo_font_map_get_default();
173 PangoContext* default_context = pango_font_map_create_context(font_map);
jonathan.backer 2011/07/26 14:56:27 why is this necessary?
173 resolution = pango_cairo_context_get_resolution(default_context); 174 resolution = pango_cairo_context_get_resolution(default_context);
174 g_object_unref(default_context); 175 g_object_unref(default_context);
175 } 176 }
176 return resolution; 177 return resolution;
177 } 178 }
178 179
179 GdkCursor* GetCursor(int type) { 180 GdkCursor* GetCursor(int type) {
180 static GdkCursorCache impl; 181 static GdkCursorCache impl;
181 return impl.GetCursorImpl(static_cast<GdkCursorType>(type)); 182 return impl.GetCursorImpl(static_cast<GdkCursorType>(type));
182 } 183 }
(...skipping 20 matching lines...) Expand all
203 new_pixels[idx + 1] = pixels[idx + 1]; 204 new_pixels[idx + 1] = pixels[idx + 1];
204 new_pixels[idx + 2] = pixels[idx]; 205 new_pixels[idx + 2] = pixels[idx];
205 new_pixels[idx + 3] = pixels[idx + 3]; 206 new_pixels[idx + 3] = pixels[idx + 3];
206 } 207 }
207 } 208 }
208 209
209 return new_pixels; 210 return new_pixels;
210 } 211 }
211 212
212 } // namespace gfx 213 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698