Bug 64126 - Turn antialiasing on only for rects which are are rotated or not scaled
Summary: Turn antialiasing on only for rects which are are rotated or not scaled
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-07 14:10 PDT by Dmitry Gorbik
Modified: 2014-02-05 10:48 PST (History)
14 users (show)

See Also:


Attachments
reduction (395 bytes, text/html)
2011-07-07 14:10 PDT, Dmitry Gorbik
no flags Details
Proposed fix 0.1 (15.06 KB, patch)
2011-07-14 18:07 PDT, Dmitry Gorbik
simon.fraser: review-
Details | Formatted Diff | Diff
Proposed fix 0.2 (11.26 KB, patch)
2011-07-15 15:01 PDT, Dmitry Gorbik
no flags Details | Formatted Diff | Diff
Proposed fix 0.3 (12.71 KB, patch)
2011-07-15 15:15 PDT, Dmitry Gorbik
no flags Details | Formatted Diff | Diff
Proposed fix 0.4 (9.79 KB, patch)
2011-07-15 17:29 PDT, Dmitry Gorbik
no flags Details | Formatted Diff | Diff
Proposed fix 0.5 (12.72 KB, patch)
2011-07-18 15:30 PDT, Dmitry Gorbik
webkit-ews: commit-queue-
Details | Formatted Diff | Diff
Proposed fix 0.6 (15.17 KB, patch)
2011-07-18 16:54 PDT, Dmitry Gorbik
simon.fraser: review-
Details | Formatted Diff | Diff
Proposed fix 0.7 (14.22 KB, patch)
2011-08-15 14:53 PDT, Dmitry Gorbik
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Gorbik 2011-07-07 14:10:58 PDT
Created attachment 100029 [details]
reduction

If we have two nested divs with different background color, and scaling is applied, border appears.
Comment 1 Dmitry Gorbik 2011-07-14 18:07:27 PDT
Created attachment 100907 [details]
Proposed fix 0.1

Proposed fix 0.1
Comment 2 Simon Fraser (smfr) 2011-07-15 11:24:23 PDT
Comment on attachment 100907 [details]
Proposed fix 0.1

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

> LayoutTests/transforms/2d/antialiasing-pixel-cracks.html:10
> +			There should not be a border

We try to avoid text in pixel results because of platform differences. You can make it an HTML comment.

> Source/WebCore/ChangeLog:8
> +        we need to turn antialiasing in the cases when we do not need it: when

... turn off...

> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:721
> +    if (!canEnableAntialiasing())
> +        CGContextSetShouldAntialias(platformContext(), false);

I think this is going to have unwanted side effects. You're changing a lot of behavior here.

> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:845
> +    if (!canEnableAntialiasing())
> +        CGContextSetShouldAntialias(platformContext(), false);

You should call canEnableAntialiasing() just once, and use a flag to reset it.

> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:851
> +    if (!canEnableAntialiasing())
> +        CGContextSetShouldAntialias(platformContext(), true);

These aren't going to nest correctly if you always set it back to true.

> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:1159
> +bool GraphicsContext::canEnableAntialiasing(void)

How is this different from !AffineTransform::isIdentityOrTranslationOrFlipped()?

> Source/WebCore/platform/graphics/cg/ImageCG.cpp:188
> +    if (!ctxt->canEnableAntialiasing())
> +        CGContextSetShouldAntialias(ctxt->platformContext(), false);

I think this is going to have unwanted side effects. You're changing a lot of behavior here.
Comment 3 Dmitry Gorbik 2011-07-15 15:01:53 PDT
Created attachment 101050 [details]
Proposed fix 0.2
Comment 4 Dmitry Gorbik 2011-07-15 15:15:06 PDT
Created attachment 101053 [details]
Proposed fix 0.3
Comment 5 Dmitry Gorbik 2011-07-15 17:29:18 PDT
Created attachment 101076 [details]
Proposed fix 0.4
Comment 6 Dmitry Gorbik 2011-07-18 15:30:27 PDT
Created attachment 101221 [details]
Proposed fix 0.5
Comment 7 Early Warning System Bot 2011-07-18 15:59:37 PDT
Comment on attachment 101221 [details]
Proposed fix 0.5

Attachment 101221 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/9115441
Comment 8 Gyuyoung Kim 2011-07-18 16:01:13 PDT
Comment on attachment 101221 [details]
Proposed fix 0.5

Attachment 101221 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/9111492
Comment 9 Gustavo Noronha (kov) 2011-07-18 16:08:47 PDT
Comment on attachment 101221 [details]
Proposed fix 0.5

Attachment 101221 [details] did not pass gtk-ews (gtk):
Output: http://queues.webkit.org/results/9110582
Comment 10 WebKit Review Bot 2011-07-18 16:13:32 PDT
Comment on attachment 101221 [details]
Proposed fix 0.5

Attachment 101221 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/9115445
Comment 11 Dmitry Gorbik 2011-07-18 16:54:46 PDT
Created attachment 101237 [details]
Proposed fix 0.6
Comment 12 Simon Fraser (smfr) 2011-08-12 10:18:03 PDT
Comment on attachment 101237 [details]
Proposed fix 0.6

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

> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:724
> +    bool restoreAntialiasMode = false;
> +    if (shouldAntialias()) {
> +        CGContextSetShouldAntialias(platformContext(), false);
> +        restoreAntialiasMode = true;
> +    }

I think this is too general a fix. You'll affect all rendering here, including canvas rendering.

> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:1165
> +bool GraphicsContext::needsAntialiasing()

Should be const.

> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:1175
> +    // Enable AA for any rotated objects.
> +    if (ctm.a() == -ctm.d() && ctm.b() == ctm.c() && !ctm.b())
> +        return false;

The comment doesn't match the code.

> Source/WebCore/platform/graphics/cg/ImageCG.cpp:191
> +    bool restoreAntialiasMode = false;
> +    if (ctxt->shouldAntialias()) {
> +        CGContextSetShouldAntialias(ctxt->platformContext(), false);
> +        restoreAntialiasMode = true;
> +    }

Again, this is too general. You'll change canvas rendering.
Comment 13 Dmitry Gorbik 2011-08-15 14:53:27 PDT
Created attachment 103959 [details]
Proposed fix 0.7
Comment 14 Andreas Kling 2014-02-05 10:48:05 PST
Comment on attachment 103959 [details]
Proposed fix 0.7

Clearing review flag on patches from before 2014. If this patch is still relevant, please reset the r? flag.