Index: ui/gfx/canvas.h |
diff --git a/ui/gfx/canvas.h b/ui/gfx/canvas.h |
index 8baa45c11e32f7a9b8a167bf5dd9268b7169beb5..7f16a856a1f08f1f0fe38dfc17096c02d61a4a1c 100644 |
--- a/ui/gfx/canvas.h |
+++ b/ui/gfx/canvas.h |
@@ -20,6 +20,7 @@ namespace gfx { |
class Rect; |
class Font; |
+class FontList; |
class Point; |
class Size; |
class Transform; |
@@ -121,19 +122,30 @@ class UI_EXPORT Canvas { |
ui::ScaleFactor scale_factor, |
bool is_opaque); |
- // Compute the size required to draw some text with the provided font. |
+ // Compute the size required to draw some text with the provided fonts. |
// Attempts to fit the text with the provided width and height. Increases |
// height and then width as needed to make the text fit. This method |
// supports multiple lines. On Skia only a line_height can be specified and |
// specifying a 0 value for it will cause the default height to be used. |
static void SizeStringInt(const base::string16& text, |
+ const gfx::FontList& font_list, |
+ int* width, |
+ int* height, |
+ int line_height, |
+ int flags); |
+ // Obsolete version. Use the above version which takes gfx::FontList. |
+ static void SizeStringInt(const base::string16& text, |
const gfx::Font& font, |
- int* width, int* height, |
+ int* width, |
+ int* height, |
int line_height, |
int flags); |
// Returns the number of horizontal pixels needed to display the specified |
- // |text| with |font|. |
+ // |text| with |font_list|. |
+ static int GetStringWidth(const base::string16& text, |
+ const gfx::FontList& font_list); |
+ // Obsolete version. Use the above version which takes gfx::FontList. |
static int GetStringWidth(const base::string16& text, const gfx::Font& font); |
// Returns the default text alignment to be used when drawing text on a |
@@ -146,7 +158,7 @@ class UI_EXPORT Canvas { |
static int DefaultCanvasTextAlignment(); |
// Draws text with a 1-pixel halo around it of the given color. |
- // On Windows, it allows ClearType to be drawn to an otherwise transparenct |
+ // On Windows, it allows ClearType to be drawn to an otherwise transparent |
// bitmap for drag images. Drag images have only 1-bit of transparency, so |
// we don't do any fancy blurring. |
// On Linux, text with halo is created by stroking it with 2px |halo_color| |
@@ -154,11 +166,21 @@ class UI_EXPORT Canvas { |
// On Mac, NOTIMPLEMENTED. |
// TODO(dhollowa): Skia-native implementation is underway. Cut over to |
// that when ready. http::/crbug.com/109946 |
+ void DrawStringWithHaloRect(const base::string16& text, |
+ const gfx::FontList& font_list, |
+ SkColor text_color, |
+ SkColor halo_color, |
+ const gfx::Rect& display_rect, |
+ int flags); |
+ // Obsolete version. Use the above version which takes gfx::FontList. |
void DrawStringWithHalo(const base::string16& text, |
const gfx::Font& font, |
SkColor text_color, |
SkColor halo_color, |
- int x, int y, int w, int h, |
+ int x, |
+ int y, |
+ int w, |
+ int h, |
int flags); |
// Extracts an ImageSkiaRep from the contents of this canvas. |
@@ -267,7 +289,8 @@ class UI_EXPORT Canvas { |
// Parameters are specified relative to current canvas scale not in pixels. |
// Thus, |x| is 2 pixels if canvas scale = 2 & |x| = 1. |
void DrawImageInt(const gfx::ImageSkia& image, |
- int x, int y, |
+ int x, |
+ int y, |
const SkPaint& paint); |
// Draws a portion of an image in the specified location. The src parameters |
@@ -283,12 +306,24 @@ class UI_EXPORT Canvas { |
// Parameters are specified relative to current canvas scale not in pixels. |
// Thus, |x| is 2 pixels if canvas scale = 2 & |x| = 1. |
void DrawImageInt(const gfx::ImageSkia& image, |
- int src_x, int src_y, int src_w, int src_h, |
- int dest_x, int dest_y, int dest_w, int dest_h, |
+ int src_x, |
+ int src_y, |
+ int src_w, |
+ int src_h, |
+ int dest_x, |
+ int dest_y, |
+ int dest_w, |
+ int dest_h, |
bool filter); |
void DrawImageInt(const gfx::ImageSkia& image, |
- int src_x, int src_y, int src_w, int src_h, |
- int dest_x, int dest_y, int dest_w, int dest_h, |
+ int src_x, |
+ int src_y, |
+ int src_w, |
+ int src_h, |
+ int dest_x, |
+ int dest_y, |
+ int dest_w, |
+ int dest_h, |
bool filter, |
const SkPaint& paint); |
@@ -302,30 +337,55 @@ class UI_EXPORT Canvas { |
const SkPath& path, |
const SkPaint& paint); |
- // Draws text with the specified color, font and location. The text is |
+ // Draws text with the specified color, fonts and location. The text is |
// aligned to the left, vertically centered, clipped to the region. If the |
// text is too big, it is truncated and '...' is added to the end. |
+ void DrawStringRect(const base::string16& text, |
+ const gfx::FontList& font_list, |
+ SkColor color, |
+ const gfx::Rect& display_rect); |
+ // Obsolete versions. Use the above versions which take gfx::FontList. |
void DrawStringInt(const base::string16& text, |
const gfx::Font& font, |
SkColor color, |
- int x, int y, int w, int h); |
+ int x, |
+ int y, |
+ int w, |
+ int h); |
void DrawStringInt(const base::string16& text, |
const gfx::Font& font, |
SkColor color, |
const gfx::Rect& display_rect); |
- // Draws text with the specified color, font and location. The last argument |
+ // Draws text with the specified color, fonts and location. The last argument |
// specifies flags for how the text should be rendered. It can be one of |
// TEXT_ALIGN_CENTER, TEXT_ALIGN_RIGHT or TEXT_ALIGN_LEFT. |
+ void DrawStringWithFlagsRect(const base::string16& text, |
Alexei Svitkine (slow)
2013/08/19 14:17:28
Nit: I think DrawStringRectWithFlags() would be cl
Yuki
2013/08/20 15:05:47
Done.
|
+ const gfx::FontList& font_list, |
+ SkColor color, |
+ const gfx::Rect& display_rect, |
+ int flags); |
+ // Obsolete version. Use the above version which takes gfx::FontList. |
void DrawStringInt(const base::string16& text, |
const gfx::Font& font, |
SkColor color, |
- int x, int y, int w, int h, |
+ int x, |
+ int y, |
+ int w, |
+ int h, |
int flags); |
// Similar to above DrawStringInt method but with text shadows support. |
// Currently it's only implemented for canvas skia. Specifying a 0 line_height |
// will cause the default height to be used. |
+ void DrawStringWithShadowsRect(const base::string16& text, |
Alexei Svitkine (slow)
2013/08/19 14:17:28
Nit: DrawStringRectWithShadows
Yuki
2013/08/20 15:05:47
Done.
|
+ const gfx::FontList& font_list, |
+ SkColor color, |
+ const gfx::Rect& text_bounds, |
+ int line_height, |
+ int flags, |
+ const ShadowValues& shadows); |
+ // Obsolete version. Use the above version which takes gfx::FontList. |
void DrawStringWithShadows(const base::string16& text, |
const gfx::Font& font, |
SkColor color, |
@@ -341,14 +401,26 @@ class UI_EXPORT Canvas { |
// Parameters are specified relative to current canvas scale not in pixels. |
// Thus, |x| is 2 pixels if canvas scale = 2 & |x| = 1. |
void TileImageInt(const gfx::ImageSkia& image, |
- int x, int y, int w, int h); |
+ int x, |
+ int y, |
+ int w, |
+ int h); |
void TileImageInt(const gfx::ImageSkia& image, |
- int src_x, int src_y, |
- int dest_x, int dest_y, int w, int h); |
+ int src_x, |
+ int src_y, |
+ int dest_x, |
+ int dest_y, |
+ int w, |
+ int h); |
void TileImageInt(const gfx::ImageSkia& image, |
- int src_x, int src_y, |
- float tile_scale_x, float tile_scale_y, |
- int dest_x, int dest_y, int w, int h); |
+ int src_x, |
+ int src_y, |
+ float tile_scale_x, |
+ float tile_scale_y, |
+ int dest_x, |
+ int dest_y, |
+ int w, |
+ int h); |
// Returns a native drawing context for platform specific drawing routines to |
// use. Must be balanced by a call to EndPlatformPaint(). |
@@ -365,6 +437,14 @@ class UI_EXPORT Canvas { |
// gradient. When truncating the head |
// |desired_characters_to_truncate_from_head| specifies the maximum number of |
// characters that can be truncated. |
+ void DrawFadeTruncatingStringRect( |
+ const base::string16& text, |
+ TruncateFadeMode truncate_mode, |
+ size_t desired_characters_to_truncate_from_head, |
+ const gfx::FontList& font_list, |
+ SkColor color, |
+ const gfx::Rect& display_rect); |
+ // Obsolete version. Use the above version which takes gfx::FontList. |
void DrawFadeTruncatingString( |
const base::string16& text, |
TruncateFadeMode truncate_mode, |