android - Why is Canvas.drawText slower when the text is not drawn entirely within the view? -


i have weird performance issues custom view. here simplified example :

protected void ondraw(canvas canvas) {     super.ondraw(canvas);      canvas.drawbitmap(bitmap, 0, 0, null);     canvas.drawtext("test", 0, 30, textpaint); } 

bitmap small background image. string drawn on top large text size top 10 (or so) pixels cropped, want.

i have around 100 views in listview (10 per row). scrolling through list incredibly slow, strange reason, becomes smooth if change drawtext() coordinates text fits within bounds of view.

what going on? why slow draw text outside of bounds?

i'm running android 4.2.2 (can't try on other versions, emulator isn't great test layout performance).

it possible skia needs calculation , allocation per glyph (letter) out of bound.

if situation text being out of screen on left or right, or when have full screen text , top and/or bottom line half visible such performance problem ignorable. in case more skia developers assumed. might better later android releases, looks @ moment unoptimized case.

for wondering, believe related code in skdraw.cpp around skbounder::doirectglyph.

proper way find bottle neck use native execution tracer perf, oprofile or arm ds-5 streamline.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -