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

Issue 8725002: Draw text via Skia in RenderTextLinux. (Closed)

Created:
9 years ago by Alexei Svitkine (slow)
Modified:
9 years ago
CC:
chromium-reviews
Visibility:
Public.

Description

Draw text via Skia in RenderTextLinux. Refactors some common Skia drawing code into RenderText internal class SkiaTextRenderer. Rewrite RenderTextLinux::DrawVisualText() to use SkiaTextRenderer and refactor RenderTextWin::DrawVisualText() to also use SkiaTextRenderer, to re-use code. BUG=103648 TEST=Run Linux views_examples_exe --use-pure-views. In the textfield example tab, the text field should draw its text correctly. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=113706

Patch Set 1 : '' #

Total comments: 1

Patch Set 2 : '' #

Patch Set 3 : '' #

Total comments: 30

Patch Set 4 : '' #

Total comments: 1

Patch Set 5 : '' #

Total comments: 10

Patch Set 6 : '' #

Patch Set 7 : '' #

Total comments: 12

Patch Set 8 : '' #

Total comments: 1

Patch Set 9 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+261 lines, -104 lines) Patch
M ui/gfx/render_text.h View 1 2 3 4 5 6 7 8 3 chunks +36 lines, -3 lines 0 comments Download
M ui/gfx/render_text.cc View 1 2 3 4 5 6 7 8 3 chunks +86 lines, -0 lines 0 comments Download
M ui/gfx/render_text_linux.cc View 1 2 3 4 5 6 7 8 11 chunks +123 lines, -27 lines 0 comments Download
M ui/gfx/render_text_win.cc View 1 2 3 4 5 6 7 8 4 chunks +16 lines, -74 lines 0 comments Download

Messages

Total messages: 38 (0 generated)
Alexei Svitkine (slow)
9 years ago (2011-12-01 20:21:53 UTC) #1
Alexei Svitkine (slow)
Oops, CL title was wrong. Changed it now to "Draw text via Skia in RenderTextLinux.". ...
9 years ago (2011-12-01 20:28:13 UTC) #2
Alexei Svitkine (slow)
http://codereview.chromium.org/8725002/diff/15001/ui/gfx/render_text_linux.cc File ui/gfx/render_text_linux.cc (right): http://codereview.chromium.org/8725002/diff/15001/ui/gfx/render_text_linux.cc#newcode315 ui/gfx/render_text_linux.cc:315: if (run_start + i >= style->range.end()) { There was ...
9 years ago (2011-12-02 16:19:58 UTC) #3
Alexei Svitkine (slow)
Ping.
9 years ago (2011-12-05 15:32:31 UTC) #4
sky
Rubber stamp LGTM from me. Make sure you wake for msw and xji to approve ...
9 years ago (2011-12-05 21:44:52 UTC) #5
msw - DO NOT USE
sorry for the delay, i'm part way through, but trying to get something in for ...
9 years ago (2011-12-05 21:52:41 UTC) #6
xji
Thanks for the awesome work! And sorry for the delayed review. http://codereview.chromium.org/8725002/diff/20002/ui/gfx/render_text.cc File ui/gfx/render_text.cc (right): ...
9 years ago (2011-12-05 23:47:09 UTC) #7
msw
http://codereview.chromium.org/8725002/diff/20002/ui/gfx/render_text.cc File ui/gfx/render_text.cc (right): http://codereview.chromium.org/8725002/diff/20002/ui/gfx/render_text.cc#newcode94 ui/gfx/render_text.cc:94: paint_.setTextEncoding(SkPaint::kGlyphID_TextEncoding); Why not roll this into the ctor? http://codereview.chromium.org/8725002/diff/20002/ui/gfx/render_text.cc#newcode107 ...
9 years ago (2011-12-06 18:40:56 UTC) #8
Alexei Svitkine (slow)
I've addressed some of the comments so far, but not all - still working through ...
9 years ago (2011-12-06 19:10:12 UTC) #9
behdad_google
So, this generally works. However, it would be much much easier, cleaner, and more robust, ...
9 years ago (2011-12-06 19:23:12 UTC) #10
Alexei Svitkine (slow)
(+Mike Reed) There were a couple questions in the review raised about some Skia APIs. ...
9 years ago (2011-12-06 19:31:57 UTC) #11
behdad_google
On 2011/12/06 19:31:57, Alexei Svitkine wrote: > (+Mike Reed) > > There were a couple ...
9 years ago (2011-12-06 19:45:08 UTC) #12
Alexei Svitkine (slow)
On Tue, Dec 6, 2011 at 2:23 PM, <behdad@google.com> wrote: > So, this generally works. ...
9 years ago (2011-12-06 19:53:29 UTC) #13
Alexei Svitkine (slow)
http://codereview.chromium.org/8725002/diff/20002/ui/gfx/render_text_linux.cc File ui/gfx/render_text_linux.cc (right): http://codereview.chromium.org/8725002/diff/20002/ui/gfx/render_text_linux.cc#newcode276 ui/gfx/render_text_linux.cc:276: y += default_style().font.GetFontSize(); On 2011/12/05 23:47:09, xji wrote: > ...
9 years ago (2011-12-06 22:05:36 UTC) #14
xji
http://codereview.chromium.org/8725002/diff/27006/ui/gfx/render_text.cc File ui/gfx/render_text.cc (right): http://codereview.chromium.org/8725002/diff/27006/ui/gfx/render_text.cc#newcode640 ui/gfx/render_text.cc:640: // Offset by the font size to account for ...
9 years ago (2011-12-07 00:56:51 UTC) #15
msw
RenderTextWin and base classes LGTM. I'll leave RenderTextLinux to others. http://codereview.chromium.org/8725002/diff/20002/ui/gfx/render_text.cc File ui/gfx/render_text.cc (right): http://codereview.chromium.org/8725002/diff/20002/ui/gfx/render_text.cc#newcode107 ...
9 years ago (2011-12-07 01:08:45 UTC) #16
Alexei Svitkine (slow)
http://codereview.chromium.org/8725002/diff/27006/ui/gfx/render_text.cc File ui/gfx/render_text.cc (right): http://codereview.chromium.org/8725002/diff/27006/ui/gfx/render_text.cc#newcode640 ui/gfx/render_text.cc:640: // Offset by the font size to account for ...
9 years ago (2011-12-07 16:11:19 UTC) #17
Alexei Svitkine (slow)
I've tested the RTL side now (by hardcoding some RTL text and style ranges), and ...
9 years ago (2011-12-07 16:34:18 UTC) #18
xji
http://codereview.chromium.org/8725002/diff/33005/ui/gfx/render_text_linux.cc File ui/gfx/render_text_linux.cc (right): http://codereview.chromium.org/8725002/diff/33005/ui/gfx/render_text_linux.cc#newcode171 ui/gfx/render_text_linux.cc:171: if (IsRunLTR(item)) { thanks for making those changes. http://codereview.chromium.org/8725002/diff/33005/ui/gfx/render_text_linux.cc#newcode315 ...
9 years ago (2011-12-07 19:52:26 UTC) #19
Alexei Svitkine (slow)
http://codereview.chromium.org/8725002/diff/33005/ui/gfx/render_text_linux.cc File ui/gfx/render_text_linux.cc (right): http://codereview.chromium.org/8725002/diff/33005/ui/gfx/render_text_linux.cc#newcode315 ui/gfx/render_text_linux.cc:315: if (IndexInRange(style_ranges_utf8[i], first_glyph_byte_index)) { On 2011/12/07 19:52:26, xji wrote: ...
9 years ago (2011-12-07 19:59:24 UTC) #20
xji
http://codereview.chromium.org/8725002/diff/33005/ui/gfx/render_text_linux.cc File ui/gfx/render_text_linux.cc (right): http://codereview.chromium.org/8725002/diff/33005/ui/gfx/render_text_linux.cc#newcode315 ui/gfx/render_text_linux.cc:315: if (IndexInRange(style_ranges_utf8[i], first_glyph_byte_index)) { On 2011/12/07 19:59:25, Alexei Svitkine ...
9 years ago (2011-12-07 23:17:42 UTC) #21
behdad_google
http://codereview.chromium.org/8725002/diff/33005/ui/gfx/render_text_linux.cc File ui/gfx/render_text_linux.cc (right): http://codereview.chromium.org/8725002/diff/33005/ui/gfx/render_text_linux.cc#newcode315 ui/gfx/render_text_linux.cc:315: if (IndexInRange(style_ranges_utf8[i], first_glyph_byte_index)) { Yeah, this is broken. That's ...
9 years ago (2011-12-07 23:35:05 UTC) #22
behdad_google
9 years ago (2011-12-07 23:38:41 UTC) #23
Alexei Svitkine (slow)
On Wed, Dec 7, 2011 at 6:35 PM, <behdad@google.com> wrote: > > http://codereview.chromium.**org/8725002/diff/33005/ui/gfx/** > render_text_linux.cc<http://codereview.chromium.org/8725002/diff/33005/ui/gfx/render_text_linux.cc> ...
9 years ago (2011-12-07 23:47:13 UTC) #24
msw
On 2011/12/07 23:47:13, Alexei Svitkine wrote: > On Wed, Dec 7, 2011 at 6:35 PM, ...
9 years ago (2011-12-07 23:51:16 UTC) #25
xji
http://codereview.chromium.org/8725002/diff/33005/ui/gfx/render_text_linux.cc File ui/gfx/render_text_linux.cc (right): http://codereview.chromium.org/8725002/diff/33005/ui/gfx/render_text_linux.cc#newcode315 ui/gfx/render_text_linux.cc:315: if (IndexInRange(style_ranges_utf8[i], first_glyph_byte_index)) { On 2011/12/07 23:35:05, behdad_google wrote: ...
9 years ago (2011-12-08 00:27:55 UTC) #26
xji
On 2011/12/07 23:47:13, Alexei Svitkine wrote: > On Wed, Dec 7, 2011 at 6:35 PM, ...
9 years ago (2011-12-08 00:39:56 UTC) #27
Alexei Svitkine (slow)
> > Skia draws glyph by glyph, if you look at loop starts at line ...
9 years ago (2011-12-08 07:12:12 UTC) #28
Alexei Svitkine (slow)
> > It won't be pretty, but it is possible to do. > To be ...
9 years ago (2011-12-08 07:20:57 UTC) #29
xji
On 2011/12/08 07:12:12, Alexei Svitkine wrote: > > > > Skia draws glyph by glyph, ...
9 years ago (2011-12-08 16:17:49 UTC) #30
xji
LGTM with a TODO and bug for drawing split glyph. You might want to check ...
9 years ago (2011-12-08 16:28:39 UTC) #31
Alexei Svitkine (slow)
I've updated the patch with the TODO and added a loop to iterate over the ...
9 years ago (2011-12-08 16:28:42 UTC) #32
msw
http://codereview.chromium.org/8725002/diff/46001/ui/gfx/render_text.cc File ui/gfx/render_text.cc (right): http://codereview.chromium.org/8725002/diff/46001/ui/gfx/render_text.cc#newcode91 ui/gfx/render_text.cc:91: //paint_.setLCDRenderText(true); Did you mean to comment this out?
9 years ago (2011-12-08 19:40:26 UTC) #33
Alexei Svitkine (slow)
On 2011/12/08 19:40:26, msw wrote: > http://codereview.chromium.org/8725002/diff/46001/ui/gfx/render_text.cc > File ui/gfx/render_text.cc (right): > > http://codereview.chromium.org/8725002/diff/46001/ui/gfx/render_text.cc#newcode91 > ...
9 years ago (2011-12-08 19:49:04 UTC) #34
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/asvitkine@chromium.org/8725002/51001
9 years ago (2011-12-08 21:58:50 UTC) #35
commit-bot: I haz the power
Change committed as 113706
9 years ago (2011-12-09 00:35:07 UTC) #36
behdad_google
http://codereview.chromium.org/8725002/diff/33005/ui/gfx/render_text_linux.cc File ui/gfx/render_text_linux.cc (right): http://codereview.chromium.org/8725002/diff/33005/ui/gfx/render_text_linux.cc#newcode315 ui/gfx/render_text_linux.cc:315: if (IndexInRange(style_ranges_utf8[i], first_glyph_byte_index)) { On 2011/12/08 00:27:56, xji wrote: ...
9 years ago (2011-12-14 06:29:11 UTC) #37
xji
9 years ago (2011-12-14 18:29:16 UTC) #38
Thanks for the explanation.


On 2011/12/14 06:29:11, behdad_google wrote:
> http://codereview.chromium.org/8725002/diff/33005/ui/gfx/render_text_linux.cc
> File ui/gfx/render_text_linux.cc (right):
> 
>
http://codereview.chromium.org/8725002/diff/33005/ui/gfx/render_text_linux.cc...
> ui/gfx/render_text_linux.cc:315: if (IndexInRange(style_ranges_utf8[i],
> first_glyph_byte_index)) {
> On 2011/12/08 00:27:56, xji wrote:
> > On 2011/12/07 23:35:05, behdad_google wrote:
> > > Yeah, this is broken.  That's why I suggested that you highlight using
Skia.
> 
> > > But get the bounds from Pango.  Pango knows how to handle the size.  Well,
> it
> > > just linearly divides the cluster width by the number of cursor positions
in
> > the
> > > cluster.
> > 
> > Does pango handle using 2 different foregrounds (not background) to draw
'fi'
> > ligature? How?
> 
> No.  Pango doesn't by itself.  But if you try selection in gedit it works. 
> That's because gtk implements selection by clipping through cairo.
> 
> > by "linearly divides", do you mean "evenly" divides?
> 
> Yes, right.
> 
> > Skia draws glyph by glyph, if you look at loop starts at line 334, even if
you
> > can adjust pos[i] (at line 337) and glyph_x (at line 339) to count part of
the
> > 'fi' glyph, how can you pass half of the glyph to glyphs[i] (at line 336)?
> 
> The idea is that you draw the entire paragraph.  Then clip to selection region
> only, and draw with different color.  So, you are drawing twice.

Powered by Google App Engine
This is Rietveld 408576698