Changeset 237394 in webkit


Ignore:
Timestamp:
Oct 24, 2018 11:46:39 AM (6 years ago)
Author:
Brent Fulgham
Message:

Cure Windows Direct2D Backend of a nasty case of bitrot
https://bugs.webkit.org/show_bug.cgi?id=190875
<rdar://problem/45523268>

Reviewed by Zalan Bujtas.

The Direct2D backend has drifted out of date with the rest of WebKit.
This patch updates things so we can get a runnable build.

  • platform/graphics/FontPlatformData.h:
  • platform/graphics/ImageBuffer.cpp:

(WebCore::ImageBuffer::create):

  • platform/graphics/ImageBuffer.h:
  • platform/graphics/ImageDecoder.h:
  • platform/graphics/ImageSource.cpp:

(WebCore::ImageSource::setTargetContext):

  • platform/graphics/opentype/OpenTypeMathData.cpp:

(WebCore::OpenTypeMathData::OpenTypeMathData): Need non-default constructor to make Visual
Studio happy.

  • platform/graphics/win/GradientDirect2D.cpp:

(WebCore::Gradient::generateGradient):

  • platform/graphics/win/GraphicsContextDirect2D.cpp: Update for new display list implementation.

(WebCore::GraphicsContextPlatformPrivate::setAlpha):
(WebCore::GraphicsContext::savePlatformState):
(WebCore::GraphicsContext::restorePlatformState):
(WebCore::GraphicsContext::drawNativeImage):
(WebCore::GraphicsContext::drawPattern):
(WebCore::GraphicsContext::drawRect):
(WebCore::GraphicsContext::drawLine):
(WebCore::GraphicsContext::drawEllipse):
(WebCore::GraphicsContext::drawPath):
(WebCore::GraphicsContext::fillPath):
(WebCore::GraphicsContext::strokePath):
(WebCore::GraphicsContext::fillRect):
(WebCore::GraphicsContext::platformFillRoundedRect):
(WebCore::GraphicsContext::fillRectWithRoundedHole):
(WebCore::GraphicsContext::clip):
(WebCore::GraphicsContext::clipOut):
(WebCore::GraphicsContext::clipPath):
(WebCore::GraphicsContext::clipBounds const):
(WebCore::GraphicsContext::beginPlatformTransparencyLayer):
(WebCore::GraphicsContext::endPlatformTransparencyLayer):
(WebCore::GraphicsContext::setMiterLimit):
(WebCore::GraphicsContext::clearRect):
(WebCore::GraphicsContext::strokeRect):
(WebCore::GraphicsContext::setLineCap):
(WebCore::GraphicsContext::setLineDash):
(WebCore::GraphicsContext::setLineJoin):
(WebCore::GraphicsContext::scale):
(WebCore::GraphicsContext::rotate):
(WebCore::GraphicsContext::translate):
(WebCore::GraphicsContext::concatCTM):
(WebCore::GraphicsContext::setCTM):
(WebCore::GraphicsContext::getCTM const):
(WebCore::GraphicsContext::roundToDevicePixels):
(WebCore::GraphicsContext::drawLinesForText):
(WebCore::GraphicsContext::setURLForRect):
(WebCore::GraphicsContext::setIsCALayerContext):
(WebCore::GraphicsContext::isCALayerContext const):
(WebCore::GraphicsContext::setIsAcceleratedContext):
(WebCore::GraphicsContext::isAcceleratedContext const):
(WebCore::GraphicsContext::setPlatformShouldAntialias):
(WebCore::GraphicsContext::setPlatformShouldSmoothFonts):
(WebCore::GraphicsContext::setPlatformCompositeOperation):
(WebCore::GraphicsContext::platformFillEllipse):
(WebCore::GraphicsContext::platformStrokeEllipse):

  • platform/graphics/win/GraphicsLayerDirect2D.cpp:

(WebCore::GraphicsLayer::create):
(): Deleted.

  • platform/graphics/win/ImageBufferDataDirect2D.cpp:

(WebCore::ImageBufferData::putData):

  • platform/graphics/win/ImageBufferDataDirect2D.h:
  • platform/graphics/win/ImageBufferDirect2D.cpp:

(WebCore::ImageBuffer::createCompatibleBuffer):
(WebCore::ImageBuffer::ImageBuffer):

  • platform/graphics/win/ImageDecoderDirect2D.cpp:

(WebCore::ImageDecoderDirect2D::bytesDecodedToDetermineProperties const):
(WebCore::ImageDecoderDirect2D::encodedDataStatus const):
(WebCore::ImageDecoderDirect2D::repetitionCount const):
(WebCore::ImageDecoderDirect2D::frameOrientationAtIndex const):
(WebCore::ImageDecoderDirect2D::frameDurationAtIndex const):
(WebCore::ImageDecoderDirect2D::frameAllowSubsamplingAtIndex const):
(WebCore::ImageDecoderDirect2D::frameHasAlphaAtIndex const):
(WebCore::ImageDecoderDirect2D::createFrameImageAtIndex):
(WebCore::ImageDecoderDirect2D::setData):
(WebCore::ImageDecoderDirect2D::bytesDecodedToDetermineProperties): Deleted.
(WebCore::ImageDecoderDirect2D::createFrameImageAtIndex const): Deleted.

  • platform/graphics/win/ImageDecoderDirect2D.h:
  • platform/graphics/win/ImageDirect2D.cpp:

(WebCore::BitmapImage::drawFrameMatchingSourceSize):

  • platform/graphics/win/PatternDirect2D.cpp:

(WebCore::Pattern::createPlatformPattern const):

Location:
trunk/Source/WebCore
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r237393 r237394  
     12018-10-24  Brent Fulgham  <bfulgham@apple.com>
     2
     3        Cure Windows Direct2D Backend of a nasty case of bitrot
     4        https://bugs.webkit.org/show_bug.cgi?id=190875
     5        <rdar://problem/45523268>
     6       
     7        Reviewed by Zalan Bujtas.
     8
     9        The Direct2D backend has drifted out of date with the rest of WebKit.
     10        This patch updates things so we can get a runnable build.
     11       
     12        * platform/graphics/FontPlatformData.h:
     13        * platform/graphics/ImageBuffer.cpp:
     14        (WebCore::ImageBuffer::create):
     15        * platform/graphics/ImageBuffer.h:
     16        * platform/graphics/ImageDecoder.h:
     17        * platform/graphics/ImageSource.cpp:
     18        (WebCore::ImageSource::setTargetContext):
     19        * platform/graphics/opentype/OpenTypeMathData.cpp:
     20        (WebCore::OpenTypeMathData::OpenTypeMathData): Need non-default constructor to make Visual
     21        Studio happy.
     22        * platform/graphics/win/GradientDirect2D.cpp:
     23        (WebCore::Gradient::generateGradient):
     24        * platform/graphics/win/GraphicsContextDirect2D.cpp: Update for new display list implementation.
     25        (WebCore::GraphicsContextPlatformPrivate::setAlpha):
     26        (WebCore::GraphicsContext::savePlatformState):
     27        (WebCore::GraphicsContext::restorePlatformState):
     28        (WebCore::GraphicsContext::drawNativeImage):
     29        (WebCore::GraphicsContext::drawPattern):
     30        (WebCore::GraphicsContext::drawRect):
     31        (WebCore::GraphicsContext::drawLine):
     32        (WebCore::GraphicsContext::drawEllipse):
     33        (WebCore::GraphicsContext::drawPath):
     34        (WebCore::GraphicsContext::fillPath):
     35        (WebCore::GraphicsContext::strokePath):
     36        (WebCore::GraphicsContext::fillRect):
     37        (WebCore::GraphicsContext::platformFillRoundedRect):
     38        (WebCore::GraphicsContext::fillRectWithRoundedHole):
     39        (WebCore::GraphicsContext::clip):
     40        (WebCore::GraphicsContext::clipOut):
     41        (WebCore::GraphicsContext::clipPath):
     42        (WebCore::GraphicsContext::clipBounds const):
     43        (WebCore::GraphicsContext::beginPlatformTransparencyLayer):
     44        (WebCore::GraphicsContext::endPlatformTransparencyLayer):
     45        (WebCore::GraphicsContext::setMiterLimit):
     46        (WebCore::GraphicsContext::clearRect):
     47        (WebCore::GraphicsContext::strokeRect):
     48        (WebCore::GraphicsContext::setLineCap):
     49        (WebCore::GraphicsContext::setLineDash):
     50        (WebCore::GraphicsContext::setLineJoin):
     51        (WebCore::GraphicsContext::scale):
     52        (WebCore::GraphicsContext::rotate):
     53        (WebCore::GraphicsContext::translate):
     54        (WebCore::GraphicsContext::concatCTM):
     55        (WebCore::GraphicsContext::setCTM):
     56        (WebCore::GraphicsContext::getCTM const):
     57        (WebCore::GraphicsContext::roundToDevicePixels):
     58        (WebCore::GraphicsContext::drawLinesForText):
     59        (WebCore::GraphicsContext::setURLForRect):
     60        (WebCore::GraphicsContext::setIsCALayerContext):
     61        (WebCore::GraphicsContext::isCALayerContext const):
     62        (WebCore::GraphicsContext::setIsAcceleratedContext):
     63        (WebCore::GraphicsContext::isAcceleratedContext const):
     64        (WebCore::GraphicsContext::setPlatformShouldAntialias):
     65        (WebCore::GraphicsContext::setPlatformShouldSmoothFonts):
     66        (WebCore::GraphicsContext::setPlatformCompositeOperation):
     67        (WebCore::GraphicsContext::platformFillEllipse):
     68        (WebCore::GraphicsContext::platformStrokeEllipse):
     69        * platform/graphics/win/GraphicsLayerDirect2D.cpp:
     70        (WebCore::GraphicsLayer::create):
     71        (): Deleted.
     72        * platform/graphics/win/ImageBufferDataDirect2D.cpp:
     73        (WebCore::ImageBufferData::putData):
     74        * platform/graphics/win/ImageBufferDataDirect2D.h:
     75        * platform/graphics/win/ImageBufferDirect2D.cpp:
     76        (WebCore::ImageBuffer::createCompatibleBuffer):
     77        (WebCore::ImageBuffer::ImageBuffer):
     78        * platform/graphics/win/ImageDecoderDirect2D.cpp:
     79        (WebCore::ImageDecoderDirect2D::bytesDecodedToDetermineProperties const):
     80        (WebCore::ImageDecoderDirect2D::encodedDataStatus const):
     81        (WebCore::ImageDecoderDirect2D::repetitionCount const):
     82        (WebCore::ImageDecoderDirect2D::frameOrientationAtIndex const):
     83        (WebCore::ImageDecoderDirect2D::frameDurationAtIndex const):
     84        (WebCore::ImageDecoderDirect2D::frameAllowSubsamplingAtIndex const):
     85        (WebCore::ImageDecoderDirect2D::frameHasAlphaAtIndex const):
     86        (WebCore::ImageDecoderDirect2D::createFrameImageAtIndex):
     87        (WebCore::ImageDecoderDirect2D::setData):
     88        (WebCore::ImageDecoderDirect2D::bytesDecodedToDetermineProperties): Deleted.
     89        (WebCore::ImageDecoderDirect2D::createFrameImageAtIndex const): Deleted.
     90        * platform/graphics/win/ImageDecoderDirect2D.h:
     91        * platform/graphics/win/ImageDirect2D.cpp:
     92        (WebCore::BitmapImage::drawFrameMatchingSourceSize):
     93        * platform/graphics/win/PatternDirect2D.cpp:
     94        (WebCore::Pattern::createPlatformPattern const):
     95
    1962018-10-24  Said Abou-Hallawa  <sabouhallawa@apple.com>
    297
  • trunk/Source/WebCore/platform/graphics/FontPlatformData.h

    r237266 r237394  
    11/*
    2  * Copyright (C) 2006-2017 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006-2018 Apple Inc. All rights reserved.
    33 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
    44 * Copyright (C) 2007 Holger Hans Peter Freyther
     
    6464#endif
    6565
     66#if USE(DIRECT2D)
     67#include <dwrite.h>
     68#endif
     69
    6670namespace WebCore {
    6771
  • trunk/Source/WebCore/platform/graphics/ImageBuffer.cpp

    r232796 r237394  
    22 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
    33 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
    4  * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
     4 * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
    55 *
    66 * Redistribution and use in source and binary forms, with or without
     
    4949
    5050#if USE(DIRECT2D)
    51 std::unique_ptr<ImageBuffer> ImageBuffer::create(const FloatSize& size, RenderingMode renderingMode, const GraphicsContext* targetContext, float resolutionScale, ColorSpace colorSpace)
     51std::unique_ptr<ImageBuffer> ImageBuffer::create(const FloatSize& size, RenderingMode renderingMode, const GraphicsContext* targetContext, float resolutionScale, ColorSpace colorSpace, const HostWindow* hostWindow)
    5252{
    5353    bool success = false;
    54     std::unique_ptr<ImageBuffer> buffer(new ImageBuffer(size, resolutionScale, colorSpace, renderingMode, targetContext, success));
     54    std::unique_ptr<ImageBuffer> buffer(new ImageBuffer(size, resolutionScale, colorSpace, renderingMode, hostWindow, targetContext, success));
    5555    if (!success)
    5656        return nullptr;
  • trunk/Source/WebCore/platform/graphics/ImageBuffer.h

    r237276 r237394  
    11/*
    22 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
    3  * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
     3 * Copyright (C) 2007-2018 Apple Inc. All rights reserved.
    44 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
    55 *
     
    6969    WEBCORE_EXPORT static std::unique_ptr<ImageBuffer> create(const FloatSize&, RenderingMode, float resolutionScale = 1, ColorSpace = ColorSpaceSRGB, const HostWindow* = nullptr);
    7070#if USE(DIRECT2D)
    71     WEBCORE_EXPORT static std::unique_ptr<ImageBuffer> create(const FloatSize&, RenderingMode, const GraphicsContext*, float resolutionScale = 1, ColorSpace = ColorSpaceSRGB);
     71    WEBCORE_EXPORT static std::unique_ptr<ImageBuffer> create(const FloatSize&, RenderingMode, const GraphicsContext*, float resolutionScale = 1, ColorSpace = ColorSpaceSRGB, const HostWindow* = nullptr);
    7272#endif
    7373
     
    172172    RetainPtr<CFDataRef> toCFData(const String& mimeType, std::optional<double> quality, PreserveResolution) const;
    173173#elif USE(DIRECT2D)
    174     ImageBuffer(const FloatSize&, float resolutionScale, ColorSpace, RenderingMode, const GraphicsContext*, bool& success);
     174    ImageBuffer(const FloatSize&, float resolutionScale, ColorSpace, RenderingMode, const HostWindow*, const GraphicsContext*, bool& success);
    175175#endif
    176176};
  • trunk/Source/WebCore/platform/graphics/ImageDecoder.h

    r225616 r237394  
    11/*
    2  * Copyright (C) 2017 Apple Inc. All rights reserved.
     2 * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    8080    virtual void clearFrameBufferCache(size_t) = 0;
    8181
     82#if USE(DIRECT2D)
     83    virtual void setTargetContext(ID2D1RenderTarget*) = 0;
     84#endif
     85
    8286protected:
    8387    ImageDecoder() = default;
  • trunk/Source/WebCore/platform/graphics/ImageSource.cpp

    r232802 r237394  
    3737#include <wtf/SystemTracing.h>
    3838
     39#if USE(DIRECT2D)
     40#include "GraphicsContext.h"
     41#endif
     42
    3943namespace WebCore {
    4044
     
    639643{
    640644    if (isDecoderAvailable() && targetContext)
    641         m_decoder->setTargetContext(targetContext->platformContext())
     645        m_decoder->setTargetContext(targetContext->platformContext());
    642646}
    643647#endif
  • trunk/Source/WebCore/platform/graphics/opentype/OpenTypeMathData.cpp

    r228524 r237394  
    263263        m_mathFont = nullptr;
    264264}
     265#elif USE(DIRECT2D)
     266OpenTypeMathData::OpenTypeMathData(const FontPlatformData& font)
     267{
     268}
    265269#else
    266270OpenTypeMathData::OpenTypeMathData(const FontPlatformData&) = default;
  • trunk/Source/WebCore/platform/graphics/win/GradientDirect2D.cpp

    r235774 r237394  
    11/*
    2  * Copyright (C) 2016 Apple Inc.  All rights reserved.
     2 * Copyright (C) 2016-2018 Apple Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    9595            float radiusY = radiusX / data.aspectRatio;
    9696            hr = renderTarget->CreateRadialGradientBrush(
    97                 D2D1::RadialGradientBrushProperties(p0(), D2D1::Point2F(offset.width(), offset.height()), radiusX, radiusY),
     97                D2D1::RadialGradientBrushProperties(data.point0, D2D1::Point2F(offset.width(), offset.height()), radiusX, radiusY),
    9898                D2D1::BrushProperties(), gradientStopCollection.get(),
    9999                &radialGradient);
  • trunk/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp

    r235378 r237394  
    11/*
    2  * Copyright (C) 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    179179{
    180180    ASSERT(!paintingDisabled());
    181     ASSERT(!isRecording());
     181    ASSERT(!m_impl);
    182182
    183183    // Note: Do not use this function within this class implementation, since we want to avoid the extra
     
    189189{
    190190    ASSERT(!paintingDisabled());
    191     ASSERT(!isRecording());
     191    ASSERT(!m_impl);
    192192
    193193    // Note: Do not use this function within this class implementation, since we want to avoid the extra
     
    202202        return;
    203203
    204     if (isRecording()) {
     204    if (m_impl) {
    205205        // FIXME: Implement DisplayListRecorder support for drawNativeImage.
    206206        // m_displayListRecorder->drawNativeImage(image, imageSize, destRect, srcRect, op, blendMode, orientation);
     
    552552        return;
    553553
    554     if (isRecording()) {
    555         m_displayListRecorder->drawPattern(image, destRect, tileRect, patternTransform, phase, spacing, op, blendMode);
     554    if (m_impl) {
     555        m_impl->drawPattern(image, destRect, tileRect, patternTransform, phase, spacing, op, blendMode);
    556556        return;
    557557    }
     
    619619        return;
    620620
    621     if (isRecording()) {
    622         m_displayListRecorder->drawRect(rect, borderThickness);
     621    if (m_impl) {
     622        m_impl->drawRect(rect, borderThickness);
    623623        return;
    624624    }
     
    790790        return;
    791791
    792     if (isRecording()) {
    793         m_displayListRecorder->drawLine(point1, point2);
     792    if (m_impl) {
     793        m_impl->drawLine(point1, point2);
    794794        return;
    795795    }
     
    848848        return;
    849849
    850     if (isRecording()) {
    851         m_displayListRecorder->drawEllipse(rect);
     850    if (m_impl) {
     851        m_impl->drawEllipse(rect);
    852852        return;
    853853    }
     
    895895        return;
    896896
    897     if (isRecording()) {
    898         m_displayListRecorder->drawPath(path);
     897    if (m_impl) {
     898        m_impl->drawPath(path);
    899899        return;
    900900    }
     
    10031003        return;
    10041004
    1005     if (isRecording()) {
    1006         m_displayListRecorder->fillPath(path);
     1005    if (m_impl) {
     1006        m_impl->fillPath(path);
    10071007        return;
    10081008    }
     
    10241024
    10251025        FloatRect boundingRect = path.fastBoundingRect();
    1026         auto drawFunction = [this, &path](ID2D1RenderTarget* renderTarget) {
     1026        WTF::Function<void(ID2D1RenderTarget*)> drawFunction = [this, &path](ID2D1RenderTarget* renderTarget) {
    10271027            renderTarget->FillGeometry(path.platformPath(), m_state.fillGradient->createPlatformGradientIfNecessary(renderTarget));
    10281028        };
     
    10571057        return;
    10581058
    1059     if (isRecording()) {
    1060         m_displayListRecorder->strokePath(path);
     1059    if (m_impl) {
     1060        m_impl->strokePath(path);
    10611061        return;
    10621062    }
     
    10711071        D2DContextStateSaver stateSaver(*m_data);
    10721072        auto boundingRect = path.fastBoundingRect();
    1073         auto drawFunction = [this, &path](ID2D1RenderTarget* renderTarget) {
     1073        WTF::Function<void(ID2D1RenderTarget*)> drawFunction = [this, &path](ID2D1RenderTarget* renderTarget) {
    10741074            renderTarget->DrawGeometry(path.platformPath(), m_state.strokeGradient->createPlatformGradientIfNecessary(renderTarget));
    10751075        };
     
    11021102        return;
    11031103
    1104     if (isRecording()) {
    1105         m_displayListRecorder->fillRect(rect);
     1104    if (m_impl) {
     1105        m_impl->fillRect(rect);
    11061106        return;
    11071107    }
     
    11121112        context->SetTags(1, __LINE__);
    11131113        D2DContextStateSaver stateSaver(*m_data);
    1114         auto drawFunction = [this, rect](ID2D1RenderTarget* renderTarget) {
     1114        WTF::Function<void(ID2D1RenderTarget*)> drawFunction = [this, rect](ID2D1RenderTarget* renderTarget) {
    11151115            const D2D1_RECT_F d2dRect = rect;
    11161116            renderTarget->FillRectangle(&d2dRect, m_state.fillGradient->createPlatformGradientIfNecessary(renderTarget));
     
    11491149        return;
    11501150
    1151     if (isRecording()) {
    1152         m_displayListRecorder->fillRect(rect, color);
     1151    if (m_impl) {
     1152        m_impl->fillRect(rect, color);
    11531153        return;
    11541154    }
     
    11771177        return;
    11781178
    1179     ASSERT(!isRecording());
     1179    ASSERT(!m_impl);
    11801180
    11811181    auto context = platformContext();
     
    12181218        return;
    12191219
    1220     if (isRecording()) {
    1221         m_displayListRecorder->fillRectWithRoundedHole(rect, roundedHoleRect, color);
     1220    if (m_impl) {
     1221        m_impl->fillRectWithRoundedHole(rect, roundedHoleRect, color);
    12221222        return;
    12231223    }
     
    12651265        return;
    12661266
    1267     if (isRecording()) {
    1268         m_displayListRecorder->clip(rect);
     1267    if (m_impl) {
     1268        m_impl->clip(rect);
    12691269        return;
    12701270    }
     
    12781278        return;
    12791279
    1280     if (isRecording()) {
    1281         m_displayListRecorder->clipOut(rect);
     1280    if (m_impl) {
     1281        m_impl->clipOut(rect);
    12821282        return;
    12831283    }
     
    12941294        return;
    12951295
    1296     if (isRecording()) {
    1297         m_displayListRecorder->clipOut(path);
     1296    if (m_impl) {
     1297        m_impl->clipOut(path);
    12981298        return;
    12991299    }
     
    13191319        return;
    13201320
    1321     if (isRecording()) {
    1322         m_displayListRecorder->clipPath(path, clipRule);
     1321    if (m_impl) {
     1322        m_impl->clipPath(path, clipRule);
    13231323        return;
    13241324    }
     
    13411341        return IntRect();
    13421342
    1343     if (isRecording()) {
     1343    if (m_impl) {
    13441344        WTFLogAlways("Getting the clip bounds not yet supported with display lists");
    13451345        return IntRect(-2048, -2048, 4096, 4096); // FIXME: display lists.
     
    13751375        return;
    13761376
    1377     ASSERT(!isRecording());
     1377    ASSERT(!m_impl);
    13781378
    13791379    save();
     
    14221422    m_data->endTransparencyLayer();
    14231423
    1424     ASSERT(!isRecording());
     1424    ASSERT(!m_impl);
    14251425
    14261426    m_state.alpha = m_data->currentGlobalAlpha();
     
    14621462        return;
    14631463
    1464     if (isRecording()) {
     1464    if (m_impl) {
    14651465        // Maybe this should be part of the state.
    1466         m_displayListRecorder->setMiterLimit(limit);
     1466        m_impl->setMiterLimit(limit);
    14671467        return;
    14681468    }
     
    14761476        return;
    14771477
    1478     if (isRecording()) {
    1479         m_displayListRecorder->clearRect(rect);
     1478    if (m_impl) {
     1479        m_impl->clearRect(rect);
    14801480        return;
    14811481    }
     
    15051505        return;
    15061506
    1507     if (isRecording()) {
    1508         m_displayListRecorder->strokeRect(rect, lineWidth);
     1507    if (m_impl) {
     1508        m_impl->strokeRect(rect, lineWidth);
    15091509        return;
    15101510    }
    15111511
    15121512    if (m_state.strokeGradient) {
    1513         auto drawFunction = [this, rect, lineWidth](ID2D1RenderTarget* renderTarget) {
     1513        WTF::Function<void(ID2D1RenderTarget*)> drawFunction = [this, rect, lineWidth](ID2D1RenderTarget* renderTarget) {
    15141514            renderTarget->SetTags(1, __LINE__);
    15151515            const D2D1_RECT_F d2dRect = rect;
     
    15401540        return;
    15411541
    1542     if (isRecording()) {
    1543         m_displayListRecorder->setLineCap(cap);
     1542    if (m_impl) {
     1543        m_impl->setLineCap(cap);
    15441544        return;
    15451545    }
     
    15531553        return;
    15541554
    1555     if (isRecording()) {
    1556         m_displayListRecorder->setLineDash(dashes, dashOffset);
     1555    if (m_impl) {
     1556        m_impl->setLineDash(dashes, dashOffset);
    15571557        return;
    15581558    }
     
    15751575        return;
    15761576
    1577     if (isRecording()) {
    1578         m_displayListRecorder->setLineJoin(join);
     1577    if (m_impl) {
     1578        m_impl->setLineJoin(join);
    15791579        return;
    15801580    }
     
    15931593        return;
    15941594
    1595     if (isRecording()) {
    1596         m_displayListRecorder->scale(size);
     1595    if (m_impl) {
     1596        m_impl->scale(size);
    15971597        return;
    15981598    }
     
    16071607        return;
    16081608
    1609     if (isRecording()) {
    1610         m_displayListRecorder->rotate(angle);
     1609    if (m_impl) {
     1610        m_impl->rotate(angle);
    16111611        return;
    16121612    }
     
    16211621        return;
    16221622
    1623     if (isRecording()) {
    1624         m_displayListRecorder->translate(x, y);
     1623    if (m_impl) {
     1624        m_impl->translate(x, y);
    16251625        return;
    16261626    }
     
    16351635        return;
    16361636
    1637     if (isRecording()) {
    1638         m_displayListRecorder->concatCTM(transform);
     1637    if (m_impl) {
     1638        m_impl->concatCTM(transform);
    16391639        return;
    16401640    }
     
    16491649        return;
    16501650
    1651     if (isRecording()) {
     1651    if (m_impl) {
    16521652        WTFLogAlways("GraphicsContext::setCTM() is not compatible with recording contexts.");
    16531653        return;
     
    16631663        return AffineTransform();
    16641664
    1665     if (isRecording()) {
     1665    if (m_impl) {
    16661666        WTFLogAlways("GraphicsContext::getCTM() is not yet compatible with recording contexts.");
    16671667        return AffineTransform();
     
    16781678        return rect;
    16791679
    1680     if (isRecording()) {
     1680    if (m_impl) {
    16811681        WTFLogAlways("GraphicsContext::roundToDevicePixels() is not yet compatible with recording contexts.");
    16821682        return rect;
     
    17041704        return;
    17051705
    1706     if (isRecording()) {
    1707         m_displayListRecorder->drawLinesForText(point, widths, printing, doubleLines, strokeThickness());
     1706    if (m_impl) {
     1707        m_impl->drawLinesForText(point, widths, printing, doubleLines, strokeThickness());
    17081708        return;
    17091709    }
     
    17171717        return;
    17181718
    1719     if (isRecording()) {
     1719    if (m_impl) {
    17201720        WTFLogAlways("GraphicsContext::setURLForRect() is not yet compatible with recording contexts.");
    17211721        return; // FIXME for display lists.
     
    17601760        return;
    17611761
    1762     if (isRecording())
     1762    if (m_impl)
    17631763        return;
    17641764
     
    17731773
    17741774    // FIXME
    1775     if (isRecording())
     1775    if (m_impl)
    17761776        return false;
    17771777
     
    17871787
    17881788    // FIXME
    1789     if (isRecording())
     1789    if (m_impl)
    17901790        return;
    17911791
     
    17991799
    18001800    // FIXME
    1801     if (isRecording())
     1801    if (m_impl)
    18021802        return false;
    18031803
     
    18421842        return;
    18431843
    1844     ASSERT(!isRecording());
     1844    ASSERT(!m_impl);
    18451845
    18461846    auto antialiasMode = enable ? D2D1_ANTIALIAS_MODE_PER_PRIMITIVE : D2D1_ANTIALIAS_MODE_ALIASED;
     
    18531853        return;
    18541854
    1855     ASSERT(!isRecording());
     1855    ASSERT(!m_impl);
    18561856
    18571857    auto fontSmoothingMode = enable ? D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE : D2D1_TEXT_ANTIALIAS_MODE_ALIASED;
     
    18731873        return;
    18741874
    1875     ASSERT(!isRecording());
     1875    ASSERT(!m_impl);
    18761876
    18771877    D2D1_BLEND_MODE targetBlendMode = D2D1_BLEND_MODE_SCREEN;
     
    19951995        return;
    19961996
    1997     ASSERT(!isRecording());
     1997    ASSERT(!m_impl);
    19981998
    19991999    if (m_state.fillGradient || m_state.fillPattern) {
     
    20172017        return;
    20182018
    2019     ASSERT(!isRecording());
     2019    ASSERT(!m_impl);
    20202020
    20212021    if (m_state.strokeGradient || m_state.strokePattern) {
  • trunk/Source/WebCore/platform/graphics/win/GraphicsLayerDirect2D.cpp

    r236016 r237394  
    11/*
    2  * Copyright (C) 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5454        return layer;
    5555    }
    56    
    57     auto layer = adoptRef(*new GraphicsLayerCA(layerType, client);
    58     layer->initialize(layerType);
    59     return layer;
     56
     57    // FIXME: Return a real Direct2D graphics layer
     58    return adoptRef(*new GraphicsLayerDirect2D(layerType, client));
    6059}
    6160
  • trunk/Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.cpp

    r237009 r237394  
    11/*
    2  * Copyright (C) 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    148148                row[basex + 3] = alpha;
    149149            } else
    150                 reinterpret_cast<uint32_t*>(row.get() + basex)[0] = reinterpret_cast<uint32_t*>(srcRows + basex)[0];
     150                reinterpret_cast<uint32_t*>(row.get() + basex)[0] = reinterpret_cast<const uint32_t*>(srcRows + basex)[0];
    151151        }
    152152
  • trunk/Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.h

    r228218 r237394  
    11/*
    2  * Copyright (C) 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2323 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2424 */
     25
     26#pragma once
    2527
    2628#include "Image.h"
  • trunk/Source/WebCore/platform/graphics/win/ImageBufferDirect2D.cpp

    r233122 r237394  
    11/*
    2  * Copyright (C) 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    6363    IntSize scaledSize = ImageBuffer::compatibleBufferSize(size, context);
    6464    bool success = false;
    65     std::unique_ptr<ImageBuffer> buffer(new ImageBuffer(scaledSize, 1, ColorSpaceSRGB, renderingMode, &context, success));
     65    std::unique_ptr<ImageBuffer> buffer(new ImageBuffer(scaledSize, 1, ColorSpaceSRGB, renderingMode, nullptr, &context, success));
    6666
    6767    if (!success)
     
    7373}
    7474
    75 ImageBuffer::ImageBuffer(const FloatSize& size, float resolutionScale, ColorSpace /*colorSpace*/, RenderingMode renderingMode, const GraphicsContext* targetContext, bool& success)
     75ImageBuffer::ImageBuffer(const FloatSize& size, float resolutionScale, ColorSpace /*colorSpace*/, RenderingMode renderingMode, const HostWindow*, const GraphicsContext* targetContext, bool& success)
    7676    : m_logicalSize(size)
    7777    , m_resolutionScale(resolutionScale)
     
    116116}
    117117
    118 ImageBuffer::ImageBuffer(const FloatSize& size, float resolutionScale, ColorSpace imageColorSpace, RenderingMode renderingMode, bool& success)
    119     : ImageBuffer(size, resolutionScale, imageColorSpace, renderingMode, nullptr, success)
     118ImageBuffer::ImageBuffer(const FloatSize& size, float resolutionScale, ColorSpace imageColorSpace, RenderingMode renderingMode, const HostWindow*, bool& success)
     119    : ImageBuffer(size, resolutionScale, imageColorSpace, renderingMode, nullptr, nullptr, success)
    120120{
    121121}
  • trunk/Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.cpp

    r222151 r237394  
    11/*
    2  * Copyright (C) 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5757}
    5858
    59 size_t ImageDecoderDirect2D::bytesDecodedToDetermineProperties()
     59size_t ImageDecoderDirect2D::bytesDecodedToDetermineProperties() const
    6060{
    6161    // Set to match value used for CoreGraphics.
     
    7676EncodedDataStatus ImageDecoderDirect2D::encodedDataStatus() const
    7777{
    78     notImplemented();
    79     return EncodedDataStatus::Unknown;
     78    if (!m_nativeDecoder)
     79        return EncodedDataStatus::Error;
     80
     81    // FIXME: Hook into WIC decoder (if async decode is even possible)
     82    return EncodedDataStatus::Complete;
    8083}
    8184
     
    113116RepetitionCount ImageDecoderDirect2D::repetitionCount() const
    114117{
     118    if (!m_nativeDecoder)
     119        return RepetitionCountNone;
     120
     121    // FIXME: Identify image type, and determine proper repetition count.
    115122    return RepetitionCountNone;
    116123}
     
    151158ImageOrientation ImageDecoderDirect2D::frameOrientationAtIndex(size_t index) const
    152159{
    153     notImplemented();
     160    if (!m_nativeDecoder)
     161        return ImageOrientation();
     162
     163    COMPtr<IWICBitmapFrameDecode> frame;
     164    HRESULT hr = m_nativeDecoder->GetFrame(index, &frame);
     165    if (!SUCCEEDED(hr))
     166        return ImageOrientation();
     167
     168    COMPtr<IWICMetadataQueryReader> metadata;
     169    hr = frame->GetMetadataQueryReader(&metadata);
     170    if (!SUCCEEDED(hr))
     171        return ImageOrientation();
     172
     173    // FIXME: Identify image type, and ask proper orientation.
    154174    return ImageOrientation();
    155175}
    156176
    157 float ImageDecoderDirect2D::frameDurationAtIndex(size_t index) const
    158 {
    159     notImplemented();
    160     return 0;
    161 }
    162 
    163 bool ImageDecoderDirect2D::frameAllowSubsamplingAtIndex(size_t) const
    164 {
     177Seconds ImageDecoderDirect2D::frameDurationAtIndex(size_t index) const
     178{
     179    if (!m_nativeDecoder)
     180        return Seconds(0);
     181
     182    COMPtr<IWICBitmapFrameDecode> frame;
     183    HRESULT hr = m_nativeDecoder->GetFrame(index, &frame);
     184    if (!SUCCEEDED(hr))
     185        return Seconds(0);
     186
     187    // FIXME: Figure out correct image format-specific query for frame duration check.
     188    notImplemented();
     189    return Seconds(0);
     190}
     191
     192bool ImageDecoderDirect2D::frameAllowSubsamplingAtIndex(size_t index) const
     193{
     194    if (!m_nativeDecoder)
     195        return false;
     196
     197    COMPtr<IWICBitmapFrameDecode> frame;
     198    HRESULT hr = m_nativeDecoder->GetFrame(index, &frame);
     199    if (!SUCCEEDED(hr))
     200        return false;
     201
     202    // FIXME: Figure out correct image format-specific query for subsampling check.
    165203    notImplemented();
    166204    return true;
     
    169207bool ImageDecoderDirect2D::frameHasAlphaAtIndex(size_t index) const
    170208{
     209    if (!m_nativeDecoder)
     210        return false;
     211
     212    COMPtr<IWICBitmapFrameDecode> frame;
     213    HRESULT hr = m_nativeDecoder->GetFrame(index, &frame);
     214    if (!SUCCEEDED(hr))
     215        return false;
     216
     217    // FIXME: Figure out correct image format-specific query for alpha check.
    171218    notImplemented();
    172219    return true;
     
    187234}
    188235
    189 NativeImagePtr ImageDecoderDirect2D::createFrameImageAtIndex(size_t index, SubsamplingLevel subsamplingLevel, const DecodingOptions&) const
     236NativeImagePtr ImageDecoderDirect2D::createFrameImageAtIndex(size_t index, SubsamplingLevel subsamplingLevel, const DecodingOptions&)
    190237{
    191238    if (!m_nativeDecoder || !m_renderTarget)
     
    232279
    233280    hr = systemImagingFactory()->CreateDecoderFromStream(stream.get(), nullptr, WICDecodeMetadataCacheOnDemand, &m_nativeDecoder);
    234     ASSERT(SUCCEEDED(hr));
    235 }
    236 
     281    if (!SUCCEEDED(hr)) {
     282        m_nativeDecoder = nullptr;
     283        return;
     284    }
     285
     286    // Image was valid.
     287}
    237288}
    238289
  • trunk/Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.h

    r225616 r237394  
    11/*
    2  * Copyright (C) 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5050    static bool supportsMediaType(MediaType type) { return type == MediaType::Image; }
    5151
    52     static size_t bytesDecodedToDetermineProperties();
     52    size_t bytesDecodedToDetermineProperties() const final;
    5353
    5454    String filenameExtension() const final;
     
    6767    ImageOrientation frameOrientationAtIndex(size_t) const final;
    6868
    69     float frameDurationAtIndex(size_t) const final;
     69    Seconds frameDurationAtIndex(size_t) const final;
    7070    bool frameHasAlphaAtIndex(size_t) const final;
    7171    bool frameAllowSubsamplingAtIndex(size_t) const final;
    7272    unsigned frameBytesAtIndex(size_t, SubsamplingLevel = SubsamplingLevel::Default) const final;
    7373
    74     NativeImagePtr createFrameImageAtIndex(size_t, SubsamplingLevel = SubsamplingLevel::Default, const DecodingOptions& = DecodingOptions(DecodingMode::Synchronous)) const final;
     74    NativeImagePtr createFrameImageAtIndex(size_t, SubsamplingLevel = SubsamplingLevel::Default, const DecodingOptions& = DecodingOptions(DecodingMode::Synchronous)) final;
    7575
    7676    void setData(SharedBuffer&, bool allDataReceived) final;
  • trunk/Source/WebCore/platform/graphics/win/ImageDirect2D.cpp

    r234610 r237394  
    11/*
    2  * Copyright (C) 2006-2016 Apple Inc.  All rights reserved.
     2 * Copyright (C) 2006-2018 Apple Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    8282            size_t currentFrame = m_currentFrame;
    8383            m_currentFrame = i;
    84             draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, srcSize.width(), srcSize.height()), compositeOp, BlendMode::Normal, ImageOrientationDescription());
     84            draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, srcSize.width(), srcSize.height()), compositeOp, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientationDescription());
    8585            m_currentFrame = currentFrame;
    8686            return;
     
    9090    // No image of the correct size was found, fallback to drawing the current frame
    9191    FloatSize imageSize = BitmapImage::size();
    92     draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), compositeOp, BlendMode::Normal, ImageOrientationDescription());
     92    draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), compositeOp, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientationDescription());
    9393}
    9494
  • trunk/Source/WebCore/platform/graphics/win/PatternDirect2D.cpp

    r216702 r237394  
    4949    brushProperties.opacity = alpha;
    5050
    51     auto patternImage = tileImage();
     51    auto& patternImage = tileImage();
    5252
    5353    auto platformContext = context.platformContext();
Note: See TracChangeset for help on using the changeset viewer.