OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/render_text.h" | 5 #include "ui/gfx/render_text.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/i18n/break_iterator.h" | 9 #include "base/i18n/break_iterator.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 bounds.set_width(font.GetStringWidth(text)); | 345 bounds.set_width(font.GetStringWidth(text)); |
346 canvas->DrawStringInt(text, font, i->foreground, bounds); | 346 canvas->DrawStringInt(text, font, i->foreground, bounds); |
347 | 347 |
348 // Draw the strikethrough. | 348 // Draw the strikethrough. |
349 if (i->strike) { | 349 if (i->strike) { |
350 SkPaint paint; | 350 SkPaint paint; |
351 paint.setAntiAlias(true); | 351 paint.setAntiAlias(true); |
352 paint.setStyle(SkPaint::kFill_Style); | 352 paint.setStyle(SkPaint::kFill_Style); |
353 paint.setColor(i->foreground); | 353 paint.setColor(i->foreground); |
354 paint.setStrokeWidth(kStrikeWidth); | 354 paint.setStrokeWidth(kStrikeWidth); |
355 canvas->AsCanvasSkia()->drawLine(SkIntToScalar(bounds.x()), | 355 canvas->GetSkCanvas()->drawLine(SkIntToScalar(bounds.x()), |
356 SkIntToScalar(bounds.bottom()), | 356 SkIntToScalar(bounds.bottom()), |
357 SkIntToScalar(bounds.right()), | 357 SkIntToScalar(bounds.right()), |
358 SkIntToScalar(bounds.y()), | 358 SkIntToScalar(bounds.y()), |
359 paint); | 359 paint); |
360 } | 360 } |
361 | 361 |
362 bounds.set_x(bounds.x() + bounds.width()); | 362 bounds.set_x(bounds.x() + bounds.width()); |
363 } | 363 } |
364 | 364 |
365 // Paint cursor. Replace cursor is drawn as rectangle for now. | 365 // Paint cursor. Replace cursor is drawn as rectangle for now. |
366 Rect cursor(GetUpdatedCursorBounds()); | 366 Rect cursor(GetUpdatedCursorBounds()); |
367 if (cursor_visible() && focused()) | 367 if (cursor_visible() && focused()) |
368 canvas->DrawRectInt(kCursorColor, cursor.x(), cursor.y(), | 368 canvas->DrawRectInt(kCursorColor, cursor.x(), cursor.y(), |
369 cursor.width(), cursor.height()); | 369 cursor.width(), cursor.height()); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 // LTR character. | 630 // LTR character. |
631 // | 631 // |
632 // Pan to show the cursor when it overflows to the left. | 632 // Pan to show the cursor when it overflows to the left. |
633 delta_offset = display_rect_.x() - cursor_bounds_.x(); | 633 delta_offset = display_rect_.x() - cursor_bounds_.x(); |
634 } | 634 } |
635 display_offset_.Offset(delta_offset, 0); | 635 display_offset_.Offset(delta_offset, 0); |
636 cursor_bounds_.Offset(delta_offset, 0); | 636 cursor_bounds_.Offset(delta_offset, 0); |
637 } | 637 } |
638 | 638 |
639 } // namespace gfx | 639 } // namespace gfx |
OLD | NEW |