Bug 94400 - [chromium] Random noise around text in FPS HUD
Summary: [chromium] Random noise around text in FPS HUD
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Vangelis Kokkevis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-17 17:17 PDT by Vangelis Kokkevis
Modified: 2023-03-09 12:22 PST (History)
5 users (show)

See Also:


Attachments
Patch (1.52 KB, patch)
2012-08-17 17:26 PDT, Vangelis Kokkevis
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vangelis Kokkevis 2012-08-17 17:17:00 PDT
This is the result of an missing clear operation in the canvas used to store the text atlas.
Comment 1 Vangelis Kokkevis 2012-08-17 17:26:41 PDT
Created attachment 159240 [details]
Patch
Comment 2 James Robinson 2012-08-17 17:38:12 PDT
Comment on attachment 159240 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=159240&action=review

> Source/WebCore/platform/graphics/chromium/CompositorHUDFontAtlas.cpp:68
>      atlasContext.setFillColor(Color(0, 0, 0, 0), ColorSpaceDeviceRGB);
> -    atlasContext.fillRect(FloatRect(0, 0, ATLAS_SIZE, ATLAS_SIZE));
> +    atlasContext.clearRect(FloatRect(0, 0, ATLAS_SIZE, ATLAS_SIZE));

how is clearRect() different from fillRect() with color(0, 0, 0, 0) ?

do you still want to set the fill color when calling clearRect()?
Comment 3 Vangelis Kokkevis 2012-08-17 18:07:22 PDT
(In reply to comment #2)
> (From update of attachment 159240 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=159240&action=review
> 
> > Source/WebCore/platform/graphics/chromium/CompositorHUDFontAtlas.cpp:68
> >      atlasContext.setFillColor(Color(0, 0, 0, 0), ColorSpaceDeviceRGB);
> > -    atlasContext.fillRect(FloatRect(0, 0, ATLAS_SIZE, ATLAS_SIZE));
> > +    atlasContext.clearRect(FloatRect(0, 0, ATLAS_SIZE, ATLAS_SIZE));
> 
> how is clearRect() different from fillRect() with color(0, 0, 0, 0) ?

The default transfer mode for GC is "source-over" (essentially a blend with whatever was in the background) which means with fillRect we're drawing a transparent rect over whatever was already there, which has no effect. 

clearRect sets the transfer mode to clear which does the job.

> 
> do you still want to set the fill color when calling clearRect()?

It's used by the Skia code when setting the paint, so I assume that yes, it's needed. Presumably you could clear to any color.
Comment 4 WebKit Review Bot 2012-08-17 19:07:14 PDT
Comment on attachment 159240 [details]
Patch

Clearing flags on attachment: 159240

Committed r125961: <http://trac.webkit.org/changeset/125961>
Comment 5 WebKit Review Bot 2012-08-17 19:07:17 PDT
All reviewed patches have been landed.  Closing bug.