Cure Windows Direct2D Backend of a nasty case of bitrot
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Oct 2018 18:46:39 +0000 (18:46 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Oct 2018 18:46:39 +0000 (18:46 +0000)
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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237394 268f45cc-cd09-0410-ab3c-d52691b4dbfc

17 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/FontPlatformData.h
Source/WebCore/platform/graphics/ImageBuffer.cpp
Source/WebCore/platform/graphics/ImageBuffer.h
Source/WebCore/platform/graphics/ImageDecoder.h
Source/WebCore/platform/graphics/ImageSource.cpp
Source/WebCore/platform/graphics/opentype/OpenTypeMathData.cpp
Source/WebCore/platform/graphics/win/GradientDirect2D.cpp
Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp
Source/WebCore/platform/graphics/win/GraphicsLayerDirect2D.cpp
Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.cpp
Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.h
Source/WebCore/platform/graphics/win/ImageBufferDirect2D.cpp
Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.cpp
Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.h
Source/WebCore/platform/graphics/win/ImageDirect2D.cpp
Source/WebCore/platform/graphics/win/PatternDirect2D.cpp

index 38e6da2..47bc5d6 100644 (file)
@@ -1,3 +1,98 @@
+2018-10-24  Brent Fulgham  <bfulgham@apple.com>
+
+        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):
+
 2018-10-24  Said Abou-Hallawa  <sabouhallawa@apple.com>
 
         Cleanup: MIMETypeRegistry functions
index eb9862a..2750102 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2018 Apple Inc. All rights reserved.
  * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
  * Copyright (C) 2007 Holger Hans Peter Freyther
  * Copyright (C) 2007 Pioneer Research Center USA, Inc.
@@ -63,6 +63,10 @@ interface IDWriteFont;
 interface IDWriteFontFace;
 #endif
 
+#if USE(DIRECT2D)
+#include <dwrite.h>
+#endif
+
 namespace WebCore {
 
 class FontDescription;
index 97ba1ea..5c07eef 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
  * Copyright (C) Research In Motion Limited 2011. All rights reserved.
- * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -48,10 +48,10 @@ std::unique_ptr<ImageBuffer> ImageBuffer::create(const FloatSize& size, Renderin
 }
 
 #if USE(DIRECT2D)
-std::unique_ptr<ImageBuffer> ImageBuffer::create(const FloatSize& size, RenderingMode renderingMode, const GraphicsContext* targetContext, float resolutionScale, ColorSpace colorSpace)
+std::unique_ptr<ImageBuffer> ImageBuffer::create(const FloatSize& size, RenderingMode renderingMode, const GraphicsContext* targetContext, float resolutionScale, ColorSpace colorSpace, const HostWindow* hostWindow)
 {
     bool success = false;
-    std::unique_ptr<ImageBuffer> buffer(new ImageBuffer(size, resolutionScale, colorSpace, renderingMode, targetContext, success));
+    std::unique_ptr<ImageBuffer> buffer(new ImageBuffer(size, resolutionScale, colorSpace, renderingMode, hostWindow, targetContext, success));
     if (!success)
         return nullptr;
     return buffer;
index dcfb549..c7dc20a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
- * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-2018 Apple Inc. All rights reserved.
  * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -68,7 +68,7 @@ public:
     // Will return a null pointer on allocation failure.
     WEBCORE_EXPORT static std::unique_ptr<ImageBuffer> create(const FloatSize&, RenderingMode, float resolutionScale = 1, ColorSpace = ColorSpaceSRGB, const HostWindow* = nullptr);
 #if USE(DIRECT2D)
-    WEBCORE_EXPORT static std::unique_ptr<ImageBuffer> create(const FloatSize&, RenderingMode, const GraphicsContext*, float resolutionScale = 1, ColorSpace = ColorSpaceSRGB);
+    WEBCORE_EXPORT static std::unique_ptr<ImageBuffer> create(const FloatSize&, RenderingMode, const GraphicsContext*, float resolutionScale = 1, ColorSpace = ColorSpaceSRGB, const HostWindow* = nullptr);
 #endif
 
     // Create an image buffer compatible with the context, with suitable resolution for drawing into the buffer and then into this context.
@@ -171,7 +171,7 @@ private:
     ImageBuffer(const FloatSize&, float resolutionScale, CGColorSpaceRef, RenderingMode, const HostWindow*, bool& success);
     RetainPtr<CFDataRef> toCFData(const String& mimeType, std::optional<double> quality, PreserveResolution) const;
 #elif USE(DIRECT2D)
-    ImageBuffer(const FloatSize&, float resolutionScale, ColorSpace, RenderingMode, const GraphicsContext*, bool& success);
+    ImageBuffer(const FloatSize&, float resolutionScale, ColorSpace, RenderingMode, const HostWindow*, const GraphicsContext*, bool& success);
 #endif
 };
 
index f6c45a7..53b5746 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -79,6 +79,10 @@ public:
     virtual bool isAllDataReceived() const = 0;
     virtual void clearFrameBufferCache(size_t) = 0;
 
+#if USE(DIRECT2D)
+    virtual void setTargetContext(ID2D1RenderTarget*) = 0;
+#endif
+
 protected:
     ImageDecoder() = default;
 };
index 488f945..31fc818 100644 (file)
 #include <wtf/RunLoop.h>
 #include <wtf/SystemTracing.h>
 
+#if USE(DIRECT2D)
+#include "GraphicsContext.h"
+#endif
+
 namespace WebCore {
 
 ImageSource::ImageSource(BitmapImage* image, AlphaOption alphaOption, GammaAndColorProfileOption gammaAndColorProfileOption)
@@ -638,7 +642,7 @@ ImageOrientation ImageSource::frameOrientationAtIndex(size_t index)
 void ImageSource::setTargetContext(const GraphicsContext* targetContext)
 {
     if (isDecoderAvailable() && targetContext)
-        m_decoder->setTargetContext(targetContext->platformContext())
+        m_decoder->setTargetContext(targetContext->platformContext());
 }
 #endif
 
index 84181fa..766d246 100644 (file)
@@ -262,6 +262,10 @@ OpenTypeMathData::OpenTypeMathData(const FontPlatformData& font)
     if (!hb_ot_math_has_data(hb_font_get_face(m_mathFont.get())))
         m_mathFont = nullptr;
 }
+#elif USE(DIRECT2D)
+OpenTypeMathData::OpenTypeMathData(const FontPlatformData& font)
+{
+}
 #else
 OpenTypeMathData::OpenTypeMathData(const FontPlatformData&) = default;
 #endif
index edc27bf..16d2e79 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Apple Inc.  All rights reserved.
+ * Copyright (C) 2016-2018 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -94,7 +94,7 @@ void Gradient::generateGradient(ID2D1RenderTarget* renderTarget)
             float radiusX = data.endRadius + offset.width();
             float radiusY = radiusX / data.aspectRatio;
             hr = renderTarget->CreateRadialGradientBrush(
-                D2D1::RadialGradientBrushProperties(p0(), D2D1::Point2F(offset.width(), offset.height()), radiusX, radiusY),
+                D2D1::RadialGradientBrushProperties(data.point0, D2D1::Point2F(offset.width(), offset.height()), radiusX, radiusY),
                 D2D1::BrushProperties(), gradientStopCollection.get(),
                 &radialGradient);
             RELEASE_ASSERT(SUCCEEDED(hr));
index 5eace10..23c7db1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -178,7 +178,7 @@ float GraphicsContextPlatformPrivate::currentGlobalAlpha() const
 void GraphicsContext::savePlatformState()
 {
     ASSERT(!paintingDisabled());
-    ASSERT(!isRecording());
+    ASSERT(!m_impl);
 
     // Note: Do not use this function within this class implementation, since we want to avoid the extra
     // save of the secondary context (in GraphicsContextPlatformPrivateDirect2D.h).
@@ -188,7 +188,7 @@ void GraphicsContext::savePlatformState()
 void GraphicsContext::restorePlatformState()
 {
     ASSERT(!paintingDisabled());
-    ASSERT(!isRecording());
+    ASSERT(!m_impl);
 
     // Note: Do not use this function within this class implementation, since we want to avoid the extra
     // restore of the secondary context (in GraphicsContextPlatformPrivateDirect2D.h).
@@ -201,7 +201,7 @@ void GraphicsContext::drawNativeImage(const COMPtr<ID2D1Bitmap>& image, const Fl
     if (paintingDisabled())
         return;
 
-    if (isRecording()) {
+    if (m_impl) {
         // FIXME: Implement DisplayListRecorder support for drawNativeImage.
         // m_displayListRecorder->drawNativeImage(image, imageSize, destRect, srcRect, op, blendMode, orientation);
         notImplemented();
@@ -551,8 +551,8 @@ void GraphicsContext::drawPattern(Image& image, const FloatRect& destRect, const
     if (paintingDisabled() || !patternTransform.isInvertible())
         return;
 
-    if (isRecording()) {
-        m_displayListRecorder->drawPattern(image, destRect, tileRect, patternTransform, phase, spacing, op, blendMode);
+    if (m_impl) {
+        m_impl->drawPattern(image, destRect, tileRect, patternTransform, phase, spacing, op, blendMode);
         return;
     }
 
@@ -618,8 +618,8 @@ void GraphicsContext::drawRect(const FloatRect& rect, float borderThickness)
     if (paintingDisabled())
         return;
 
-    if (isRecording()) {
-        m_displayListRecorder->drawRect(rect, borderThickness);
+    if (m_impl) {
+        m_impl->drawRect(rect, borderThickness);
         return;
     }
 
@@ -789,8 +789,8 @@ void GraphicsContext::drawLine(const FloatPoint& point1, const FloatPoint& point
     if (strokeStyle() == NoStroke)
         return;
 
-    if (isRecording()) {
-        m_displayListRecorder->drawLine(point1, point2);
+    if (m_impl) {
+        m_impl->drawLine(point1, point2);
         return;
     }
 
@@ -847,8 +847,8 @@ void GraphicsContext::drawEllipse(const FloatRect& rect)
     if (paintingDisabled())
         return;
 
-    if (isRecording()) {
-        m_displayListRecorder->drawEllipse(rect);
+    if (m_impl) {
+        m_impl->drawEllipse(rect);
         return;
     }
 
@@ -894,8 +894,8 @@ void GraphicsContext::drawPath(const Path& path)
     if (paintingDisabled() || path.isEmpty())
         return;
 
-    if (isRecording()) {
-        m_displayListRecorder->drawPath(path);
+    if (m_impl) {
+        m_impl->drawPath(path);
         return;
     }
 
@@ -1002,8 +1002,8 @@ void GraphicsContext::fillPath(const Path& path)
     if (paintingDisabled() || path.isEmpty())
         return;
 
-    if (isRecording()) {
-        m_displayListRecorder->fillPath(path);
+    if (m_impl) {
+        m_impl->fillPath(path);
         return;
     }
 
@@ -1023,7 +1023,7 @@ void GraphicsContext::fillPath(const Path& path)
         context->SetTags(1, __LINE__);
 
         FloatRect boundingRect = path.fastBoundingRect();
-        auto drawFunction = [this, &path](ID2D1RenderTarget* renderTarget) {
+        WTF::Function<void(ID2D1RenderTarget*)> drawFunction = [this, &path](ID2D1RenderTarget* renderTarget) {
             renderTarget->FillGeometry(path.platformPath(), m_state.fillGradient->createPlatformGradientIfNecessary(renderTarget));
         };
 
@@ -1056,8 +1056,8 @@ void GraphicsContext::strokePath(const Path& path)
     if (paintingDisabled() || path.isEmpty())
         return;
 
-    if (isRecording()) {
-        m_displayListRecorder->strokePath(path);
+    if (m_impl) {
+        m_impl->strokePath(path);
         return;
     }
 
@@ -1070,7 +1070,7 @@ void GraphicsContext::strokePath(const Path& path)
 
         D2DContextStateSaver stateSaver(*m_data);
         auto boundingRect = path.fastBoundingRect();
-        auto drawFunction = [this, &path](ID2D1RenderTarget* renderTarget) {
+        WTF::Function<void(ID2D1RenderTarget*)> drawFunction = [this, &path](ID2D1RenderTarget* renderTarget) {
             renderTarget->DrawGeometry(path.platformPath(), m_state.strokeGradient->createPlatformGradientIfNecessary(renderTarget));
         };
 
@@ -1101,8 +1101,8 @@ void GraphicsContext::fillRect(const FloatRect& rect)
     if (paintingDisabled())
         return;
 
-    if (isRecording()) {
-        m_displayListRecorder->fillRect(rect);
+    if (m_impl) {
+        m_impl->fillRect(rect);
         return;
     }
 
@@ -1111,7 +1111,7 @@ void GraphicsContext::fillRect(const FloatRect& rect)
     if (m_state.fillGradient) {
         context->SetTags(1, __LINE__);
         D2DContextStateSaver stateSaver(*m_data);
-        auto drawFunction = [this, rect](ID2D1RenderTarget* renderTarget) {
+        WTF::Function<void(ID2D1RenderTarget*)> drawFunction = [this, rect](ID2D1RenderTarget* renderTarget) {
             const D2D1_RECT_F d2dRect = rect;
             renderTarget->FillRectangle(&d2dRect, m_state.fillGradient->createPlatformGradientIfNecessary(renderTarget));
         };
@@ -1148,8 +1148,8 @@ void GraphicsContext::fillRect(const FloatRect& rect, const Color& color)
     if (paintingDisabled())
         return;
 
-    if (isRecording()) {
-        m_displayListRecorder->fillRect(rect, color);
+    if (m_impl) {
+        m_impl->fillRect(rect, color);
         return;
     }
 
@@ -1176,7 +1176,7 @@ void GraphicsContext::platformFillRoundedRect(const FloatRoundedRect& rect, cons
     if (paintingDisabled())
         return;
 
-    ASSERT(!isRecording());
+    ASSERT(!m_impl);
 
     auto context = platformContext();
 
@@ -1217,8 +1217,8 @@ void GraphicsContext::fillRectWithRoundedHole(const FloatRect& rect, const Float
     if (paintingDisabled())
         return;
 
-    if (isRecording()) {
-        m_displayListRecorder->fillRectWithRoundedHole(rect, roundedHoleRect, color);
+    if (m_impl) {
+        m_impl->fillRectWithRoundedHole(rect, roundedHoleRect, color);
         return;
     }
 
@@ -1264,8 +1264,8 @@ void GraphicsContext::clip(const FloatRect& rect)
     if (paintingDisabled())
         return;
 
-    if (isRecording()) {
-        m_displayListRecorder->clip(rect);
+    if (m_impl) {
+        m_impl->clip(rect);
         return;
     }
 
@@ -1277,8 +1277,8 @@ void GraphicsContext::clipOut(const FloatRect& rect)
     if (paintingDisabled())
         return;
 
-    if (isRecording()) {
-        m_displayListRecorder->clipOut(rect);
+    if (m_impl) {
+        m_impl->clipOut(rect);
         return;
     }
 
@@ -1293,8 +1293,8 @@ void GraphicsContext::clipOut(const Path& path)
     if (paintingDisabled())
         return;
 
-    if (isRecording()) {
-        m_displayListRecorder->clipOut(path);
+    if (m_impl) {
+        m_impl->clipOut(path);
         return;
     }
 
@@ -1318,8 +1318,8 @@ void GraphicsContext::clipPath(const Path& path, WindRule clipRule)
     if (paintingDisabled())
         return;
 
-    if (isRecording()) {
-        m_displayListRecorder->clipPath(path, clipRule);
+    if (m_impl) {
+        m_impl->clipPath(path, clipRule);
         return;
     }
 
@@ -1340,7 +1340,7 @@ IntRect GraphicsContext::clipBounds() const
     if (paintingDisabled())
         return IntRect();
 
-    if (isRecording()) {
+    if (m_impl) {
         WTFLogAlways("Getting the clip bounds not yet supported with display lists");
         return IntRect(-2048, -2048, 4096, 4096); // FIXME: display lists.
     }
@@ -1374,7 +1374,7 @@ void GraphicsContext::beginPlatformTransparencyLayer(float opacity)
     if (paintingDisabled())
         return;
 
-    ASSERT(!isRecording());
+    ASSERT(!m_impl);
 
     save();
 
@@ -1421,7 +1421,7 @@ void GraphicsContext::endPlatformTransparencyLayer()
 
     m_data->endTransparencyLayer();
 
-    ASSERT(!isRecording());
+    ASSERT(!m_impl);
 
     m_state.alpha = m_data->currentGlobalAlpha();
 
@@ -1461,9 +1461,9 @@ void GraphicsContext::setMiterLimit(float limit)
     if (paintingDisabled())
         return;
 
-    if (isRecording()) {
+    if (m_impl) {
         // Maybe this should be part of the state.
-        m_displayListRecorder->setMiterLimit(limit);
+        m_impl->setMiterLimit(limit);
         return;
     }
 
@@ -1475,8 +1475,8 @@ void GraphicsContext::clearRect(const FloatRect& rect)
     if (paintingDisabled())
         return;
 
-    if (isRecording()) {
-        m_displayListRecorder->clearRect(rect);
+    if (m_impl) {
+        m_impl->clearRect(rect);
         return;
     }
 
@@ -1504,13 +1504,13 @@ void GraphicsContext::strokeRect(const FloatRect& rect, float lineWidth)
     if (paintingDisabled())
         return;
 
-    if (isRecording()) {
-        m_displayListRecorder->strokeRect(rect, lineWidth);
+    if (m_impl) {
+        m_impl->strokeRect(rect, lineWidth);
         return;
     }
 
     if (m_state.strokeGradient) {
-        auto drawFunction = [this, rect, lineWidth](ID2D1RenderTarget* renderTarget) {
+        WTF::Function<void(ID2D1RenderTarget*)> drawFunction = [this, rect, lineWidth](ID2D1RenderTarget* renderTarget) {
             renderTarget->SetTags(1, __LINE__);
             const D2D1_RECT_F d2dRect = rect;
             renderTarget->DrawRectangle(&d2dRect, m_state.strokeGradient->createPlatformGradientIfNecessary(renderTarget), lineWidth, m_data->strokeStyle());
@@ -1539,8 +1539,8 @@ void GraphicsContext::setLineCap(LineCap cap)
     if (paintingDisabled())
         return;
 
-    if (isRecording()) {
-        m_displayListRecorder->setLineCap(cap);
+    if (m_impl) {
+        m_impl->setLineCap(cap);
         return;
     }
 
@@ -1552,8 +1552,8 @@ void GraphicsContext::setLineDash(const DashArray& dashes, float dashOffset)
     if (paintingDisabled())
         return;
 
-    if (isRecording()) {
-        m_displayListRecorder->setLineDash(dashes, dashOffset);
+    if (m_impl) {
+        m_impl->setLineDash(dashes, dashOffset);
         return;
     }
 
@@ -1574,8 +1574,8 @@ void GraphicsContext::setLineJoin(LineJoin join)
     if (paintingDisabled())
         return;
 
-    if (isRecording()) {
-        m_displayListRecorder->setLineJoin(join);
+    if (m_impl) {
+        m_impl->setLineJoin(join);
         return;
     }
 
@@ -1592,8 +1592,8 @@ void GraphicsContext::scale(const FloatSize& size)
     if (paintingDisabled())
         return;
 
-    if (isRecording()) {
-        m_displayListRecorder->scale(size);
+    if (m_impl) {
+        m_impl->scale(size);
         return;
     }
 
@@ -1606,8 +1606,8 @@ void GraphicsContext::rotate(float angle)
     if (paintingDisabled())
         return;
 
-    if (isRecording()) {
-        m_displayListRecorder->rotate(angle);
+    if (m_impl) {
+        m_impl->rotate(angle);
         return;
     }
 
@@ -1620,8 +1620,8 @@ void GraphicsContext::translate(float x, float y)
     if (paintingDisabled())
         return;
 
-    if (isRecording()) {
-        m_displayListRecorder->translate(x, y);
+    if (m_impl) {
+        m_impl->translate(x, y);
         return;
     }
 
@@ -1634,8 +1634,8 @@ void GraphicsContext::concatCTM(const AffineTransform& transform)
     if (paintingDisabled())
         return;
 
-    if (isRecording()) {
-        m_displayListRecorder->concatCTM(transform);
+    if (m_impl) {
+        m_impl->concatCTM(transform);
         return;
     }
 
@@ -1648,7 +1648,7 @@ void GraphicsContext::setCTM(const AffineTransform& transform)
     if (paintingDisabled())
         return;
 
-    if (isRecording()) {
+    if (m_impl) {
         WTFLogAlways("GraphicsContext::setCTM() is not compatible with recording contexts.");
         return;
     }
@@ -1662,7 +1662,7 @@ AffineTransform GraphicsContext::getCTM(IncludeDeviceScale includeScale) const
     if (paintingDisabled())
         return AffineTransform();
 
-    if (isRecording()) {
+    if (m_impl) {
         WTFLogAlways("GraphicsContext::getCTM() is not yet compatible with recording contexts.");
         return AffineTransform();
     }
@@ -1677,7 +1677,7 @@ FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect, RoundingMo
     if (paintingDisabled())
         return rect;
 
-    if (isRecording()) {
+    if (m_impl) {
         WTFLogAlways("GraphicsContext::roundToDevicePixels() is not yet compatible with recording contexts.");
         return rect;
     }
@@ -1703,8 +1703,8 @@ void GraphicsContext::drawLinesForText(const FloatPoint& point, const DashArray&
     if (!widths.size())
         return;
 
-    if (isRecording()) {
-        m_displayListRecorder->drawLinesForText(point, widths, printing, doubleLines, strokeThickness());
+    if (m_impl) {
+        m_impl->drawLinesForText(point, widths, printing, doubleLines, strokeThickness());
         return;
     }
 
@@ -1716,7 +1716,7 @@ void GraphicsContext::setURLForRect(const URL& link, const FloatRect& destRect)
     if (paintingDisabled())
         return;
 
-    if (isRecording()) {
+    if (m_impl) {
         WTFLogAlways("GraphicsContext::setURLForRect() is not yet compatible with recording contexts.");
         return; // FIXME for display lists.
     }
@@ -1759,7 +1759,7 @@ void GraphicsContext::setIsCALayerContext(bool isLayerContext)
     if (paintingDisabled())
         return;
 
-    if (isRecording())
+    if (m_impl)
         return;
 
     // This function is probabaly not needed.
@@ -1772,7 +1772,7 @@ bool GraphicsContext::isCALayerContext() const
         return false;
 
     // FIXME
-    if (isRecording())
+    if (m_impl)
         return false;
 
     // This function is probabaly not needed.
@@ -1786,7 +1786,7 @@ void GraphicsContext::setIsAcceleratedContext(bool isAccelerated)
         return;
 
     // FIXME
-    if (isRecording())
+    if (m_impl)
         return;
 
     notImplemented();
@@ -1798,7 +1798,7 @@ bool GraphicsContext::isAcceleratedContext() const
         return false;
 
     // FIXME
-    if (isRecording())
+    if (m_impl)
         return false;
 
     // This function is probabaly not needed.
@@ -1841,7 +1841,7 @@ void GraphicsContext::setPlatformShouldAntialias(bool enable)
     if (paintingDisabled())
         return;
 
-    ASSERT(!isRecording());
+    ASSERT(!m_impl);
 
     auto antialiasMode = enable ? D2D1_ANTIALIAS_MODE_PER_PRIMITIVE : D2D1_ANTIALIAS_MODE_ALIASED;
     platformContext()->SetAntialiasMode(antialiasMode);
@@ -1852,7 +1852,7 @@ void GraphicsContext::setPlatformShouldSmoothFonts(bool enable)
     if (paintingDisabled())
         return;
 
-    ASSERT(!isRecording());
+    ASSERT(!m_impl);
 
     auto fontSmoothingMode = enable ? D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE : D2D1_TEXT_ANTIALIAS_MODE_ALIASED;
     platformContext()->SetTextAntialiasMode(fontSmoothingMode);
@@ -1872,7 +1872,7 @@ void GraphicsContext::setPlatformCompositeOperation(CompositeOperator mode, Blen
     if (paintingDisabled())
         return;
 
-    ASSERT(!isRecording());
+    ASSERT(!m_impl);
 
     D2D1_BLEND_MODE targetBlendMode = D2D1_BLEND_MODE_SCREEN;
     D2D1_COMPOSITE_MODE targetCompositeMode = D2D1_COMPOSITE_MODE_SOURCE_ATOP; // ???
@@ -1994,7 +1994,7 @@ void GraphicsContext::platformFillEllipse(const FloatRect& ellipse)
     if (paintingDisabled())
         return;
 
-    ASSERT(!isRecording());
+    ASSERT(!m_impl);
 
     if (m_state.fillGradient || m_state.fillPattern) {
         // FIXME: We should be able to fill ellipses with pattern/gradient brushes in D2D.
@@ -2016,7 +2016,7 @@ void GraphicsContext::platformStrokeEllipse(const FloatRect& ellipse)
     if (paintingDisabled())
         return;
 
-    ASSERT(!isRecording());
+    ASSERT(!m_impl);
 
     if (m_state.strokeGradient || m_state.strokePattern) {
         // FIXME: We should be able to stroke ellipses with pattern/gradient brushes in D2D.
index 99bd71d..1995c0d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -53,10 +53,9 @@ Ref<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, Graphics
         layer->initialize(layerType);
         return layer;
     }
-    
-    auto layer = adoptRef(*new GraphicsLayerCA(layerType, client);
-    layer->initialize(layerType);
-    return layer;
+
+    // FIXME: Return a real Direct2D graphics layer
+    return adoptRef(*new GraphicsLayerDirect2D(layerType, client));
 }
 
 GraphicsLayerDirect2D::GraphicsLayerDirect2D(Type layerType, GraphicsLayerClient& client)
index 0275f9d..4993833 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -147,7 +147,7 @@ void ImageBufferData::putData(const Uint8ClampedArray& source, AlphaPremultiplic
                 row[basex + 2] = (srcRows[basex + 2] * alpha + 254) / 255;
                 row[basex + 3] = alpha;
             } else
-                reinterpret_cast<uint32_t*>(row.get() + basex)[0] = reinterpret_cast<uint32_t*>(srcRows + basex)[0];
+                reinterpret_cast<uint32_t*>(row.get() + basex)[0] = reinterpret_cast<const uint32_t*>(srcRows + basex)[0];
         }
 
         D2D1_RECT_U dstRect = D2D1::RectU(destPoint.x(), destPoint.y() + y, destPoint.x() + size.width(), destPoint.y() + y + 1);
index a21fb4f..af1ec83 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -23,6 +23,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#pragma once
+
 #include "Image.h"
 #include "IntSize.h"
 #include <JavaScriptCore/Uint8ClampedArray.h>
index 676e741..1064b6c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -62,7 +62,7 @@ std::unique_ptr<ImageBuffer> ImageBuffer::createCompatibleBuffer(const FloatSize
     RenderingMode renderingMode = context.renderingMode();
     IntSize scaledSize = ImageBuffer::compatibleBufferSize(size, context);
     bool success = false;
-    std::unique_ptr<ImageBuffer> buffer(new ImageBuffer(scaledSize, 1, ColorSpaceSRGB, renderingMode, &context, success));
+    std::unique_ptr<ImageBuffer> buffer(new ImageBuffer(scaledSize, 1, ColorSpaceSRGB, renderingMode, nullptr, &context, success));
 
     if (!success)
         return nullptr;
@@ -72,7 +72,7 @@ std::unique_ptr<ImageBuffer> ImageBuffer::createCompatibleBuffer(const FloatSize
     return buffer;
 }
 
-ImageBuffer::ImageBuffer(const FloatSize& size, float resolutionScale, ColorSpace /*colorSpace*/, RenderingMode renderingMode, const GraphicsContext* targetContext, bool& success)
+ImageBuffer::ImageBuffer(const FloatSize& size, float resolutionScale, ColorSpace /*colorSpace*/, RenderingMode renderingMode, const HostWindow*, const GraphicsContext* targetContext, bool& success)
     : m_logicalSize(size)
     , m_resolutionScale(resolutionScale)
 {
@@ -115,8 +115,8 @@ ImageBuffer::ImageBuffer(const FloatSize& size, float resolutionScale, ColorSpac
     success = true;
 }
 
-ImageBuffer::ImageBuffer(const FloatSize& size, float resolutionScale, ColorSpace imageColorSpace, RenderingMode renderingMode, bool& success)
-    : ImageBuffer(size, resolutionScale, imageColorSpace, renderingMode, nullptr, success)
+ImageBuffer::ImageBuffer(const FloatSize& size, float resolutionScale, ColorSpace imageColorSpace, RenderingMode renderingMode, const HostWindow*, bool& success)
+    : ImageBuffer(size, resolutionScale, imageColorSpace, renderingMode, nullptr, nullptr, success)
 {
 }
 
index 55a5bd3..fa698c5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -56,7 +56,7 @@ IWICImagingFactory* ImageDecoderDirect2D::systemImagingFactory()
     return wicImagingFactory;
 }
 
-size_t ImageDecoderDirect2D::bytesDecodedToDetermineProperties()
+size_t ImageDecoderDirect2D::bytesDecodedToDetermineProperties() const
 {
     // Set to match value used for CoreGraphics.
     return 13088;
@@ -75,8 +75,11 @@ bool ImageDecoderDirect2D::isSizeAvailable() const
 
 EncodedDataStatus ImageDecoderDirect2D::encodedDataStatus() const
 {
-    notImplemented();
-    return EncodedDataStatus::Unknown;
+    if (!m_nativeDecoder)
+        return EncodedDataStatus::Error;
+
+    // FIXME: Hook into WIC decoder (if async decode is even possible)
+    return EncodedDataStatus::Complete;
 }
 
 IntSize ImageDecoderDirect2D::size() const
@@ -112,6 +115,10 @@ size_t ImageDecoderDirect2D::frameCount() const
 
 RepetitionCount ImageDecoderDirect2D::repetitionCount() const
 {
+    if (!m_nativeDecoder)
+        return RepetitionCountNone;
+
+    // FIXME: Identify image type, and determine proper repetition count.
     return RepetitionCountNone;
 }
 
@@ -150,24 +157,64 @@ bool ImageDecoderDirect2D::frameIsCompleteAtIndex(size_t index) const
 
 ImageOrientation ImageDecoderDirect2D::frameOrientationAtIndex(size_t index) const
 {
-    notImplemented();
+    if (!m_nativeDecoder)
+        return ImageOrientation();
+
+    COMPtr<IWICBitmapFrameDecode> frame;
+    HRESULT hr = m_nativeDecoder->GetFrame(index, &frame);
+    if (!SUCCEEDED(hr))
+        return ImageOrientation();
+
+    COMPtr<IWICMetadataQueryReader> metadata;
+    hr = frame->GetMetadataQueryReader(&metadata);
+    if (!SUCCEEDED(hr))
+        return ImageOrientation();
+
+    // FIXME: Identify image type, and ask proper orientation.
     return ImageOrientation();
 }
 
-float ImageDecoderDirect2D::frameDurationAtIndex(size_t index) const
+Seconds ImageDecoderDirect2D::frameDurationAtIndex(size_t index) const
 {
+    if (!m_nativeDecoder)
+        return Seconds(0);
+
+    COMPtr<IWICBitmapFrameDecode> frame;
+    HRESULT hr = m_nativeDecoder->GetFrame(index, &frame);
+    if (!SUCCEEDED(hr))
+        return Seconds(0);
+
+    // FIXME: Figure out correct image format-specific query for frame duration check.
     notImplemented();
-    return 0;
+    return Seconds(0);
 }
 
-bool ImageDecoderDirect2D::frameAllowSubsamplingAtIndex(size_t) const
+bool ImageDecoderDirect2D::frameAllowSubsamplingAtIndex(size_t index) const
 {
+    if (!m_nativeDecoder)
+        return false;
+
+    COMPtr<IWICBitmapFrameDecode> frame;
+    HRESULT hr = m_nativeDecoder->GetFrame(index, &frame);
+    if (!SUCCEEDED(hr))
+        return false;
+
+    // FIXME: Figure out correct image format-specific query for subsampling check.
     notImplemented();
     return true;
 }
 
 bool ImageDecoderDirect2D::frameHasAlphaAtIndex(size_t index) const
 {
+    if (!m_nativeDecoder)
+        return false;
+
+    COMPtr<IWICBitmapFrameDecode> frame;
+    HRESULT hr = m_nativeDecoder->GetFrame(index, &frame);
+    if (!SUCCEEDED(hr))
+        return false;
+
+    // FIXME: Figure out correct image format-specific query for alpha check.
     notImplemented();
     return true;
 }
@@ -186,7 +233,7 @@ void ImageDecoderDirect2D::setTargetContext(ID2D1RenderTarget* renderTarget)
     m_renderTarget = renderTarget;
 }
 
-NativeImagePtr ImageDecoderDirect2D::createFrameImageAtIndex(size_t index, SubsamplingLevel subsamplingLevel, const DecodingOptions&) const
+NativeImagePtr ImageDecoderDirect2D::createFrameImageAtIndex(size_t index, SubsamplingLevel subsamplingLevel, const DecodingOptions&)
 {
     if (!m_nativeDecoder || !m_renderTarget)
         return nullptr;
@@ -231,9 +278,13 @@ void ImageDecoderDirect2D::setData(SharedBuffer& data, bool allDataReceived)
     m_nativeDecoder = nullptr;
 
     hr = systemImagingFactory()->CreateDecoderFromStream(stream.get(), nullptr, WICDecodeMetadataCacheOnDemand, &m_nativeDecoder);
-    ASSERT(SUCCEEDED(hr));
-}
+    if (!SUCCEEDED(hr)) {
+        m_nativeDecoder = nullptr;
+        return;
+    }
 
+    // Image was valid.
+}
 }
 
 #endif
index f6d6673..8a3f4f3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -49,7 +49,7 @@ public:
 
     static bool supportsMediaType(MediaType type) { return type == MediaType::Image; }
 
-    static size_t bytesDecodedToDetermineProperties();
+    size_t bytesDecodedToDetermineProperties() const final;
 
     String filenameExtension() const final;
     EncodedDataStatus encodedDataStatus() const final;
@@ -66,12 +66,12 @@ public:
     bool frameIsCompleteAtIndex(size_t) const final;
     ImageOrientation frameOrientationAtIndex(size_t) const final;
 
-    float frameDurationAtIndex(size_t) const final;
+    Seconds frameDurationAtIndex(size_t) const final;
     bool frameHasAlphaAtIndex(size_t) const final;
     bool frameAllowSubsamplingAtIndex(size_t) const final;
     unsigned frameBytesAtIndex(size_t, SubsamplingLevel = SubsamplingLevel::Default) const final;
 
-    NativeImagePtr createFrameImageAtIndex(size_t, SubsamplingLevel = SubsamplingLevel::Default, const DecodingOptions& = DecodingOptions(DecodingMode::Synchronous)) const final;
+    NativeImagePtr createFrameImageAtIndex(size_t, SubsamplingLevel = SubsamplingLevel::Default, const DecodingOptions& = DecodingOptions(DecodingMode::Synchronous)) final;
 
     void setData(SharedBuffer&, bool allDataReceived) final;
     bool isAllDataReceived() const final { return m_isAllDataReceived; }
index 6eb437d..2626f66 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2016 Apple Inc.  All rights reserved.
+ * Copyright (C) 2006-2018 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -81,7 +81,7 @@ void BitmapImage::drawFrameMatchingSourceSize(GraphicsContext& ctxt, const Float
         if (image && clampTo<size_t>(imageSize.height) == static_cast<size_t>(srcSize.height()) && clampTo<size_t>(imageSize.width) == static_cast<size_t>(srcSize.width())) {
             size_t currentFrame = m_currentFrame;
             m_currentFrame = i;
-            draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, srcSize.width(), srcSize.height()), compositeOp, BlendMode::Normal, ImageOrientationDescription());
+            draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, srcSize.width(), srcSize.height()), compositeOp, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientationDescription());
             m_currentFrame = currentFrame;
             return;
         }
@@ -89,7 +89,7 @@ void BitmapImage::drawFrameMatchingSourceSize(GraphicsContext& ctxt, const Float
 
     // No image of the correct size was found, fallback to drawing the current frame
     FloatSize imageSize = BitmapImage::size();
-    draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), compositeOp, BlendMode::Normal, ImageOrientationDescription());
+    draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), compositeOp, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientationDescription());
 }
 
 } // namespace WebCore
index 9dfb5ae..99a3886 100644 (file)
@@ -48,7 +48,7 @@ ID2D1BitmapBrush* Pattern::createPlatformPattern(const GraphicsContext& context,
     brushProperties.transform = patternTransform;
     brushProperties.opacity = alpha;
 
-    auto patternImage = tileImage();
+    auto& patternImage = tileImage();
 
     auto platformContext = context.platformContext();
     RELEASE_ASSERT(platformContext);