diff options
author | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-24 16:51:16 +0000 |
---|---|---|
committer | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-24 16:51:16 +0000 |
commit | de13f35d1ffedf90f791fa5bb127697094771c2c (patch) | |
tree | fac7173e5bcc6d5f8988043d657f012d45c68e81 /ui/gfx/canvas_skia.cc | |
parent | e3301c30d83b7b9c895fba14d1f78491906c86b7 (diff) | |
download | chromium_src-de13f35d1ffedf90f791fa5bb127697094771c2c.zip chromium_src-de13f35d1ffedf90f791fa5bb127697094771c2c.tar.gz chromium_src-de13f35d1ffedf90f791fa5bb127697094771c2c.tar.bz2 |
Cleanup gfx::Canvas now that 10562027 has landed
Bug=None
Test=Compiles on Mac and CrOS
R=oshima,sky
TBR=sadrul,sail
Review URL: https://chromiumcodereview.appspot.com/10701063
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148123 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/canvas_skia.cc')
-rw-r--r-- | ui/gfx/canvas_skia.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/ui/gfx/canvas_skia.cc b/ui/gfx/canvas_skia.cc index 918842b..4a6ef61 100644 --- a/ui/gfx/canvas_skia.cc +++ b/ui/gfx/canvas_skia.cc @@ -377,7 +377,7 @@ void Canvas::DrawStringWithHalo(const string16& text, // Create a temporary buffer filled with the halo color. It must leave room // for the 1-pixel border around the text. Size size(w + 2, h + 2); - Canvas text_canvas(size, true); + Canvas text_canvas(size, scale_factor(), true); SkPaint bkgnd_paint; bkgnd_paint.setColor(halo_color); text_canvas.DrawRect(gfx::Rect(size), bkgnd_paint); @@ -390,9 +390,9 @@ void Canvas::DrawStringWithHalo(const string16& text, SkBitmap& text_bitmap = const_cast<SkBitmap&>( skia::GetTopDevice(*text_canvas.sk_canvas())->accessBitmap(true)); - for (int cur_y = 0; cur_y < h + 2; cur_y++) { + for (int cur_y = 0; cur_y < text_bitmap.height(); cur_y++) { uint32_t* text_row = text_bitmap.getAddr32(0, cur_y); - for (int cur_x = 0; cur_x < w + 2; cur_x++) { + for (int cur_x = 0; cur_x < text_bitmap.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). @@ -405,7 +405,9 @@ void Canvas::DrawStringWithHalo(const string16& text, } // Draw the halo bitmap with blur. - DrawImageInt(text_bitmap, x - 1, y - 1); + gfx::ImageSkia text_image = gfx::ImageSkia(gfx::ImageSkiaRep(text_bitmap, + text_canvas.scale_factor())); + DrawImageInt(text_image, x - 1, y - 1); } void Canvas::DrawFadeTruncatingString( |