OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/common/gfx/chrome_canvas.h" | 5 #include "chrome/common/gfx/chrome_canvas.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/gfx/rect.h" | 9 #include "base/gfx/rect.h" |
10 #include "skia/include/SkShader.h" | 10 #include "skia/include/SkShader.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 flags |= l10n_util::DefaultCanvasTextAlignment(); | 47 flags |= l10n_util::DefaultCanvasTextAlignment(); |
48 } | 48 } |
49 | 49 |
50 if (flags & ChromeCanvas::HIDE_PREFIX) | 50 if (flags & ChromeCanvas::HIDE_PREFIX) |
51 f |= DT_HIDEPREFIX; | 51 f |= DT_HIDEPREFIX; |
52 else if ((flags & ChromeCanvas::SHOW_PREFIX) == 0) | 52 else if ((flags & ChromeCanvas::SHOW_PREFIX) == 0) |
53 f |= DT_NOPREFIX; | 53 f |= DT_NOPREFIX; |
54 | 54 |
55 if (flags & ChromeCanvas::MULTI_LINE) { | 55 if (flags & ChromeCanvas::MULTI_LINE) { |
56 f |= DT_WORDBREAK; | 56 f |= DT_WORDBREAK; |
| 57 if (flags & ChromeCanvas::CHARACTER_BREAK) |
| 58 f |= DT_EDITCONTROL; |
57 } else { | 59 } else { |
58 f |= DT_SINGLELINE | DT_VCENTER; | 60 f |= DT_SINGLELINE | DT_VCENTER; |
59 if (!(flags & ChromeCanvas::NO_ELLIPSIS)) | 61 if (!(flags & ChromeCanvas::NO_ELLIPSIS)) |
60 f |= DT_END_ELLIPSIS; | 62 f |= DT_END_ELLIPSIS; |
61 } | 63 } |
62 | 64 |
63 // vertical alignment | 65 // vertical alignment |
64 if (flags & ChromeCanvas::TEXT_VALIGN_TOP) | 66 if (flags & ChromeCanvas::TEXT_VALIGN_TOP) |
65 f |= DT_TOP; | 67 f |= DT_TOP; |
66 else if (flags & ChromeCanvas::TEXT_VALIGN_BOTTOM) | 68 else if (flags & ChromeCanvas::TEXT_VALIGN_BOTTOM) |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 text_row[cur_x] = 0; // Make transparent. | 255 text_row[cur_x] = 0; // Make transparent. |
254 } else { | 256 } else { |
255 text_row[cur_x] |= 0xff << SK_A32_SHIFT; // Make opaque. | 257 text_row[cur_x] |= 0xff << SK_A32_SHIFT; // Make opaque. |
256 } | 258 } |
257 } | 259 } |
258 } | 260 } |
259 | 261 |
260 // Draw the halo bitmap with blur. | 262 // Draw the halo bitmap with blur. |
261 drawBitmap(text_bitmap, SkIntToScalar(x - 1), SkIntToScalar(y - 1)); | 263 drawBitmap(text_bitmap, SkIntToScalar(x - 1), SkIntToScalar(y - 1)); |
262 } | 264 } |
OLD | NEW |