Changeset 237394 in webkit
- Timestamp:
- Oct 24, 2018 11:46:39 AM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r237393 r237394 1 2018-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 1 96 2018-10-24 Said Abou-Hallawa <sabouhallawa@apple.com> 2 97 -
trunk/Source/WebCore/platform/graphics/FontPlatformData.h
r237266 r237394 1 1 /* 2 * Copyright (C) 2006-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2006-2018 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com 4 4 * Copyright (C) 2007 Holger Hans Peter Freyther … … 64 64 #endif 65 65 66 #if USE(DIRECT2D) 67 #include <dwrite.h> 68 #endif 69 66 70 namespace WebCore { 67 71 -
trunk/Source/WebCore/platform/graphics/ImageBuffer.cpp
r232796 r237394 2 2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 3 3 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 4 * Copyright (C) 2016-201 7Apple Inc. All rights reserved.4 * Copyright (C) 2016-2018 Apple Inc. All rights reserved. 5 5 * 6 6 * Redistribution and use in source and binary forms, with or without … … 49 49 50 50 #if USE(DIRECT2D) 51 std::unique_ptr<ImageBuffer> ImageBuffer::create(const FloatSize& size, RenderingMode renderingMode, const GraphicsContext* targetContext, float resolutionScale, ColorSpace colorSpace )51 std::unique_ptr<ImageBuffer> ImageBuffer::create(const FloatSize& size, RenderingMode renderingMode, const GraphicsContext* targetContext, float resolutionScale, ColorSpace colorSpace, const HostWindow* hostWindow) 52 52 { 53 53 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)); 55 55 if (!success) 56 56 return nullptr; -
trunk/Source/WebCore/platform/graphics/ImageBuffer.h
r237276 r237394 1 1 /* 2 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2007 , 2008, 2009Apple Inc. All rights reserved.3 * Copyright (C) 2007-2018 Apple Inc. All rights reserved. 4 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 5 5 * … … 69 69 WEBCORE_EXPORT static std::unique_ptr<ImageBuffer> create(const FloatSize&, RenderingMode, float resolutionScale = 1, ColorSpace = ColorSpaceSRGB, const HostWindow* = nullptr); 70 70 #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); 72 72 #endif 73 73 … … 172 172 RetainPtr<CFDataRef> toCFData(const String& mimeType, std::optional<double> quality, PreserveResolution) const; 173 173 #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); 175 175 #endif 176 176 }; -
trunk/Source/WebCore/platform/graphics/ImageDecoder.h
r225616 r237394 1 1 /* 2 * Copyright (C) 2017 Apple Inc. All rights reserved.2 * Copyright (C) 2017-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 80 80 virtual void clearFrameBufferCache(size_t) = 0; 81 81 82 #if USE(DIRECT2D) 83 virtual void setTargetContext(ID2D1RenderTarget*) = 0; 84 #endif 85 82 86 protected: 83 87 ImageDecoder() = default; -
trunk/Source/WebCore/platform/graphics/ImageSource.cpp
r232802 r237394 37 37 #include <wtf/SystemTracing.h> 38 38 39 #if USE(DIRECT2D) 40 #include "GraphicsContext.h" 41 #endif 42 39 43 namespace WebCore { 40 44 … … 639 643 { 640 644 if (isDecoderAvailable() && targetContext) 641 m_decoder->setTargetContext(targetContext->platformContext()) 645 m_decoder->setTargetContext(targetContext->platformContext()); 642 646 } 643 647 #endif -
trunk/Source/WebCore/platform/graphics/opentype/OpenTypeMathData.cpp
r228524 r237394 263 263 m_mathFont = nullptr; 264 264 } 265 #elif USE(DIRECT2D) 266 OpenTypeMathData::OpenTypeMathData(const FontPlatformData& font) 267 { 268 } 265 269 #else 266 270 OpenTypeMathData::OpenTypeMathData(const FontPlatformData&) = default; -
trunk/Source/WebCore/platform/graphics/win/GradientDirect2D.cpp
r235774 r237394 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 95 95 float radiusY = radiusX / data.aspectRatio; 96 96 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), 98 98 D2D1::BrushProperties(), gradientStopCollection.get(), 99 99 &radialGradient); -
trunk/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp
r235378 r237394 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 179 179 { 180 180 ASSERT(!paintingDisabled()); 181 ASSERT(! isRecording());181 ASSERT(!m_impl); 182 182 183 183 // Note: Do not use this function within this class implementation, since we want to avoid the extra … … 189 189 { 190 190 ASSERT(!paintingDisabled()); 191 ASSERT(! isRecording());191 ASSERT(!m_impl); 192 192 193 193 // Note: Do not use this function within this class implementation, since we want to avoid the extra … … 202 202 return; 203 203 204 if ( isRecording()) {204 if (m_impl) { 205 205 // FIXME: Implement DisplayListRecorder support for drawNativeImage. 206 206 // m_displayListRecorder->drawNativeImage(image, imageSize, destRect, srcRect, op, blendMode, orientation); … … 552 552 return; 553 553 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); 556 556 return; 557 557 } … … 619 619 return; 620 620 621 if ( isRecording()) {622 m_ displayListRecorder->drawRect(rect, borderThickness);621 if (m_impl) { 622 m_impl->drawRect(rect, borderThickness); 623 623 return; 624 624 } … … 790 790 return; 791 791 792 if ( isRecording()) {793 m_ displayListRecorder->drawLine(point1, point2);792 if (m_impl) { 793 m_impl->drawLine(point1, point2); 794 794 return; 795 795 } … … 848 848 return; 849 849 850 if ( isRecording()) {851 m_ displayListRecorder->drawEllipse(rect);850 if (m_impl) { 851 m_impl->drawEllipse(rect); 852 852 return; 853 853 } … … 895 895 return; 896 896 897 if ( isRecording()) {898 m_ displayListRecorder->drawPath(path);897 if (m_impl) { 898 m_impl->drawPath(path); 899 899 return; 900 900 } … … 1003 1003 return; 1004 1004 1005 if ( isRecording()) {1006 m_ displayListRecorder->fillPath(path);1005 if (m_impl) { 1006 m_impl->fillPath(path); 1007 1007 return; 1008 1008 } … … 1024 1024 1025 1025 FloatRect boundingRect = path.fastBoundingRect(); 1026 autodrawFunction = [this, &path](ID2D1RenderTarget* renderTarget) {1026 WTF::Function<void(ID2D1RenderTarget*)> drawFunction = [this, &path](ID2D1RenderTarget* renderTarget) { 1027 1027 renderTarget->FillGeometry(path.platformPath(), m_state.fillGradient->createPlatformGradientIfNecessary(renderTarget)); 1028 1028 }; … … 1057 1057 return; 1058 1058 1059 if ( isRecording()) {1060 m_ displayListRecorder->strokePath(path);1059 if (m_impl) { 1060 m_impl->strokePath(path); 1061 1061 return; 1062 1062 } … … 1071 1071 D2DContextStateSaver stateSaver(*m_data); 1072 1072 auto boundingRect = path.fastBoundingRect(); 1073 autodrawFunction = [this, &path](ID2D1RenderTarget* renderTarget) {1073 WTF::Function<void(ID2D1RenderTarget*)> drawFunction = [this, &path](ID2D1RenderTarget* renderTarget) { 1074 1074 renderTarget->DrawGeometry(path.platformPath(), m_state.strokeGradient->createPlatformGradientIfNecessary(renderTarget)); 1075 1075 }; … … 1102 1102 return; 1103 1103 1104 if ( isRecording()) {1105 m_ displayListRecorder->fillRect(rect);1104 if (m_impl) { 1105 m_impl->fillRect(rect); 1106 1106 return; 1107 1107 } … … 1112 1112 context->SetTags(1, __LINE__); 1113 1113 D2DContextStateSaver stateSaver(*m_data); 1114 autodrawFunction = [this, rect](ID2D1RenderTarget* renderTarget) {1114 WTF::Function<void(ID2D1RenderTarget*)> drawFunction = [this, rect](ID2D1RenderTarget* renderTarget) { 1115 1115 const D2D1_RECT_F d2dRect = rect; 1116 1116 renderTarget->FillRectangle(&d2dRect, m_state.fillGradient->createPlatformGradientIfNecessary(renderTarget)); … … 1149 1149 return; 1150 1150 1151 if ( isRecording()) {1152 m_ displayListRecorder->fillRect(rect, color);1151 if (m_impl) { 1152 m_impl->fillRect(rect, color); 1153 1153 return; 1154 1154 } … … 1177 1177 return; 1178 1178 1179 ASSERT(! isRecording());1179 ASSERT(!m_impl); 1180 1180 1181 1181 auto context = platformContext(); … … 1218 1218 return; 1219 1219 1220 if ( isRecording()) {1221 m_ displayListRecorder->fillRectWithRoundedHole(rect, roundedHoleRect, color);1220 if (m_impl) { 1221 m_impl->fillRectWithRoundedHole(rect, roundedHoleRect, color); 1222 1222 return; 1223 1223 } … … 1265 1265 return; 1266 1266 1267 if ( isRecording()) {1268 m_ displayListRecorder->clip(rect);1267 if (m_impl) { 1268 m_impl->clip(rect); 1269 1269 return; 1270 1270 } … … 1278 1278 return; 1279 1279 1280 if ( isRecording()) {1281 m_ displayListRecorder->clipOut(rect);1280 if (m_impl) { 1281 m_impl->clipOut(rect); 1282 1282 return; 1283 1283 } … … 1294 1294 return; 1295 1295 1296 if ( isRecording()) {1297 m_ displayListRecorder->clipOut(path);1296 if (m_impl) { 1297 m_impl->clipOut(path); 1298 1298 return; 1299 1299 } … … 1319 1319 return; 1320 1320 1321 if ( isRecording()) {1322 m_ displayListRecorder->clipPath(path, clipRule);1321 if (m_impl) { 1322 m_impl->clipPath(path, clipRule); 1323 1323 return; 1324 1324 } … … 1341 1341 return IntRect(); 1342 1342 1343 if ( isRecording()) {1343 if (m_impl) { 1344 1344 WTFLogAlways("Getting the clip bounds not yet supported with display lists"); 1345 1345 return IntRect(-2048, -2048, 4096, 4096); // FIXME: display lists. … … 1375 1375 return; 1376 1376 1377 ASSERT(! isRecording());1377 ASSERT(!m_impl); 1378 1378 1379 1379 save(); … … 1422 1422 m_data->endTransparencyLayer(); 1423 1423 1424 ASSERT(! isRecording());1424 ASSERT(!m_impl); 1425 1425 1426 1426 m_state.alpha = m_data->currentGlobalAlpha(); … … 1462 1462 return; 1463 1463 1464 if ( isRecording()) {1464 if (m_impl) { 1465 1465 // Maybe this should be part of the state. 1466 m_ displayListRecorder->setMiterLimit(limit);1466 m_impl->setMiterLimit(limit); 1467 1467 return; 1468 1468 } … … 1476 1476 return; 1477 1477 1478 if ( isRecording()) {1479 m_ displayListRecorder->clearRect(rect);1478 if (m_impl) { 1479 m_impl->clearRect(rect); 1480 1480 return; 1481 1481 } … … 1505 1505 return; 1506 1506 1507 if ( isRecording()) {1508 m_ displayListRecorder->strokeRect(rect, lineWidth);1507 if (m_impl) { 1508 m_impl->strokeRect(rect, lineWidth); 1509 1509 return; 1510 1510 } 1511 1511 1512 1512 if (m_state.strokeGradient) { 1513 autodrawFunction = [this, rect, lineWidth](ID2D1RenderTarget* renderTarget) {1513 WTF::Function<void(ID2D1RenderTarget*)> drawFunction = [this, rect, lineWidth](ID2D1RenderTarget* renderTarget) { 1514 1514 renderTarget->SetTags(1, __LINE__); 1515 1515 const D2D1_RECT_F d2dRect = rect; … … 1540 1540 return; 1541 1541 1542 if ( isRecording()) {1543 m_ displayListRecorder->setLineCap(cap);1542 if (m_impl) { 1543 m_impl->setLineCap(cap); 1544 1544 return; 1545 1545 } … … 1553 1553 return; 1554 1554 1555 if ( isRecording()) {1556 m_ displayListRecorder->setLineDash(dashes, dashOffset);1555 if (m_impl) { 1556 m_impl->setLineDash(dashes, dashOffset); 1557 1557 return; 1558 1558 } … … 1575 1575 return; 1576 1576 1577 if ( isRecording()) {1578 m_ displayListRecorder->setLineJoin(join);1577 if (m_impl) { 1578 m_impl->setLineJoin(join); 1579 1579 return; 1580 1580 } … … 1593 1593 return; 1594 1594 1595 if ( isRecording()) {1596 m_ displayListRecorder->scale(size);1595 if (m_impl) { 1596 m_impl->scale(size); 1597 1597 return; 1598 1598 } … … 1607 1607 return; 1608 1608 1609 if ( isRecording()) {1610 m_ displayListRecorder->rotate(angle);1609 if (m_impl) { 1610 m_impl->rotate(angle); 1611 1611 return; 1612 1612 } … … 1621 1621 return; 1622 1622 1623 if ( isRecording()) {1624 m_ displayListRecorder->translate(x, y);1623 if (m_impl) { 1624 m_impl->translate(x, y); 1625 1625 return; 1626 1626 } … … 1635 1635 return; 1636 1636 1637 if ( isRecording()) {1638 m_ displayListRecorder->concatCTM(transform);1637 if (m_impl) { 1638 m_impl->concatCTM(transform); 1639 1639 return; 1640 1640 } … … 1649 1649 return; 1650 1650 1651 if ( isRecording()) {1651 if (m_impl) { 1652 1652 WTFLogAlways("GraphicsContext::setCTM() is not compatible with recording contexts."); 1653 1653 return; … … 1663 1663 return AffineTransform(); 1664 1664 1665 if ( isRecording()) {1665 if (m_impl) { 1666 1666 WTFLogAlways("GraphicsContext::getCTM() is not yet compatible with recording contexts."); 1667 1667 return AffineTransform(); … … 1678 1678 return rect; 1679 1679 1680 if ( isRecording()) {1680 if (m_impl) { 1681 1681 WTFLogAlways("GraphicsContext::roundToDevicePixels() is not yet compatible with recording contexts."); 1682 1682 return rect; … … 1704 1704 return; 1705 1705 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()); 1708 1708 return; 1709 1709 } … … 1717 1717 return; 1718 1718 1719 if ( isRecording()) {1719 if (m_impl) { 1720 1720 WTFLogAlways("GraphicsContext::setURLForRect() is not yet compatible with recording contexts."); 1721 1721 return; // FIXME for display lists. … … 1760 1760 return; 1761 1761 1762 if ( isRecording())1762 if (m_impl) 1763 1763 return; 1764 1764 … … 1773 1773 1774 1774 // FIXME 1775 if ( isRecording())1775 if (m_impl) 1776 1776 return false; 1777 1777 … … 1787 1787 1788 1788 // FIXME 1789 if ( isRecording())1789 if (m_impl) 1790 1790 return; 1791 1791 … … 1799 1799 1800 1800 // FIXME 1801 if ( isRecording())1801 if (m_impl) 1802 1802 return false; 1803 1803 … … 1842 1842 return; 1843 1843 1844 ASSERT(! isRecording());1844 ASSERT(!m_impl); 1845 1845 1846 1846 auto antialiasMode = enable ? D2D1_ANTIALIAS_MODE_PER_PRIMITIVE : D2D1_ANTIALIAS_MODE_ALIASED; … … 1853 1853 return; 1854 1854 1855 ASSERT(! isRecording());1855 ASSERT(!m_impl); 1856 1856 1857 1857 auto fontSmoothingMode = enable ? D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE : D2D1_TEXT_ANTIALIAS_MODE_ALIASED; … … 1873 1873 return; 1874 1874 1875 ASSERT(! isRecording());1875 ASSERT(!m_impl); 1876 1876 1877 1877 D2D1_BLEND_MODE targetBlendMode = D2D1_BLEND_MODE_SCREEN; … … 1995 1995 return; 1996 1996 1997 ASSERT(! isRecording());1997 ASSERT(!m_impl); 1998 1998 1999 1999 if (m_state.fillGradient || m_state.fillPattern) { … … 2017 2017 return; 2018 2018 2019 ASSERT(! isRecording());2019 ASSERT(!m_impl); 2020 2020 2021 2021 if (m_state.strokeGradient || m_state.strokePattern) { -
trunk/Source/WebCore/platform/graphics/win/GraphicsLayerDirect2D.cpp
r236016 r237394 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 54 54 return layer; 55 55 } 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)); 60 59 } 61 60 -
trunk/Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.cpp
r237009 r237394 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 148 148 row[basex + 3] = alpha; 149 149 } 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]; 151 151 } 152 152 -
trunk/Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.h
r228218 r237394 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 23 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 24 */ 25 26 #pragma once 25 27 26 28 #include "Image.h" -
trunk/Source/WebCore/platform/graphics/win/ImageBufferDirect2D.cpp
r233122 r237394 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 63 63 IntSize scaledSize = ImageBuffer::compatibleBufferSize(size, context); 64 64 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)); 66 66 67 67 if (!success) … … 73 73 } 74 74 75 ImageBuffer::ImageBuffer(const FloatSize& size, float resolutionScale, ColorSpace /*colorSpace*/, RenderingMode renderingMode, const GraphicsContext* targetContext, bool& success)75 ImageBuffer::ImageBuffer(const FloatSize& size, float resolutionScale, ColorSpace /*colorSpace*/, RenderingMode renderingMode, const HostWindow*, const GraphicsContext* targetContext, bool& success) 76 76 : m_logicalSize(size) 77 77 , m_resolutionScale(resolutionScale) … … 116 116 } 117 117 118 ImageBuffer::ImageBuffer(const FloatSize& size, float resolutionScale, ColorSpace imageColorSpace, RenderingMode renderingMode, bool& success)119 : ImageBuffer(size, resolutionScale, imageColorSpace, renderingMode, nullptr, success)118 ImageBuffer::ImageBuffer(const FloatSize& size, float resolutionScale, ColorSpace imageColorSpace, RenderingMode renderingMode, const HostWindow*, bool& success) 119 : ImageBuffer(size, resolutionScale, imageColorSpace, renderingMode, nullptr, nullptr, success) 120 120 { 121 121 } -
trunk/Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.cpp
r222151 r237394 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 57 57 } 58 58 59 size_t ImageDecoderDirect2D::bytesDecodedToDetermineProperties() 59 size_t ImageDecoderDirect2D::bytesDecodedToDetermineProperties() const 60 60 { 61 61 // Set to match value used for CoreGraphics. … … 76 76 EncodedDataStatus ImageDecoderDirect2D::encodedDataStatus() const 77 77 { 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; 80 83 } 81 84 … … 113 116 RepetitionCount ImageDecoderDirect2D::repetitionCount() const 114 117 { 118 if (!m_nativeDecoder) 119 return RepetitionCountNone; 120 121 // FIXME: Identify image type, and determine proper repetition count. 115 122 return RepetitionCountNone; 116 123 } … … 151 158 ImageOrientation ImageDecoderDirect2D::frameOrientationAtIndex(size_t index) const 152 159 { 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. 154 174 return ImageOrientation(); 155 175 } 156 176 157 float ImageDecoderDirect2D::frameDurationAtIndex(size_t index) const 158 { 159 notImplemented(); 160 return 0; 161 } 162 163 bool ImageDecoderDirect2D::frameAllowSubsamplingAtIndex(size_t) const 164 { 177 Seconds 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 192 bool 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. 165 203 notImplemented(); 166 204 return true; … … 169 207 bool ImageDecoderDirect2D::frameHasAlphaAtIndex(size_t index) const 170 208 { 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. 171 218 notImplemented(); 172 219 return true; … … 187 234 } 188 235 189 NativeImagePtr ImageDecoderDirect2D::createFrameImageAtIndex(size_t index, SubsamplingLevel subsamplingLevel, const DecodingOptions&) const236 NativeImagePtr ImageDecoderDirect2D::createFrameImageAtIndex(size_t index, SubsamplingLevel subsamplingLevel, const DecodingOptions&) 190 237 { 191 238 if (!m_nativeDecoder || !m_renderTarget) … … 232 279 233 280 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 } 237 288 } 238 289 -
trunk/Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.h
r225616 r237394 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 50 50 static bool supportsMediaType(MediaType type) { return type == MediaType::Image; } 51 51 52 s tatic size_t bytesDecodedToDetermineProperties();52 size_t bytesDecodedToDetermineProperties() const final; 53 53 54 54 String filenameExtension() const final; … … 67 67 ImageOrientation frameOrientationAtIndex(size_t) const final; 68 68 69 floatframeDurationAtIndex(size_t) const final;69 Seconds frameDurationAtIndex(size_t) const final; 70 70 bool frameHasAlphaAtIndex(size_t) const final; 71 71 bool frameAllowSubsamplingAtIndex(size_t) const final; 72 72 unsigned frameBytesAtIndex(size_t, SubsamplingLevel = SubsamplingLevel::Default) const final; 73 73 74 NativeImagePtr createFrameImageAtIndex(size_t, SubsamplingLevel = SubsamplingLevel::Default, const DecodingOptions& = DecodingOptions(DecodingMode::Synchronous)) constfinal;74 NativeImagePtr createFrameImageAtIndex(size_t, SubsamplingLevel = SubsamplingLevel::Default, const DecodingOptions& = DecodingOptions(DecodingMode::Synchronous)) final; 75 75 76 76 void setData(SharedBuffer&, bool allDataReceived) final; -
trunk/Source/WebCore/platform/graphics/win/ImageDirect2D.cpp
r234610 r237394 1 1 /* 2 * Copyright (C) 2006-201 6Apple Inc. All rights reserved.2 * Copyright (C) 2006-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 82 82 size_t currentFrame = m_currentFrame; 83 83 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()); 85 85 m_currentFrame = currentFrame; 86 86 return; … … 90 90 // No image of the correct size was found, fallback to drawing the current frame 91 91 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()); 93 93 } 94 94 -
trunk/Source/WebCore/platform/graphics/win/PatternDirect2D.cpp
r216702 r237394 49 49 brushProperties.opacity = alpha; 50 50 51 auto patternImage = tileImage();51 auto& patternImage = tileImage(); 52 52 53 53 auto platformContext = context.platformContext();
Note: See TracChangeset
for help on using the changeset viewer.