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

Unified Diff: ui/gfx/canvas_skia_win.cc

Issue 6823020: Fix crash in fade tab title change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/canvas_skia_win.cc
===================================================================
--- ui/gfx/canvas_skia_win.cc (revision 80891)
+++ ui/gfx/canvas_skia_win.cc (working copy)
@@ -469,9 +469,19 @@
int total_string_height;
SizeStringInt(text, font, &total_string_width, &total_string_height,
flags | TEXT_VALIGN_TOP);
- if (total_string_width <= display_rect.width()) {
+ bool should_draw_directly = total_string_width <= display_rect.width();
+
+ // Create a temporary bitmap to draw the gradient to.
Peter Kasting 2011/04/09 00:56:44 If this is really just a temporary hack, you shoul
+ scoped_ptr<skia::BitmapPlatformDevice> gradient_bitmap;
+ if (!should_draw_directly) {
+ gradient_bitmap.reset(skia::BitmapPlatformDevice::create(
+ NULL, display_rect.width(), display_rect.height(), false, NULL));
+ should_draw_directly = gradient_bitmap.get() != NULL;
+ }
+
+ if (should_draw_directly) {
DrawStringInt(text, font, color, display_rect.x(), display_rect.y(),
- display_rect.width(), display_rect.height(), flags);
+ display_rect.width(), display_rect.height(), 0);
return;
}
@@ -556,9 +566,6 @@
HFONT gray_scale_font = CreateFontIndirect(&font_info);
HDC hdc = beginPlatformPaint();
- scoped_ptr<skia::BitmapPlatformDevice> gradient_bitmap(
- skia::BitmapPlatformDevice::create(NULL, display_rect.width(),
- display_rect.height(), false, NULL));
if (is_truncating_head)
DrawTextGradientPart(hdc, *gradient_bitmap, text, color, gray_scale_font,
text_rect, head_part, is_rtl, flags);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698