Chromium Code Reviews| 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); |