summaryrefslogtreecommitdiffstats
path: root/ui/gfx/render_text.h
diff options
context:
space:
mode:
authorxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-11 02:23:56 +0000
committerxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-11 02:23:56 +0000
commit0834e1b153c28dec0ae9e90080ad7a106f1c8c84 (patch)
tree3a939399a68c91722271573bf2589266d642d58f /ui/gfx/render_text.h
parentc8678d8870826350577c3f00e922e442abb647c9 (diff)
downloadchromium_src-0834e1b153c28dec0ae9e90080ad7a106f1c8c84.zip
chromium_src-0834e1b153c28dec0ae9e90080ad7a106f1c8c84.tar.gz
chromium_src-0834e1b153c28dec0ae9e90080ad7a106f1c8c84.tar.bz2
ash: Better and faster text shadows.
- Add a DrawStringWithShadows that draws text with shadows to canvas skia and RenderText; - Use DrawStringWithShadows in DropShadowLabel for better and faster text shadows; BUG=121694 TEST=Verify fix for issue 121694. Review URL: http://codereview.chromium.org/10008027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131696 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/render_text.h')
-rw-r--r--ui/gfx/render_text.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/ui/gfx/render_text.h b/ui/gfx/render_text.h
index 1e32489..8077828 100644
--- a/ui/gfx/render_text.h
+++ b/ui/gfx/render_text.h
@@ -28,6 +28,7 @@ namespace gfx {
class Canvas;
class RenderTextTest;
+class ShadowValue;
struct StyleRange;
namespace internal {
@@ -38,6 +39,7 @@ class SkiaTextRenderer {
explicit SkiaTextRenderer(Canvas* canvas);
~SkiaTextRenderer();
+ void SetDrawLooper(SkDrawLooper* draw_looper);
void SetFontSmoothingSettings(bool enable_smoothing, bool enable_lcd_text);
void SetTypeface(SkTypeface* typeface);
void SetTextSize(int size);
@@ -214,6 +216,8 @@ class UI_EXPORT RenderText {
// Get the size in pixels of the entire string. For the height, this will
// return the maximum height among the different fonts in the text runs.
+ // Note that this returns the raw size of the string, which does not include
+ // the margin area of text shadows.
virtual Size GetStringSize() = 0;
void Draw(Canvas* canvas);
@@ -246,6 +250,9 @@ class UI_EXPORT RenderText {
// The returned value represents a cursor/caret position without a selection.
SelectionModel GetSelectionModelForSelectionStart();
+ // Sets shadows to drawn with text.
+ void SetTextShadows(const std::vector<ShadowValue>& shadows);
+
protected:
RenderText();
@@ -339,6 +346,9 @@ class UI_EXPORT RenderText {
// Applies fade effects to |renderer|.
void ApplyFadeEffects(internal::SkiaTextRenderer* renderer);
+ // Applies text shadows to |renderer|.
+ void ApplyTextShadows(internal::SkiaTextRenderer* renderer);
+
// A convenience function to check whether the glyph attached to the caret
// is within the given range.
static bool RangeContainsCaret(const ui::Range& range,
@@ -430,6 +440,9 @@ class UI_EXPORT RenderText {
// selection, font, and other operations that adjust the visible text bounds.
bool cached_bounds_and_offset_valid_;
+ // Text shadows to be drawn.
+ std::vector<ShadowValue> text_shadows_;
+
DISALLOW_COPY_AND_ASSIGN(RenderText);
};