Changeset 268176 in webkit


Ignore:
Timestamp:
Oct 8, 2020 5:40:31 AM (3 years ago)
Author:
Lauro Moura
Message:

[GTK][WPE] Missing Exif Orientation support
https://bugs.webkit.org/show_bug.cgi?id=95299

Reviewed by Carlos Alberto Lopez Perez.

Source/WebCore:

CairoOperations::drawSurface is not taking 90/270 degrees orientation
changes in account correctly.

As in these operations the size of the surfaces will be the same but
not exactly equal (by transposing width and height), drawSurface
currently wrongly presumes the need for some some padding. The same
happens to the scale factors.

Covered by existing tests.

  • platform/graphics/cairo/CairoOperations.cpp:

(WebCore::Cairo::drawNativeImage): Forward usesWidthAsHeight to
drawSurface.
(WebCore::Cairo::drawSurface): use correct scaling/padding when
getting surfaces from images rotated 90/270 degrees.

  • platform/graphics/cairo/CairoOperations.h: Add new enum to forward

Orientation.usesWidthAsHeight.

LayoutTests:

Update expectations after partial EXIF support

  • platform/gtk/TestExpectations:
  • platform/wpe/TestExpectations:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r268174 r268176  
     12020-10-08  Lauro Moura  <lmoura@igalia.com>
     2
     3        [GTK][WPE] Missing Exif Orientation support
     4        https://bugs.webkit.org/show_bug.cgi?id=95299
     5
     6        Reviewed by Carlos Alberto Lopez Perez.
     7
     8        Update expectations after partial EXIF support
     9
     10        * platform/gtk/TestExpectations:
     11        * platform/wpe/TestExpectations:
     12
    1132020-10-08  Diego Pino Garcia  <dpino@igalia.com>
    214
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r268113 r268176  
    34013401webkit.org/b/201981 http/wpt/resource-timing/rt-resources-per-worker.html [ Failure Pass ]
    34023402
    3403 webkit.org/b/201982 fast/images/exif-orientation-background.html [ ImageOnlyFailure ]
    3404 webkit.org/b/201982 fast/images/exif-orientation-canvas.html [ ImageOnlyFailure ]
    3405 webkit.org/b/201982 fast/images/exif-orientation-composited.html [ ImageOnlyFailure ]
    3406 webkit.org/b/201982 fast/images/exif-orientation-content.html [ ImageOnlyFailure ]
    3407 webkit.org/b/201982 fast/images/exif-orientation-element-object-fit.html [ ImageOnlyFailure ]
    3408 webkit.org/b/201982 fast/images/exif-orientation-element.html [ ImageOnlyFailure ]
    3409 webkit.org/b/201982 fast/images/exif-orientation-image-document.html [ ImageOnlyFailure ]
    3410 webkit.org/b/201982 fast/images/exif-orientation-image-object.html [ ImageOnlyFailure ]
    3411 webkit.org/b/201982 fast/images/exif-orientation-svg-feimage.html [ ImageOnlyFailure ]
    3412 webkit.org/b/201982 fast/images/exif-orientation-svg-image.html [ ImageOnlyFailure ]
    3413 webkit.org/b/201982 fast/images/exif-orientation-webgl-texture.html [ ImageOnlyFailure ]
    3414 webkit.org/b/201982 fast/images/exif-orientation-background-image-no-repeat.html [ ImageOnlyFailure ]
    34153403webkit.org/b/201982 fast/images/exif-orientation-background-image-repeat.html [ ImageOnlyFailure ]
    34163404webkit.org/b/201982 fast/images/exif-orientation-border-image.html [ ImageOnlyFailure ]
    3417 webkit.org/b/201982 fast/images/image-orientation-dynamic-from-image.html [ ImageOnlyFailure ]
    34183405
    34193406webkit.org/b/202225 accessibility/misspelling-range.html [ Failure ]
  • trunk/LayoutTests/platform/wpe/TestExpectations

    r268051 r268176  
    18541854webkit.org/b/201981 imported/w3c/web-platform-tests/service-workers/service-worker/windowclient-navigate.https.html [ Failure ]
    18551855
    1856 webkit.org/b/201982 fast/images/exif-orientation-background.html [ ImageOnlyFailure ]
    1857 webkit.org/b/201982 fast/images/exif-orientation-canvas.html [ ImageOnlyFailure ]
    1858 webkit.org/b/201982 fast/images/exif-orientation-composited.html [ ImageOnlyFailure ]
    1859 webkit.org/b/201982 fast/images/exif-orientation-content.html [ ImageOnlyFailure ]
    1860 webkit.org/b/201982 fast/images/exif-orientation-element-object-fit.html [ ImageOnlyFailure ]
    1861 webkit.org/b/201982 fast/images/exif-orientation-element.html [ ImageOnlyFailure ]
    1862 webkit.org/b/201982 fast/images/exif-orientation-image-document.html [ ImageOnlyFailure ]
    1863 webkit.org/b/201982 fast/images/exif-orientation-image-object.html [ ImageOnlyFailure ]
    1864 webkit.org/b/201982 fast/images/exif-orientation-svg-feimage.html [ ImageOnlyFailure ]
    1865 webkit.org/b/201982 fast/images/exif-orientation-svg-image.html [ ImageOnlyFailure ]
    1866 webkit.org/b/201982 fast/images/exif-orientation-webgl-texture.html [ ImageOnlyFailure ]
    1867 webkit.org/b/201982 fast/images/image-orientation-dynamic-from-image.html [ ImageOnlyFailure ]
    1868 webkit.org/b/201982 fast/images/exif-orientation-background-image-no-repeat.html [ ImageOnlyFailure ]
    18691856webkit.org/b/201982 fast/images/exif-orientation-background-image-repeat.html [ ImageOnlyFailure ]
    18701857webkit.org/b/201982 fast/images/exif-orientation-border-image.html [ ImageOnlyFailure ]
  • trunk/Source/WebCore/ChangeLog

    r268173 r268176  
     12020-10-08  Lauro Moura  <lmoura@igalia.com>
     2
     3        [GTK][WPE] Missing Exif Orientation support
     4        https://bugs.webkit.org/show_bug.cgi?id=95299
     5
     6        Reviewed by Carlos Alberto Lopez Perez.
     7
     8        CairoOperations::drawSurface is not taking 90/270 degrees orientation
     9        changes in account correctly.
     10
     11        As in these operations the size of the surfaces will be the same but
     12        not exactly equal (by transposing width and height), drawSurface
     13        currently wrongly presumes the need for some some padding. The same
     14        happens to the scale factors.
     15
     16        Covered by existing tests.
     17
     18        * platform/graphics/cairo/CairoOperations.cpp:
     19        (WebCore::Cairo::drawNativeImage): Forward usesWidthAsHeight to
     20        drawSurface.
     21        (WebCore::Cairo::drawSurface): use correct scaling/padding when
     22        getting surfaces from images rotated 90/270 degrees.
     23        * platform/graphics/cairo/CairoOperations.h: Add new enum to forward
     24        Orientation.usesWidthAsHeight.
     25
    1262020-10-07  Antoine Quint  <graouts@webkit.org>
    227
  • trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp

    r265648 r268176  
    884884    }
    885885
    886     drawSurface(platformContext, surface, dst, srcRect, options.interpolationQuality(), globalAlpha, shadowState);
     886    auto orientationSizing = options.orientation().usesWidthAsHeight() ? OrientationSizing::WidthAsHeight : OrientationSizing::Normal;
     887    drawSurface(platformContext, surface, dst, srcRect, options.interpolationQuality(), globalAlpha, shadowState, orientationSizing);
    887888    platformContext.restore();
    888889}
     
    894895}
    895896
    896 void drawSurface(PlatformContextCairo& platformContext, cairo_surface_t* surface, const FloatRect& destRect, const FloatRect& originalSrcRect, InterpolationQuality imageInterpolationQuality, float globalAlpha, const ShadowState& shadowState)
     897void drawSurface(PlatformContextCairo& platformContext, cairo_surface_t* surface, const FloatRect& destRect, const FloatRect& originalSrcRect, InterpolationQuality imageInterpolationQuality, float globalAlpha, const ShadowState& shadowState, OrientationSizing orientationSizing)
    897898{
    898899    // Avoid invalid cairo matrix with small values.
     
    915916    float leftPadding = 0;
    916917    float topPadding = 0;
    917     if (srcRect.x() || srcRect.y() || srcRect.size() != cairoSurfaceSize(surface)) {
     918    auto surfaceSize = cairoSurfaceSize(surface);
     919    bool didUseWidthAsHeight = orientationSizing == OrientationSizing::WidthAsHeight;
     920    bool differentSize = srcRect.size() != (didUseWidthAsHeight ? surfaceSize.transposedSize() : surfaceSize);
     921    if (srcRect.x() || srcRect.y() || differentSize) {
    918922        // Cairo subsurfaces don't support floating point boundaries well, so we expand the rectangle.
    919923        IntRect expandedSrcRect(enclosingIntRect(srcRect));
     
    950954    // by expanding floating point source rectangle sizes. It's important to take the absolute value
    951955    // of the scale since the original width and height might be negative.
    952     float scaleX = std::fabs(srcRect.width() / destRect.width());
    953     float scaleY = std::fabs(srcRect.height() / destRect.height());
     956    float scaleX = 1;
     957    float scaleY = 1;
     958    if (didUseWidthAsHeight) {
     959        scaleX = std::fabs(srcRect.width() / destRect.height());
     960        scaleY = std::fabs(srcRect.height() / destRect.width());
     961    } else {
     962        scaleX = std::fabs(srcRect.width() / destRect.width());
     963        scaleY = std::fabs(srcRect.height() / destRect.height());
     964    }
    954965    cairo_matrix_t matrix = { scaleX, 0, 0, scaleY, leftPadding, topPadding };
    955966    cairo_pattern_set_matrix(pattern.get(), &matrix);
  • trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.h

    r254506 r268176  
    7272} // namespace State
    7373
     74enum class OrientationSizing {
     75    Normal,
     76    WidthAsHeight
     77};
     78
    7479struct FillSource {
    7580    FillSource() = default;
     
    141146void drawNativeImage(PlatformContextCairo&, cairo_surface_t*, const FloatRect&, const FloatRect&, const ImagePaintingOptions&, float, const ShadowState&);
    142147void drawPattern(PlatformContextCairo&, cairo_surface_t*, const IntSize&, const FloatRect&, const FloatRect&, const AffineTransform&, const FloatPoint&, const ImagePaintingOptions&);
    143 WEBCORE_EXPORT void drawSurface(PlatformContextCairo&, cairo_surface_t*, const FloatRect&, const FloatRect&, InterpolationQuality, float, const ShadowState&);
     148WEBCORE_EXPORT void drawSurface(PlatformContextCairo&, cairo_surface_t*, const FloatRect&, const FloatRect&, InterpolationQuality, float, const ShadowState&, OrientationSizing operationSizing = OrientationSizing::Normal);
    144149
    145150void drawRect(PlatformContextCairo&, const FloatRect&, float, const Color&, StrokeStyle, const Color&);
Note: See TracChangeset for help on using the changeset viewer.