New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 782388 link

Starred by 2 users

Issue metadata

Status: Archived
Owner: ----
Closed: Jan 18
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Feature
Proj-VR
Proj-XR
Proj-XR-VR



Sign in to add a comment

Allocate textures with the minimum amount of required pixels

Project Member Reported by tiborg@chromium.org, Nov 7 2017

Issue description

Currently, for some textures (e.g. text), we allocate a big square pixel surface since we don't know how large the drawn text will be. Optimize this so that we only allocate the minimum amount of required pixels.

After discussing this with bsalomon@ we could do the following:
- Use the canvas returned by SkPictureRecorder::beginRecording to draw the texture. This will record a display list of the draw commands and not actual pixels. Optional: pass in an SkRTreeFactory to get a valid bounding box (I believe we know the drawn size anyway, see below).
- Allocate a surface with the size returned by UiTexture::GetDrawnSize (or use the bounding box - SkPicture::cullRect - calculated by the SkPictureRecorder using the SkRTreeFactory's bounding-box hierarchy).
- Use SkCanvas::drawPicture of the surface's canvas to produce actual pixels.

This scheme may also allow as arbitrarily long text. Right now, we cannot draw text that is higher than wide.
 
Labels: -M-64 M-65
Labels: -Pri-2 -M-65 Pri-3
Tibor, this bug is still valid, but things have changed.  We now fully measure text before allocating its texture, and size the texture according to the elements size.

A single-line (variable width) text item now allocates only what's needed, and for an empty string, doesn't even allocate a texture.

There is also single-line-fixed-width, however, that could use work.  In that case, we still allocate a texture of the fixed width, for the sake of ensuring element size.  We wouldn't have to do this though - we could decouple Text's size from the texture, and instead align the smaller texture WRT the larger size at render time.
Cc: tiborg@chromium.org vollick@chromium.org
 Issue 812254  has been merged into this issue.
Cc: cjgrant@chromium.org
Labels: -Proj-VR
Owner: ----
Status: Available (was: Assigned)
Marking as available because I don't have plans for working on this any time soon.

Comment 6 by ddorwin@chromium.org, Jan 18 (4 days ago)

Labels: OS-Android

Comment 7 by samdrazin@chromium.org, Jan 18 (4 days ago)

Status: Archived (was: Available)

Sign in to add a comment