| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/gfx/canvas.h" | 5 #include "ui/gfx/canvas.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ui/base/range/range.h" | 10 #include "ui/base/range/range.h" |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 } else { | 392 } else { |
| 393 text_row[cur_x] |= 0xff << SK_A32_SHIFT; // Make opaque. | 393 text_row[cur_x] |= 0xff << SK_A32_SHIFT; // Make opaque. |
| 394 } | 394 } |
| 395 } | 395 } |
| 396 } | 396 } |
| 397 | 397 |
| 398 // Draw the halo bitmap with blur. | 398 // Draw the halo bitmap with blur. |
| 399 DrawImageInt(text_bitmap, x - 1, y - 1); | 399 DrawImageInt(text_bitmap, x - 1, y - 1); |
| 400 } | 400 } |
| 401 | 401 |
| 402 // TODO(asvitkine): Remove the ifdef once all platforms use canvas_skia.cc. | |
| 403 #if defined(OS_WIN) | |
| 404 void Canvas::DrawFadeTruncatingString( | 402 void Canvas::DrawFadeTruncatingString( |
| 405 const string16& text, | 403 const string16& text, |
| 406 TruncateFadeMode truncate_mode, | 404 TruncateFadeMode truncate_mode, |
| 407 size_t desired_characters_to_truncate_from_head, | 405 size_t desired_characters_to_truncate_from_head, |
| 408 const gfx::Font& font, | 406 const gfx::Font& font, |
| 409 SkColor color, | 407 SkColor color, |
| 410 const gfx::Rect& display_rect) { | 408 const gfx::Rect& display_rect) { |
| 411 int flags = NO_ELLIPSIS; | 409 int flags = NO_ELLIPSIS; |
| 412 | 410 |
| 413 // If the whole string fits in the destination then just draw it directly. | 411 // If the whole string fits in the destination then just draw it directly. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 const int line_height = render_text->GetStringSize().height(); | 458 const int line_height = render_text->GetStringSize().height(); |
| 461 rect.Offset(0, VAlignText(line_height, flags, display_rect.height())); | 459 rect.Offset(0, VAlignText(line_height, flags, display_rect.height())); |
| 462 rect.set_height(line_height); | 460 rect.set_height(line_height); |
| 463 render_text->SetDisplayRect(rect); | 461 render_text->SetDisplayRect(rect); |
| 464 | 462 |
| 465 canvas_->save(SkCanvas::kClip_SaveFlag); | 463 canvas_->save(SkCanvas::kClip_SaveFlag); |
| 466 ClipRect(display_rect); | 464 ClipRect(display_rect); |
| 467 render_text->Draw(this); | 465 render_text->Draw(this); |
| 468 canvas_->restore(); | 466 canvas_->restore(); |
| 469 } | 467 } |
| 470 #endif | |
| 471 | 468 |
| 472 } // namespace gfx | 469 } // namespace gfx |
| OLD | NEW |