Bug 21244 - rectangle fill with IntRect
Summary: rectangle fill with IntRect
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other All
: P2 Normal
Assignee: Ariya Hidayat
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-30 11:07 PDT by Ariya Hidayat
Modified: 2008-10-07 04:16 PDT (History)
0 users

See Also:


Attachments
introduce GraphicsContext::fillRect(IntRect) (4.46 KB, patch)
2008-09-30 11:10 PDT, Ariya Hidayat
no flags Details | Formatted Diff | Diff
Detect pixel-aligned rect (2.88 KB, patch)
2008-09-30 11:52 PDT, Ariya Hidayat
eric: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ariya Hidayat 2008-09-30 11:07:49 PDT
For doing a rectangle fill, there is only GraphicsContext::fillRect(FloatRect). In some painting system, e.g. the Qt port of WebKit, optimization can be made if e.g. the rectangle is pixel-aligned.

Solution: introduce GraphicsContext::fillRect(IntRect). Default implementation will just wrap the FloatRect version.
Comment 1 Ariya Hidayat 2008-09-30 11:10:51 PDT
Created attachment 23945 [details]
introduce GraphicsContext::fillRect(IntRect)
Comment 2 Simon Fraser (smfr) 2008-09-30 11:24:43 PDT
Why not just test
if (rect == FloatRect(enclosingIntRect(rect))
inside your fillRect implementation?
Comment 3 Ariya Hidayat 2008-09-30 11:52:22 PDT
Created attachment 23947 [details]
Detect pixel-aligned rect

Another variant of the patch, no need for GraphicsContext::fillRect(IntRect). Just specialize handling of IntRect inside GraphicsContext::fillRect(FloatRect).
Comment 4 Eric Seidel (no email) 2008-09-30 14:47:49 PDT
Comment on attachment 23947 [details]
Detect pixel-aligned rect

Please review the webkit coding style:
http://webkit.org/coding/coding-style.htm and correct the errors in this patch.

Otherwise this looks fine.  I'd rather see "enclosing" called "enclosingRect" since it's a rect. :)

I'm surprised Qt doesn't do this internally already.  CoreGraphics on mac os x certainly does.  IMO this seems like a hack around deficiencies in the Qt API.

r- for the coding style violations.
Comment 5 Ariya Hidayat 2008-10-07 04:16:32 PDT
I decide to fix Qt instead. So I close this bug.