Changeset 79129 in webkit


Ignore:
Timestamp:
Feb 19, 2011 12:28:47 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-02-19 Zan Dobersek <zandobersek@gmail.com>

Reviewed by Martin Robinson.

[cairo][canvas] Drawing from/into float rectangles with width or height in range 0 to 1 fails
https://bugs.webkit.org/show_bug.cgi?id=54491

Enable another passing test after fixing float values rounding.

  • platform/gtk/Skipped:

2011-02-19 Zan Dobersek <zandobersek@gmail.com>

Reviewed by Martin Robinson.

[cairo][canvas] Drawing from/into float rectangles with width or height in range 0 to 1 fails
https://bugs.webkit.org/show_bug.cgi?id=54491

When width or height in float rectangle are in range (0, 0.5) or (-0.5, 0)
and would round to 0, alter the behaviour to ensure that width or height are
at least 1 pixel in size in these cases.

  • platform/graphics/cairo/GraphicsContextCairo.cpp: (WebCore::GraphicsContext::roundToDevicePixels):
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r79125 r79129  
     12011-02-19  Zan Dobersek  <zandobersek@gmail.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        [cairo][canvas] Drawing from/into float rectangles with width or height in range 0 to 1 fails
     6        https://bugs.webkit.org/show_bug.cgi?id=54491
     7
     8        Enable another passing test after fixing float values rounding.
     9
     10        * platform/gtk/Skipped:
     11
    1122011-02-19  Alejandro G. Castro  <alex@igalia.com>
    213
  • trunk/LayoutTests/platform/gtk/Skipped

    r79125 r79129  
    10201020# These tests are failing for us, but not for Mac. This likely
    10211021# indicates platform specific problems.
    1022 canvas/philip/tests/2d.drawImage.floatsource.html
    10231022canvas/philip/tests/2d.drawImage.self.2.html
    10241023canvas/philip/tests/2d.path.arc.selfintersect.1.html
  • trunk/Source/WebCore/ChangeLog

    r79128 r79129  
     12011-02-19  Zan Dobersek  <zandobersek@gmail.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        [cairo][canvas] Drawing from/into float rectangles with width or height in range 0 to 1 fails
     6        https://bugs.webkit.org/show_bug.cgi?id=54491
     7
     8        When width or height in float rectangle are in range (0, 0.5) or (-0.5, 0)
     9        and would round to 0, alter the behaviour to ensure that width or height are
     10        at least 1 pixel in size in these cases.
     11
     12        * platform/graphics/cairo/GraphicsContextCairo.cpp:
     13        (WebCore::GraphicsContext::roundToDevicePixels):
     14
    1152011-02-19  Dan Bernstein  <mitz@apple.com>
    216
  • trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp

    r78846 r79129  
    3939#include "CairoUtilities.h"
    4040#include "ContextShadow.h"
     41#include "FloatConversion.h"
    4142#include "FloatRect.h"
    4243#include "Font.h"
     
    757758    y = round(y);
    758759    cairo_device_to_user(cr, &x, &y);
    759     result.setX(static_cast<float>(x));
    760     result.setY(static_cast<float>(y));
    761     x = frect.width();
    762     y = frect.height();
    763     cairo_user_to_device_distance(cr, &x, &y);
    764     x = round(x);
    765     y = round(y);
    766     cairo_device_to_user_distance(cr, &x, &y);
    767     result.setWidth(static_cast<float>(x));
    768     result.setHeight(static_cast<float>(y));
     760    result.setX(narrowPrecisionToFloat(x));
     761    result.setY(narrowPrecisionToFloat(y));
     762
     763    // We must ensure width and height are at least 1 (or -1) when
     764    // we're given float values in the range between 0 and 1 (or -1 and 0).
     765    double width = frect.width();
     766    double height = frect.height();
     767    cairo_user_to_device_distance(cr, &width, &height);
     768    if (width > -1 && width < 0)
     769        width = -1;
     770    else if (width > 0 && width < 1)
     771        width = 1;
     772    else
     773        width = round(width);
     774    if (height > -1 && width < 0)
     775        height = -1;
     776    else if (height > 0 && height < 1)
     777        height = 1;
     778    else
     779        height = round(height);
     780    cairo_device_to_user_distance(cr, &width, &height);
     781    result.setWidth(narrowPrecisionToFloat(width));
     782    result.setHeight(narrowPrecisionToFloat(height));
     783
    769784    return result;
    770785}
Note: See TracChangeset for help on using the changeset viewer.