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 "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 // just because no alignment flag was passed to DrawStringInt(). | 225 // just because no alignment flag was passed to DrawStringInt(). |
226 if (!(flags & (TEXT_ALIGN_CENTER | TEXT_ALIGN_RIGHT | TEXT_ALIGN_LEFT))) { | 226 if (!(flags & (TEXT_ALIGN_CENTER | TEXT_ALIGN_RIGHT | TEXT_ALIGN_LEFT))) { |
227 flags |= l10n_util::DefaultCanvasTextAlignment(); | 227 flags |= l10n_util::DefaultCanvasTextAlignment(); |
228 } | 228 } |
229 | 229 |
230 if (flags & HIDE_PREFIX) | 230 if (flags & HIDE_PREFIX) |
231 f |= DT_HIDEPREFIX; | 231 f |= DT_HIDEPREFIX; |
232 else if ((flags & SHOW_PREFIX) == 0) | 232 else if ((flags & SHOW_PREFIX) == 0) |
233 f |= DT_NOPREFIX; | 233 f |= DT_NOPREFIX; |
234 | 234 |
235 if (flags & MULTI_LINE) | 235 if (flags & MULTI_LINE) { |
236 f |= DT_WORDBREAK; | 236 f |= DT_WORDBREAK; |
237 else | 237 } else { |
238 f |= DT_SINGLELINE | DT_END_ELLIPSIS | DT_VCENTER; | 238 f |= DT_SINGLELINE | DT_VCENTER; |
| 239 if (!(flags & NO_ELLIPSIS)) |
| 240 f |= DT_END_ELLIPSIS; |
| 241 } |
239 | 242 |
240 // vertical alignment | 243 // vertical alignment |
241 if (flags & TEXT_VALIGN_TOP) | 244 if (flags & TEXT_VALIGN_TOP) |
242 f |= DT_TOP; | 245 f |= DT_TOP; |
243 else if (flags & TEXT_VALIGN_BOTTOM) | 246 else if (flags & TEXT_VALIGN_BOTTOM) |
244 f |= DT_BOTTOM; | 247 f |= DT_BOTTOM; |
245 else | 248 else |
246 f |= DT_VCENTER; | 249 f |= DT_VCENTER; |
247 | 250 |
248 // horizontal alignment | 251 // horizontal alignment |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 const SkBitmap& device_bitmap = getDevice()->accessBitmap(false); | 385 const SkBitmap& device_bitmap = getDevice()->accessBitmap(false); |
383 | 386 |
384 // Make a bitmap to return, and a canvas to draw into it. We don't just want | 387 // Make a bitmap to return, and a canvas to draw into it. We don't just want |
385 // to call extractSubset or the copy constuctor, since we want an actual copy | 388 // to call extractSubset or the copy constuctor, since we want an actual copy |
386 // of the bitmap. | 389 // of the bitmap. |
387 SkBitmap result; | 390 SkBitmap result; |
388 device_bitmap.copyTo(&result, SkBitmap::kARGB_8888_Config); | 391 device_bitmap.copyTo(&result, SkBitmap::kARGB_8888_Config); |
389 return result; | 392 return result; |
390 } | 393 } |
391 | 394 |
OLD | NEW |