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

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: Accidentally pulled in some extra changes in common.gypi Created 9 years, 4 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 #if defined(USE_WAYLAND)
173 PangoFontMap* font_map = pango_cairo_font_map_get_default();
174 PangoContext* default_context = pango_font_map_create_context(font_map);
175 #else
172 PangoContext* default_context = gdk_pango_context_get(); 176 PangoContext* default_context = gdk_pango_context_get();
177 #endif
173 resolution = pango_cairo_context_get_resolution(default_context); 178 resolution = pango_cairo_context_get_resolution(default_context);
174 g_object_unref(default_context); 179 g_object_unref(default_context);
175 } 180 }
176 return resolution; 181 return resolution;
177 } 182 }
178 183
179 GdkCursor* GetCursor(int type) { 184 GdkCursor* GetCursor(int type) {
180 static GdkCursorCache impl; 185 static GdkCursorCache impl;
181 return impl.GetCursorImpl(static_cast<GdkCursorType>(type)); 186 return impl.GetCursorImpl(static_cast<GdkCursorType>(type));
182 } 187 }
(...skipping 20 matching lines...) Expand all
203 new_pixels[idx + 1] = pixels[idx + 1]; 208 new_pixels[idx + 1] = pixels[idx + 1];
204 new_pixels[idx + 2] = pixels[idx]; 209 new_pixels[idx + 2] = pixels[idx];
205 new_pixels[idx + 3] = pixels[idx + 3]; 210 new_pixels[idx + 3] = pixels[idx + 3];
206 } 211 }
207 } 212 }
208 213
209 return new_pixels; 214 return new_pixels;
210 } 215 }
211 216
212 } // namespace gfx 217 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698