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):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@79129 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 14fcc6d8
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 Alejandro G. Castro <alex@igalia.com>
Unreviewed, fixed typo in the GTK+ skipped file.
......
......@@ -1019,7 +1019,6 @@ canvas/philip/tests/type.prototype.html
# These tests are failing for us, but not for Mac. This likely
# indicates platform specific problems.
canvas/philip/tests/2d.drawImage.floatsource.html
canvas/philip/tests/2d.drawImage.self.2.html
canvas/philip/tests/2d.path.arc.selfintersect.1.html
canvas/philip/tests/2d.path.arc.shape.3.html
......
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):
2011-02-19 Dan Bernstein <mitz@apple.com>
LLVM Compiler build fix.
......
......@@ -38,6 +38,7 @@
#include "CairoPath.h"
#include "CairoUtilities.h"
#include "ContextShadow.h"
#include "FloatConversion.h"
#include "FloatRect.h"
#include "Font.h"
#include "GraphicsContextPlatformPrivateCairo.h"
......@@ -756,16 +757,30 @@ FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& frect)
x = round(x);
y = round(y);
cairo_device_to_user(cr, &x, &y);
result.setX(static_cast<float>(x));
result.setY(static_cast<float>(y));
x = frect.width();
y = frect.height();
cairo_user_to_device_distance(cr, &x, &y);
x = round(x);
y = round(y);
cairo_device_to_user_distance(cr, &x, &y);
result.setWidth(static_cast<float>(x));
result.setHeight(static_cast<float>(y));
result.setX(narrowPrecisionToFloat(x));
result.setY(narrowPrecisionToFloat(y));
// We must ensure width and height are at least 1 (or -1) when
// we're given float values in the range between 0 and 1 (or -1 and 0).
double width = frect.width();
double height = frect.height();
cairo_user_to_device_distance(cr, &width, &height);
if (width > -1 && width < 0)
width = -1;
else if (width > 0 && width < 1)
width = 1;
else
width = round(width);
if (height > -1 && width < 0)
height = -1;
else if (height > 0 && height < 1)
height = 1;
else
height = round(height);
cairo_device_to_user_distance(cr, &width, &height);
result.setWidth(narrowPrecisionToFloat(width));
result.setHeight(narrowPrecisionToFloat(height));
return result;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment