| Index: ui/gfx/canvas_skia.cc
|
| diff --git a/ui/gfx/canvas_skia.cc b/ui/gfx/canvas_skia.cc
|
| index 8f45fce059c5427ad3add234d40548b11b8b3547..9023f821a00e520b75a02f7d8c93ac697ba62963 100644
|
| --- a/ui/gfx/canvas_skia.cc
|
| +++ b/ui/gfx/canvas_skia.cc
|
| @@ -200,6 +200,7 @@ void Canvas::DrawStringRectWithShadows(const base::string16& text,
|
|
|
| scoped_ptr<RenderText> render_text(RenderText::CreateInstance());
|
| render_text->set_shadows(shadows);
|
| + render_text->set_halo_effect(!!(flags & HALO_EFFECT));
|
|
|
| if (flags & MULTI_LINE) {
|
| WordWrapBehavior wrap_behavior = IGNORE_LONG_WORDS;
|
| @@ -283,45 +284,12 @@ void Canvas::DrawStringRectWithHalo(const base::string16& text,
|
| // (since the resulting image can have 1-bit transparency only).
|
| SkColor halo_color = SkColorSetA(halo_color_in, 0xFF);
|
|
|
| - // Create a temporary buffer filled with the halo color. It must leave room
|
| - // for the 1-pixel border around the text.
|
| - Size size(display_rect.width() + 2, display_rect.height() + 2);
|
| - Canvas text_canvas(size, image_scale(), false);
|
| - SkPaint bkgnd_paint;
|
| - bkgnd_paint.setColor(halo_color);
|
| - text_canvas.DrawRect(Rect(size), bkgnd_paint);
|
| -
|
| - // Draw the text into the temporary buffer. This will have correct
|
| - // ClearType since the background color is the same as the halo color.
|
| - text_canvas.DrawStringRectWithFlags(
|
| - text, font_list, text_color,
|
| - Rect(1, 1, display_rect.width(), display_rect.height()), flags);
|
| -
|
| - uint32_t halo_premul = SkPreMultiplyColor(halo_color);
|
| - SkPixmap pixmap;
|
| - skia::GetWritablePixels(text_canvas.sk_canvas(), &pixmap);
|
| -
|
| - for (int cur_y = 0; cur_y < pixmap.height(); cur_y++) {
|
| - uint32_t* text_row = pixmap.writable_addr32(0, cur_y);
|
| - for (int cur_x = 0; cur_x < pixmap.width(); cur_x++) {
|
| - if (text_row[cur_x] == halo_premul) {
|
| - // This pixel was not touched by the text routines. See if it borders
|
| - // a touched pixel in any of the 4 directions (not diagonally).
|
| - if (!PixelShouldGetHalo(pixmap, cur_x, cur_y, halo_premul))
|
| - text_row[cur_x] = 0; // Make transparent.
|
| - } else {
|
| - text_row[cur_x] |= 0xff << SK_A32_SHIFT; // Make opaque.
|
| - }
|
| - }
|
| - }
|
| -
|
| - // Draw the halo bitmap with blur.
|
| - SkBitmap bitmap;
|
| - bitmap.installPixels(pixmap.info(), pixmap.writable_addr(),
|
| - pixmap.rowBytes());
|
| - ImageSkia text_image = ImageSkia(ImageSkiaRep(bitmap,
|
| - text_canvas.image_scale()));
|
| - DrawImageInt(text_image, display_rect.x() - 1, display_rect.y() - 1);
|
| + // Draw the halo.
|
| + DrawStringRectWithFlags(text, font_list, halo_color, display_rect,
|
| + flags | HALO_EFFECT | NO_SUBPIXEL_RENDERING);
|
| + // Draw the text.
|
| + DrawStringRectWithFlags(text, font_list, text_color, display_rect,
|
| + flags | NO_SUBPIXEL_RENDERING);
|
| }
|
|
|
| void Canvas::DrawFadedString(const base::string16& text,
|
|
|