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

Side by Side Diff: gfx/canvas_linux.cc

Issue 1589021: Status area improvements:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "gfx/canvas.h" 5 #include "gfx/canvas.h"
6 6
7 #include <cairo/cairo.h> 7 #include <cairo/cairo.h>
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #include <pango/pango.h> 9 #include <pango/pango.h>
10 #include <pango/pangocairo.h> 10 #include <pango/pangocairo.h>
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 return; 211 return;
212 212
213 cairo_t* cr = beginPlatformPaint(); 213 cairo_t* cr = beginPlatformPaint();
214 PangoLayout* layout = pango_cairo_create_layout(cr); 214 PangoLayout* layout = pango_cairo_create_layout(cr);
215 215
216 SetupPangoLayout(layout, text, font, w, flags); 216 SetupPangoLayout(layout, text, font, w, flags);
217 217
218 pango_layout_set_height(layout, h * PANGO_SCALE); 218 pango_layout_set_height(layout, h * PANGO_SCALE);
219 219
220 cairo_save(cr); 220 cairo_save(cr);
221 cairo_set_source_rgb(cr, 221 cairo_set_source_rgba(cr,
222 SkColorGetR(color) / 255.0, 222 SkColorGetR(color) / 255.0,
223 SkColorGetG(color) / 255.0, 223 SkColorGetG(color) / 255.0,
224 SkColorGetB(color) / 255.0); 224 SkColorGetB(color) / 255.0,
225 SkColorGetA(color) / 255.0);
225 226
226 int width, height; 227 int width, height;
227 pango_layout_get_pixel_size(layout, &width, &height); 228 pango_layout_get_pixel_size(layout, &width, &height);
228 229
229 cairo_rectangle(cr, x, y, w, h); 230 cairo_rectangle(cr, x, y, w, h);
230 cairo_clip(cr); 231 cairo_clip(cr);
231 232
232 if (flags & Canvas::TEXT_VALIGN_TOP) { 233 if (flags & Canvas::TEXT_VALIGN_TOP) {
233 // Cairo should draw from the top left corner already. 234 // Cairo should draw from the top left corner already.
234 } else if (flags & Canvas::TEXT_VALIGN_BOTTOM) { 235 } else if (flags & Canvas::TEXT_VALIGN_BOTTOM) {
(...skipping 24 matching lines...) Expand all
259 NOTREACHED(); 260 NOTREACHED();
260 return; 261 return;
261 } 262 }
262 263
263 cairo_t* cr = beginPlatformPaint(); 264 cairo_t* cr = beginPlatformPaint();
264 gdk_cairo_set_source_pixbuf(cr, pixbuf, x, y); 265 gdk_cairo_set_source_pixbuf(cr, pixbuf, x, y);
265 cairo_paint(cr); 266 cairo_paint(cr);
266 } 267 }
267 268
268 } // namespace gfx 269 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698