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

Side by Side 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: Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « ui/gfx/render_text.h ('k') | ui/gfx/render_text_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/gfx/render_text.h" 5 #include "ui/gfx/render_text.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <climits> 8 #include <climits>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 void SkiaTextRenderer::SetDrawLooper(SkDrawLooper* draw_looper) { 210 void SkiaTextRenderer::SetDrawLooper(SkDrawLooper* draw_looper) {
211 paint_.setLooper(draw_looper); 211 paint_.setLooper(draw_looper);
212 } 212 }
213 213
214 void SkiaTextRenderer::SetFontRenderParams(const FontRenderParams& params, 214 void SkiaTextRenderer::SetFontRenderParams(const FontRenderParams& params,
215 bool background_is_transparent) { 215 bool background_is_transparent) {
216 ApplyRenderParams(params, background_is_transparent, &paint_); 216 ApplyRenderParams(params, background_is_transparent, &paint_);
217 } 217 }
218 218
219 #if defined(OS_WIN)
220 void SkiaTextRenderer::CorrectPaintFlags(bool background_is_transparent) {
221 paint_.setFlags(SkSetClearMask(paint_.getFlags(), background_is_transparent,
msw 2014/08/27 19:16:40 Can you make this part of SetFontRenderParams?
222 SkPaint::kGenA8FromLCD_Flag));
msw 2014/08/27 19:16:40 This is cited as a "hack for GDI -- do not use if
223 }
224 #endif // OS_WIN
225
219 void SkiaTextRenderer::SetTypeface(SkTypeface* typeface) { 226 void SkiaTextRenderer::SetTypeface(SkTypeface* typeface) {
220 paint_.setTypeface(typeface); 227 paint_.setTypeface(typeface);
221 } 228 }
222 229
223 void SkiaTextRenderer::SetTextSize(SkScalar size) { 230 void SkiaTextRenderer::SetTextSize(SkScalar size) {
224 paint_.setTextSize(size); 231 paint_.setTextSize(size);
225 } 232 }
226 233
227 void SkiaTextRenderer::SetFontFamilyWithStyle(const std::string& family, 234 void SkiaTextRenderer::SetFontFamilyWithStyle(const std::string& family,
228 int style) { 235 int style) {
(...skipping 23 matching lines...) Expand all
252 SkScalar position) { 259 SkScalar position) {
253 underline_thickness_ = thickness; 260 underline_thickness_ = thickness;
254 underline_position_ = position; 261 underline_position_ = position;
255 } 262 }
256 263
257 void SkiaTextRenderer::DrawPosText(const SkPoint* pos, 264 void SkiaTextRenderer::DrawPosText(const SkPoint* pos,
258 const uint16* glyphs, 265 const uint16* glyphs,
259 size_t glyph_count) { 266 size_t glyph_count) {
260 if (!started_drawing_) { 267 if (!started_drawing_) {
261 started_drawing_ = true; 268 started_drawing_ = true;
262 // Work-around for http://crbug.com/122743, where non-ClearType text is 269 // Work-around for http://crbug.com/122743, where non-ClearType text is
msw 2014/08/27 19:16:40 Can we remove this workaround given the changes in
263 // rendered with incorrect gamma when using the fade shader. Draw the text 270 // rendered with incorrect gamma when using the fade shader. Draw the text
264 // to a layer and restore it faded by drawing a rect in kDstIn_Mode mode. 271 // to a layer and restore it faded by drawing a rect in kDstIn_Mode mode.
265 // 272 //
266 // Skip this when there is a looper which seems not working well with 273 // Skip this when there is a looper which seems not working well with
267 // deferred paint. Currently a looper is only used for text shadows. 274 // deferred paint. Currently a looper is only used for text shadows.
268 // 275 //
269 // TODO(asvitkine): Remove this work-around once the Skia bug is fixed. 276 // TODO(asvitkine): Remove this work-around once the Skia bug is fixed.
270 // http://code.google.com/p/skia/issues/detail?id=590 277 // http://code.google.com/p/skia/issues/detail?id=590
271 if (!paint_.isLCDRenderText() && 278 if (!paint_.isLCDRenderText() &&
272 paint_.getShader() && 279 paint_.getShader() &&
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 SetDisplayOffset(display_offset_.x() + delta_x); 1438 SetDisplayOffset(display_offset_.x() + delta_x);
1432 } 1439 }
1433 1440
1434 void RenderText::DrawSelection(Canvas* canvas) { 1441 void RenderText::DrawSelection(Canvas* canvas) {
1435 const std::vector<Rect> sel = GetSubstringBounds(selection()); 1442 const std::vector<Rect> sel = GetSubstringBounds(selection());
1436 for (std::vector<Rect>::const_iterator i = sel.begin(); i < sel.end(); ++i) 1443 for (std::vector<Rect>::const_iterator i = sel.begin(); i < sel.end(); ++i)
1437 canvas->FillRect(*i, selection_background_focused_color_); 1444 canvas->FillRect(*i, selection_background_focused_color_);
1438 } 1445 }
1439 1446
1440 } // namespace gfx 1447 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/render_text.h ('k') | ui/gfx/render_text_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698