Changeset 214646 in webkit


Ignore:
Timestamp:
Mar 30, 2017, 6:36:20 PM (8 years ago)
Author:
Megan Gardner
Message:

Allow for extended color in snapshots
https://bugs.webkit.org/show_bug.cgi?id=170314
<rdar://problem/28676092> WKImageCreateCGImage should support WideGamut in WebKit2 on macOS

Reviewed by Simon Fraser.

Piping options through snapshots to allow for wide gamut support.

  • Shared/API/c/WKImage.h:
  • Shared/API/c/WKSharedAPICast.h:

(WebKit::snapshotOptionsFromImageOptions):

  • Shared/ImageOptions.h:

(WebKit::snapshotOptionsToImageOptions):

  • Shared/WebImage.cpp:

(WebKit::WebImage::create):

Location:
trunk/Source/WebKit2
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r214643 r214646  
     12017-03-30  Megan Gardner  <megan_gardner@apple.com>
     2
     3        Allow for extended color in snapshots
     4        https://bugs.webkit.org/show_bug.cgi?id=170314
     5        <rdar://problem/28676092> WKImageCreateCGImage should support WideGamut in WebKit2 on macOS
     6
     7        Reviewed by Simon Fraser.
     8
     9        Piping options through snapshots to allow for wide gamut support.
     10
     11        * Shared/API/c/WKImage.h:
     12        * Shared/API/c/WKSharedAPICast.h:
     13        (WebKit::snapshotOptionsFromImageOptions):
     14        * Shared/ImageOptions.h:
     15        (WebKit::snapshotOptionsToImageOptions):
     16        * Shared/WebImage.cpp:
     17        (WebKit::WebImage::create):
     18
    1192017-03-30  Sam Weinig  <sam@webkit.org>
    220
  • trunk/Source/WebKit2/Shared/API/c/WKImage.h

    r214297 r214646  
    4848    kWKSnapshotOptionsPrinting = 1 << 6,
    4949    kWKSnapshotOptionsExcludeOverflow = 1 << 7,
     50    kWKSnapshotOptionsExtendedColor = 1 << 8,
    5051};
    5152typedef uint32_t WKSnapshotOptions;
  • trunk/Source/WebKit2/Shared/API/c/WKSharedAPICast.h

    r212557 r214646  
    932932        snapshotOptions |= SnapshotOptionsShareable;
    933933
     934    if (wkImageOptions & kWKSnapshotOptionsExtendedColor)
     935        snapshotOptions |= SnapshotOptionsExtendedColor;
     936   
    934937    return snapshotOptions;
    935938}
  • trunk/Source/WebKit2/Shared/ImageOptions.h

    r190306 r214646  
    3131enum ImageOptions {
    3232    ImageOptionsShareable = 1 << 0,
     33    ImageOptionsExtendedColor = 1 << 1,
    3334};
    3435
     
    4243    SnapshotOptionsForceWhiteText = 1 << 7,
    4344    SnapshotOptionsPrinting = 1 << 8,
     45    SnapshotOptionsExtendedColor = 1 << 9,
    4446};
    4547typedef uint32_t SnapshotOptions;
     
    5254    if (snapshotOptions & SnapshotOptionsShareable)
    5355        imageOptions |= ImageOptionsShareable;
     56   
     57    if (snapshotOptions & SnapshotOptionsExtendedColor)
     58        imageOptions |= ImageOptionsExtendedColor;
     59   
    5460
    5561    return static_cast<ImageOptions>(imageOptions);
  • trunk/Source/WebKit2/Shared/WebImage.cpp

    r210181 r214646  
    3535RefPtr<WebImage> WebImage::create(const IntSize& size, ImageOptions options)
    3636{
     37    int sharableOptions = ShareableBitmap::SupportsAlpha;
     38   
     39    if (options & ImageOptionsExtendedColor)
     40        sharableOptions |= ShareableBitmap::SupportsExtendedColor;
    3741    if (options & ImageOptionsShareable) {
    38         auto bitmap = ShareableBitmap::createShareable(size, ShareableBitmap::SupportsAlpha);
     42        auto bitmap = ShareableBitmap::createShareable(size, sharableOptions);
    3943        if (!bitmap)
    4044            return nullptr;
    4145        return WebImage::create(bitmap.releaseNonNull());
    4246    }
    43     auto bitmap = ShareableBitmap::create(size, ShareableBitmap::SupportsAlpha);
     47    auto bitmap = ShareableBitmap::create(size, sharableOptions);
    4448    if (!bitmap)
    4549        return nullptr;
Note: See TracChangeset for help on using the changeset viewer.