Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(782)

Unified Diff: ui/gfx/render_text.cc

Issue 493363006: Remove deferred fade shader workaround from RenderText (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove deferred fade shader workaround from RenderText Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« ui/gfx/render_text.h ('K') | « ui/gfx/render_text.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text.cc
diff --git a/ui/gfx/render_text.cc b/ui/gfx/render_text.cc
index 19bb69b8bf0681f9b48a3e0792202777363a5aaa..14e2193c7fc03dcfaf8a6d6f7a2b217e3e98ff04 100644
--- a/ui/gfx/render_text.cc
+++ b/ui/gfx/render_text.cc
@@ -189,22 +189,9 @@ SkiaTextRenderer::SkiaTextRenderer(Canvas* canvas)
paint_.setSubpixelText(true);
paint_.setLCDRenderText(true);
paint_.setHinting(SkPaint::kNormal_Hinting);
- bounds_.setEmpty();
}
SkiaTextRenderer::~SkiaTextRenderer() {
- // Work-around for http://crbug.com/122743, where non-ClearType text is
- // rendered with incorrect gamma when using the fade shader. Draw the text
- // to a layer and restore it faded by drawing a rect in kDstIn_Mode mode.
- //
- // TODO(asvitkine): Remove this work-around once the Skia bug is fixed.
- // http://code.google.com/p/skia/issues/detail?id=590
- if (deferred_fade_shader_.get()) {
- paint_.setShader(deferred_fade_shader_.get());
- paint_.setXfermodeMode(SkXfermode::kDstIn_Mode);
- canvas_skia_->drawRect(bounds_, paint_);
- canvas_skia_->restore();
- }
}
void SkiaTextRenderer::SetDrawLooper(SkDrawLooper* draw_looper) {
@@ -243,8 +230,7 @@ void SkiaTextRenderer::SetForegroundColor(SkColor foreground) {
paint_.setColor(foreground);
}
-void SkiaTextRenderer::SetShader(SkShader* shader, const Rect& bounds) {
- bounds_ = RectToSkRect(bounds);
+void SkiaTextRenderer::SetShader(SkShader* shader) {
paint_.setShader(shader);
}
@@ -257,26 +243,6 @@ void SkiaTextRenderer::SetUnderlineMetrics(SkScalar thickness,
void SkiaTextRenderer::DrawPosText(const SkPoint* pos,
const uint16* glyphs,
size_t glyph_count) {
- if (!started_drawing_) {
- started_drawing_ = true;
- // Work-around for http://crbug.com/122743, where non-ClearType text is
- // rendered with incorrect gamma when using the fade shader. Draw the text
- // to a layer and restore it faded by drawing a rect in kDstIn_Mode mode.
- //
- // Skip this when there is a looper which seems not working well with
- // deferred paint. Currently a looper is only used for text shadows.
- //
- // TODO(asvitkine): Remove this work-around once the Skia bug is fixed.
- // http://code.google.com/p/skia/issues/detail?id=590
- if (!paint_.isLCDRenderText() &&
- paint_.getShader() &&
- !paint_.getLooper()) {
- deferred_fade_shader_ = skia::SharePtr(paint_.getShader());
- paint_.setShader(NULL);
- canvas_skia_->saveLayer(&bounds_, NULL);
- }
- }
-
const size_t byte_length = glyph_count * sizeof(glyphs[0]);
canvas_skia_->drawPosText(&glyphs[0], byte_length, &pos[0], paint_);
}
@@ -1175,7 +1141,7 @@ void RenderText::ApplyFadeEffects(internal::SkiaTextRenderer* renderer) {
skia::RefPtr<SkShader> shader = CreateFadeShader(
text_rect, left_part, right_part, colors_.breaks().front().second);
if (shader)
- renderer->SetShader(shader.get(), display_rect());
+ renderer->SetShader(shader.get());
}
void RenderText::ApplyTextShadows(internal::SkiaTextRenderer* renderer) {
« ui/gfx/render_text.h ('K') | « ui/gfx/render_text.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698