Diff
Modified: trunk/Source/WebCore/ChangeLog (237393 => 237394)
--- trunk/Source/WebCore/ChangeLog 2018-10-24 18:42:22 UTC (rev 237393)
+++ trunk/Source/WebCore/ChangeLog 2018-10-24 18:46:39 UTC (rev 237394)
@@ -1,3 +1,98 @@
+2018-10-24 Brent Fulgham <[email protected]>
+
+ 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 <[email protected]>
Cleanup: MIMETypeRegistry functions
Modified: trunk/Source/WebCore/platform/graphics/FontPlatformData.h (237393 => 237394)
--- trunk/Source/WebCore/platform/graphics/FontPlatformData.h 2018-10-24 18:42:22 UTC (rev 237393)
+++ trunk/Source/WebCore/platform/graphics/FontPlatformData.h 2018-10-24 18:46:39 UTC (rev 237394)
@@ -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 [email protected]
* Copyright (C) 2007 Holger Hans Peter Freyther
* Copyright (C) 2007 Pioneer Research Center USA, Inc.
@@ -63,6 +63,10 @@
interface IDWriteFontFace;
#endif
+#if USE(DIRECT2D)
+#include <dwrite.h>
+#endif
+
namespace WebCore {
class FontDescription;
Modified: trunk/Source/WebCore/platform/graphics/ImageBuffer.cpp (237393 => 237394)
--- trunk/Source/WebCore/platform/graphics/ImageBuffer.cpp 2018-10-24 18:42:22 UTC (rev 237393)
+++ trunk/Source/WebCore/platform/graphics/ImageBuffer.cpp 2018-10-24 18:46:39 UTC (rev 237394)
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2009 Dirk Schulze <[email protected]>
* 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 @@
}
#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;
Modified: trunk/Source/WebCore/platform/graphics/ImageBuffer.h (237393 => 237394)
--- trunk/Source/WebCore/platform/graphics/ImageBuffer.h 2018-10-24 18:42:22 UTC (rev 237393)
+++ trunk/Source/WebCore/platform/graphics/ImageBuffer.h 2018-10-24 18:46:39 UTC (rev 237394)
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Nikolas Zimmermann <[email protected]>
- * 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 @@
// 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 @@
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
};
Modified: trunk/Source/WebCore/platform/graphics/ImageDecoder.h (237393 => 237394)
--- trunk/Source/WebCore/platform/graphics/ImageDecoder.h 2018-10-24 18:42:22 UTC (rev 237393)
+++ trunk/Source/WebCore/platform/graphics/ImageDecoder.h 2018-10-24 18:46:39 UTC (rev 237394)
@@ -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 @@
virtual bool isAllDataReceived() const = 0;
virtual void clearFrameBufferCache(size_t) = 0;
+#if USE(DIRECT2D)
+ virtual void setTargetContext(ID2D1RenderTarget*) = 0;
+#endif
+
protected:
ImageDecoder() = default;
};
Modified: trunk/Source/WebCore/platform/graphics/ImageSource.cpp (237393 => 237394)
--- trunk/Source/WebCore/platform/graphics/ImageSource.cpp 2018-10-24 18:42:22 UTC (rev 237393)
+++ trunk/Source/WebCore/platform/graphics/ImageSource.cpp 2018-10-24 18:46:39 UTC (rev 237394)
@@ -36,6 +36,10 @@
#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 @@
void ImageSource::setTargetContext(const GraphicsContext* targetContext)
{
if (isDecoderAvailable() && targetContext)
- m_decoder->setTargetContext(targetContext->platformContext())
+ m_decoder->setTargetContext(targetContext->platformContext());
}
#endif
Modified: trunk/Source/WebCore/platform/graphics/opentype/OpenTypeMathData.cpp (237393 => 237394)
--- trunk/Source/WebCore/platform/graphics/opentype/OpenTypeMathData.cpp 2018-10-24 18:42:22 UTC (rev 237393)
+++ trunk/Source/WebCore/platform/graphics/opentype/OpenTypeMathData.cpp 2018-10-24 18:46:39 UTC (rev 237394)
@@ -262,6 +262,10 @@
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
Modified: trunk/Source/WebCore/platform/graphics/win/GradientDirect2D.cpp (237393 => 237394)
--- trunk/Source/WebCore/platform/graphics/win/GradientDirect2D.cpp 2018-10-24 18:42:22 UTC (rev 237393)
+++ trunk/Source/WebCore/platform/graphics/win/GradientDirect2D.cpp 2018-10-24 18:46:39 UTC (rev 237394)
@@ -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 @@
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));
Modified: trunk/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp (237393 => 237394)
--- trunk/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp 2018-10-24 18:42:22 UTC (rev 237393)
+++ trunk/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp 2018-10-24 18:46:39 UTC (rev 237394)
@@ -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 @@
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::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 @@
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 @@
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 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->drawRect(rect, borderThickness);
+ if (m_impl) {
+ m_impl->drawRect(rect, borderThickness);
return;
}
@@ -789,8 +789,8 @@
if (strokeStyle() == NoStroke)
return;
- if (isRecording()) {
- m_displayListRecorder->drawLine(point1, point2);
+ if (m_impl) {
+ m_impl->drawLine(point1, point2);
return;
}
@@ -847,8 +847,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->drawEllipse(rect);
+ if (m_impl) {
+ m_impl->drawEllipse(rect);
return;
}
@@ -894,8 +894,8 @@
if (paintingDisabled() || path.isEmpty())
return;
- if (isRecording()) {
- m_displayListRecorder->drawPath(path);
+ if (m_impl) {
+ m_impl->drawPath(path);
return;
}
@@ -1002,8 +1002,8 @@
if (paintingDisabled() || path.isEmpty())
return;
- if (isRecording()) {
- m_displayListRecorder->fillPath(path);
+ if (m_impl) {
+ m_impl->fillPath(path);
return;
}
@@ -1023,7 +1023,7 @@
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 @@
if (paintingDisabled() || path.isEmpty())
return;
- if (isRecording()) {
- m_displayListRecorder->strokePath(path);
+ if (m_impl) {
+ m_impl->strokePath(path);
return;
}
@@ -1070,7 +1070,7 @@
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 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->fillRect(rect);
+ if (m_impl) {
+ m_impl->fillRect(rect);
return;
}
@@ -1111,7 +1111,7 @@
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 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->fillRect(rect, color);
+ if (m_impl) {
+ m_impl->fillRect(rect, color);
return;
}
@@ -1176,7 +1176,7 @@
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(!m_impl);
auto context = platformContext();
@@ -1217,8 +1217,8 @@
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 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->clip(rect);
+ if (m_impl) {
+ m_impl->clip(rect);
return;
}
@@ -1277,8 +1277,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->clipOut(rect);
+ if (m_impl) {
+ m_impl->clipOut(rect);
return;
}
@@ -1293,8 +1293,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->clipOut(path);
+ if (m_impl) {
+ m_impl->clipOut(path);
return;
}
@@ -1318,8 +1318,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->clipPath(path, clipRule);
+ if (m_impl) {
+ m_impl->clipPath(path, clipRule);
return;
}
@@ -1340,7 +1340,7 @@
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 @@
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(!m_impl);
save();
@@ -1421,7 +1421,7 @@
m_data->endTransparencyLayer();
- ASSERT(!isRecording());
+ ASSERT(!m_impl);
m_state.alpha = m_data->currentGlobalAlpha();
@@ -1461,9 +1461,9 @@
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 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->clearRect(rect);
+ if (m_impl) {
+ m_impl->clearRect(rect);
return;
}
@@ -1504,13 +1504,13 @@
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 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->setLineCap(cap);
+ if (m_impl) {
+ m_impl->setLineCap(cap);
return;
}
@@ -1552,8 +1552,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->setLineDash(dashes, dashOffset);
+ if (m_impl) {
+ m_impl->setLineDash(dashes, dashOffset);
return;
}
@@ -1574,8 +1574,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->setLineJoin(join);
+ if (m_impl) {
+ m_impl->setLineJoin(join);
return;
}
@@ -1592,8 +1592,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->scale(size);
+ if (m_impl) {
+ m_impl->scale(size);
return;
}
@@ -1606,8 +1606,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->rotate(angle);
+ if (m_impl) {
+ m_impl->rotate(angle);
return;
}
@@ -1620,8 +1620,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->translate(x, y);
+ if (m_impl) {
+ m_impl->translate(x, y);
return;
}
@@ -1634,8 +1634,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->concatCTM(transform);
+ if (m_impl) {
+ m_impl->concatCTM(transform);
return;
}
@@ -1648,7 +1648,7 @@
if (paintingDisabled())
return;
- if (isRecording()) {
+ if (m_impl) {
WTFLogAlways("GraphicsContext::setCTM() is not compatible with recording contexts.");
return;
}
@@ -1662,7 +1662,7 @@
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 @@
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 @@
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 @@
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 @@
if (paintingDisabled())
return;
- if (isRecording())
+ if (m_impl)
return;
// This function is probabaly not needed.
@@ -1772,7 +1772,7 @@
return false;
// FIXME
- if (isRecording())
+ if (m_impl)
return false;
// This function is probabaly not needed.
@@ -1786,7 +1786,7 @@
return;
// FIXME
- if (isRecording())
+ if (m_impl)
return;
notImplemented();
@@ -1798,7 +1798,7 @@
return false;
// FIXME
- if (isRecording())
+ if (m_impl)
return false;
// This function is probabaly not needed.
@@ -1841,7 +1841,7 @@
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 @@
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 @@
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 @@
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 @@
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.
Modified: trunk/Source/WebCore/platform/graphics/win/GraphicsLayerDirect2D.cpp (237393 => 237394)
--- trunk/Source/WebCore/platform/graphics/win/GraphicsLayerDirect2D.cpp 2018-10-24 18:42:22 UTC (rev 237393)
+++ trunk/Source/WebCore/platform/graphics/win/GraphicsLayerDirect2D.cpp 2018-10-24 18:46:39 UTC (rev 237394)
@@ -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 @@
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)
Modified: trunk/Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.cpp (237393 => 237394)
--- trunk/Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.cpp 2018-10-24 18:42:22 UTC (rev 237393)
+++ trunk/Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.cpp 2018-10-24 18:46:39 UTC (rev 237394)
@@ -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 @@
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);
Modified: trunk/Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.h (237393 => 237394)
--- trunk/Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.h 2018-10-24 18:42:22 UTC (rev 237393)
+++ trunk/Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.h 2018-10-24 18:46:39 UTC (rev 237394)
@@ -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 <_javascript_Core/Uint8ClampedArray.h>
Modified: trunk/Source/WebCore/platform/graphics/win/ImageBufferDirect2D.cpp (237393 => 237394)
--- trunk/Source/WebCore/platform/graphics/win/ImageBufferDirect2D.cpp 2018-10-24 18:42:22 UTC (rev 237393)
+++ trunk/Source/WebCore/platform/graphics/win/ImageBufferDirect2D.cpp 2018-10-24 18:46:39 UTC (rev 237394)
@@ -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 @@
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 @@
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 @@
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)
{
}
Modified: trunk/Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.cpp (237393 => 237394)
--- trunk/Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.cpp 2018-10-24 18:42:22 UTC (rev 237393)
+++ trunk/Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.cpp 2018-10-24 18:46:39 UTC (rev 237394)
@@ -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 @@
return wicImagingFactory;
}
-size_t ImageDecoderDirect2D::bytesDecodedToDetermineProperties()
+size_t ImageDecoderDirect2D::bytesDecodedToDetermineProperties() const
{
// Set to match value used for CoreGraphics.
return 13088;
@@ -75,8 +75,11 @@
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 @@
RepetitionCount ImageDecoderDirect2D::repetitionCount() const
{
+ if (!m_nativeDecoder)
+ return RepetitionCountNone;
+
+ // FIXME: Identify image type, and determine proper repetition count.
return RepetitionCountNone;
}
@@ -150,18 +157,49 @@
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;
}
@@ -168,6 +206,15 @@
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 @@
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 @@
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
Modified: trunk/Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.h (237393 => 237394)
--- trunk/Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.h 2018-10-24 18:42:22 UTC (rev 237393)
+++ trunk/Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.h 2018-10-24 18:46:39 UTC (rev 237394)
@@ -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 @@
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 @@
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; }
Modified: trunk/Source/WebCore/platform/graphics/win/ImageDirect2D.cpp (237393 => 237394)
--- trunk/Source/WebCore/platform/graphics/win/ImageDirect2D.cpp 2018-10-24 18:42:22 UTC (rev 237393)
+++ trunk/Source/WebCore/platform/graphics/win/ImageDirect2D.cpp 2018-10-24 18:46:39 UTC (rev 237394)
@@ -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 @@
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 @@
// 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
Modified: trunk/Source/WebCore/platform/graphics/win/PatternDirect2D.cpp (237393 => 237394)
--- trunk/Source/WebCore/platform/graphics/win/PatternDirect2D.cpp 2018-10-24 18:42:22 UTC (rev 237393)
+++ trunk/Source/WebCore/platform/graphics/win/PatternDirect2D.cpp 2018-10-24 18:46:39 UTC (rev 237394)
@@ -48,7 +48,7 @@
brushProperties.transform = patternTransform;
brushProperties.opacity = alpha;
- auto patternImage = tileImage();
+ auto& patternImage = tileImage();
auto platformContext = context.platformContext();
RELEASE_ASSERT(platformContext);