Diff
Modified: trunk/Source/WebCore/ChangeLog (247840 => 247841)
--- trunk/Source/WebCore/ChangeLog 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/ChangeLog 2019-07-25 22:02:00 UTC (rev 247841)
@@ -1,3 +1,92 @@
+2019-07-25 Brent Fulgham <[email protected]>
+
+ Use IWICBitmap (rather than ID2D1Bitmap) for NativeImagePtr on FTW
+ https://bugs.webkit.org/show_bug.cgi?id=200093
+
+ Reviewed by Dean Jackson.
+
+ When I wrote the original Direct2D code, I did not realize that the backing memory for the
+ ID2D1Bitmap was inaccessible since it is effectively a representation of GPU memory. There
+ is no API to access or modify the pixels.
+
+ Instead, MSDN documentation indicates that we should be using IWICBitmap objects, which are
+ converted to ID2D1Bitmap objects when things are ready to be rendered.
+
+ This makes it possible to use the TextureMapper backend to do efficient compositing and tile
+ drawing, since the data backing the bitmap can now be accessed and manipulated, allowing us
+ to support filters and other effects.
+
+ * PlatformFTW.cmake:
+ * platform/MIMETypeRegistry.cpp:
+ (WebCore::supportedImageMIMETypesForEncoding):
+ * platform/graphics/ANGLEWebKitBridge.h:
+ * platform/graphics/GraphicsContext.h:
+ * platform/graphics/ImageBuffer.h:
+ * platform/graphics/NativeImage.h:
+ * platform/graphics/OpenGLShims.h:
+ * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
+ (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):
+ * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
+ (WebCore::GraphicsContext3D::GraphicsContext3D):
+ (WebCore::GraphicsContext3D::platformLayer const):
+ * platform/graphics/texmap/BitmapTexture.cpp:
+ (WebCore::BitmapTexture::updateContents):
+ * platform/graphics/texmap/BitmapTextureGL.cpp:
+ (WebCore::BitmapTextureGL::updateContents):
+ * platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp:
+ (WebCore::GraphicsContext3D::~GraphicsContext3D):
+ * platform/graphics/win/GraphicsContextDirect2D.cpp:
+ (WebCore::GraphicsContext::GraphicsContext):
+ (WebCore::GraphicsContext::platformInit):
+ (WebCore::GraphicsContextPlatformPrivate::setAlpha):
+ (WebCore::GraphicsContext::drawNativeImage):
+ (WebCore::GraphicsContext::drawDeviceBitmap):
+ (WebCore::GraphicsContext::releaseWindowsContext):
+ (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
+ (WebCore::GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate):
+ (WebCore::GraphicsContextPlatformPrivate::beginDraw):
+ (WebCore::GraphicsContextPlatformPrivate::endDraw):
+ (WebCore::GraphicsContext::drawPattern):
+ (WebCore::GraphicsContext::clipPath):
+ * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h:
+ * platform/graphics/win/ImageBufferDataDirect2D.cpp:
+ (WebCore::ImageBufferData::getData const):
+ (WebCore::ImageBufferData::putData):
+ * platform/graphics/win/ImageBufferDataDirect2D.h:
+ (): Deleted.
+ * platform/graphics/win/ImageBufferDirect2D.cpp:
+ (WebCore::ImageBuffer::createCompatibleBuffer):
+ (WebCore::ImageBuffer::ImageBuffer):
+ (WebCore::createCroppedImageIfNecessary):
+ (WebCore::createBitmapImageAfterScalingIfNeeded):
+ (WebCore::ImageBuffer::copyImage const):
+ (WebCore::ImageBuffer::sinkIntoNativeImage):
+ (WebCore::ImageBuffer::copyNativeImage const):
+ (WebCore::ImageBuffer::draw):
+ * platform/graphics/win/ImageDecoderDirect2D.cpp:
+ (WebCore::ImageDecoderDirect2D::createFrameImageAtIndex):
+ * platform/graphics/win/ImageDirect2D.cpp:
+ (WebCore::BitmapImage::drawFrameMatchingSourceSize):
+ * platform/graphics/win/NativeImageDirect2D.cpp:
+ (WebCore::imagingFactory):
+ (WebCore::nativeImageSize):
+ (WebCore::nativeImageHasAlpha):
+ (WebCore::nativeImageSinglePixelSolidColor):
+ (WebCore::drawNativeImage):
+ (WebCore::clearNativeImageSubimages):
+ * platform/graphics/win/PathDirect2D.cpp:
+ (WebCore::Path::strokeContains const):
+ * platform/graphics/win/PatternDirect2D.cpp:
+ (WebCore::Pattern::createPlatformPattern const):
+ * platform/win/PasteboardWin.cpp:
+ (WebCore::Pasteboard::read):
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::shouldRespectImageOrientation const):
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::adjustTiledBackingCoverage):
+ * svg/graphics/SVGImage.cpp:
+ (WebCore::SVGImage::nativeImage):
+
2019-07-25 Ryosuke Niwa <[email protected]>
REGRESSION (r243637): Some web fonts fail to load on Google docs
Modified: trunk/Source/WebCore/PAL/ChangeLog (247840 => 247841)
--- trunk/Source/WebCore/PAL/ChangeLog 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/PAL/ChangeLog 2019-07-25 22:02:00 UTC (rev 247841)
@@ -1,3 +1,12 @@
+2019-07-25 Brent Fulgham <[email protected]>
+
+ Use IWICBitmap (rather than ID2D1Bitmap) for NativeImagePtr on FTW
+ https://bugs.webkit.org/show_bug.cgi?id=200093
+
+ Reviewed by Dean Jackson.
+
+ * pal/PlatformFTW.cmake:
+
2019-07-24 Yusuke Suzuki <[email protected]>
[bmalloc] Add IsoHeap test to ensure that IsoHeap pages are not allocating too large VA
Modified: trunk/Source/WebCore/PAL/pal/PlatformFTW.cmake (247840 => 247841)
--- trunk/Source/WebCore/PAL/pal/PlatformFTW.cmake 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/PAL/pal/PlatformFTW.cmake 2019-07-25 22:02:00 UTC (rev 247841)
@@ -5,8 +5,18 @@
crypto/openssl/CryptoDigestOpenSSL.cpp
crypto/win/CryptoDigestWin.cpp
+
+ system/ClockGeneric.cpp
+
+ system/win/SoundWin.cpp
+
+ text/KillRing.cpp
+
+ win/LoggingWin.cpp
)
list(APPEND PAL_PRIVATE_INCLUDE_DIRECTORIES
"${WEBKIT_LIBRARIES_DIR}/include"
)
+
+set(PAL_OUTPUT_NAME PAL${DEBUG_SUFFIX})
Modified: trunk/Source/WebCore/PlatformFTW.cmake (247840 => 247841)
--- trunk/Source/WebCore/PlatformFTW.cmake 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/PlatformFTW.cmake 2019-07-25 22:02:00 UTC (rev 247841)
@@ -1,7 +1,6 @@
include(platform/Curl.cmake)
include(platform/ImageDecoders.cmake)
-# FIXME: Enable
-# include(platform/TextureMapper.cmake)
+include(platform/TextureMapper.cmake)
list(APPEND WebCore_PRIVATE_INCLUDE_DIRECTORIES
"${DirectX_INCLUDE_DIRS}"
@@ -14,40 +13,176 @@
"${WEBCORE_DIR}/platform/graphics/win"
"${WEBCORE_DIR}/platform/mediacapabilities"
"${WEBCORE_DIR}/platform/network/win"
- "${WEBCORE_DIR}/platform/win")
+ "${WEBCORE_DIR}/platform/win"
+)
+list(APPEND WebCore_INCLUDE_DIRECTORIES
+ "${DERIVED_SOURCES_DIR}/ForwardingHeaders"
+)
+
list(APPEND WebCore_SOURCES
+ accessibility/win/AXObjectCacheWin.cpp
+ accessibility/win/AccessibilityObjectWin.cpp
+ accessibility/win/AccessibilityObjectWrapperWin.cpp
+
+ editing/win/EditorWin.cpp
+
+ html/HTMLSelectElementWin.cpp
+
+ page/win/DragControllerWin.cpp
+ page/win/EventHandlerWin.cpp
+ page/win/FrameWin.cpp
page/win/FrameWinDirect2D.cpp
+ platform/Cursor.cpp
+ platform/LocalizedStrings.cpp
+ platform/StaticPasteboard.cpp
+
+ platform/audio/PlatformMediaSessionManager.cpp
+
+ platform/generic/KeyedDecoderGeneric.cpp
+ platform/generic/KeyedEncoderGeneric.cpp
+
+ platform/graphics/GLContext.cpp
+ platform/graphics/GraphicsContext3DPrivate.cpp
+ platform/graphics/PlatformDisplay.cpp
+
+ platform/graphics/egl/GLContextEGL.cpp
+
+ platform/graphics/opengl/Extensions3DOpenGLCommon.cpp
+ platform/graphics/opengl/Extensions3DOpenGLES.cpp
+ platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
+ platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp
+ platform/graphics/opengl/TemporaryOpenGLSetting.cpp
+
+ platform/graphics/opentype/OpenTypeUtilities.cpp
+
+ platform/graphics/win/ColorDirect2D.cpp
+ platform/graphics/win/ComplexTextControllerDirectWrite.cpp
+ platform/graphics/win/DIBPixelData.cpp
+ platform/graphics/win/FloatPointDirect2D.cpp
+ platform/graphics/win/FloatRectDirect2D.cpp
+ platform/graphics/win/FloatSizeDirect2D.cpp
+ platform/graphics/win/FontCacheWin.cpp
platform/graphics/win/FontCascadeDirect2D.cpp
platform/graphics/win/FontCustomPlatformData.cpp
platform/graphics/win/FontPlatformDataDirect2D.cpp
+ platform/graphics/win/FontPlatformDataWin.cpp
+ platform/graphics/win/FontWin.cpp
platform/graphics/win/GlyphPageTreeNodeDirect2D.cpp
platform/graphics/win/GradientDirect2D.cpp
+ platform/graphics/win/GraphicsContext3DDirect2D.cpp
platform/graphics/win/GraphicsContextDirect2D.cpp
- platform/graphics/win/GraphicsLayerDirect2D.cpp
+ platform/graphics/win/GraphicsContextWin.cpp
+ platform/graphics/win/IconWin.cpp
platform/graphics/win/ImageBufferDataDirect2D.cpp
platform/graphics/win/ImageBufferDirect2D.cpp
platform/graphics/win/ImageDecoderDirect2D.cpp
platform/graphics/win/ImageDirect2D.cpp
+ platform/graphics/win/ImageWin.cpp
+ platform/graphics/win/IntPointWin.cpp
+ platform/graphics/win/IntRectWin.cpp
+ platform/graphics/win/IntSizeWin.cpp
platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp
platform/graphics/win/NativeImageDirect2D.cpp
platform/graphics/win/PathDirect2D.cpp
platform/graphics/win/PatternDirect2D.cpp
+ platform/graphics/win/SimpleFontDataWin.cpp
platform/graphics/win/SimpleFontDataDirect2D.cpp
platform/graphics/win/TextAnalyzerHelper.cpp
+ platform/graphics/win/TransformationMatrixDirect2D.cpp
+ platform/graphics/win/TransformationMatrixWin.cpp
+ platform/graphics/win/UniscribeController.cpp
platform/network/win/CurlSSLHandleWin.cpp
+ platform/network/win/DownloadBundleWin.cpp
+ platform/network/win/NetworkStateNotifierWin.cpp
+ platform/text/Hyphenation.cpp
platform/text/win/LocaleWin.cpp
+ platform/win/BString.cpp
+ platform/win/BitmapInfo.cpp
+ platform/win/ClipboardUtilitiesWin.cpp
+ platform/win/CursorWin.cpp
+ platform/win/DefWndProcWindowClass.cpp
platform/win/DelayLoadedModulesEnumerator.cpp
+ platform/win/DragDataWin.cpp
platform/win/DragImageDirect2D.cpp
+ platform/win/DragImageWin.cpp
+ platform/win/EventLoopWin.cpp
+ platform/win/GDIObjectCounter.cpp
+ platform/win/GDIUtilities.cpp
platform/win/ImportedFunctionsEnumerator.cpp
platform/win/ImportedModulesEnumerator.cpp
+ platform/win/KeyEventWin.cpp
+ platform/win/LocalizedStringsWin.cpp
+ platform/win/LoggingWin.cpp
+ platform/win/MIMETypeRegistryWin.cpp
+ platform/win/MainThreadSharedTimerWin.cpp
platform/win/PEImage.cpp
+ platform/win/PasteboardWin.cpp
+ platform/win/PlatformMouseEventWin.cpp
+ platform/win/PlatformScreenWin.cpp
+ platform/win/PopupMenuWin.cpp
+ platform/win/SSLKeyGeneratorWin.cpp
+ platform/win/ScrollbarThemeWin.cpp
+ platform/win/SearchPopupMenuDB.cpp
+ platform/win/SearchPopupMenuWin.cpp
+ platform/win/SharedBufferWin.cpp
+ platform/win/StructuredExceptionHandlerSuppressor.cpp
+ platform/win/SystemInfo.cpp
+ platform/win/UserAgentWin.cpp
+ platform/win/WCDataObject.cpp
+ platform/win/WebCoreBundleWin.cpp
+ platform/win/WebCoreInstanceHandle.cpp
+ platform/win/WebCoreTextRenderer.cpp
+ platform/win/WheelEventWin.cpp
+ platform/win/WidgetWin.cpp
+ platform/win/WindowMessageBroadcaster.cpp
+
+ rendering/RenderThemeWin.cpp
)
+list(APPEND WebCore_PRIVATE_FRAMEWORK_HEADERS
+ accessibility/win/AccessibilityObjectWrapperWin.h
+
+ page/win/FrameWin.h
+
+ platform/graphics/win/DIBPixelData.h
+ platform/graphics/win/FullScreenController.h
+ platform/graphics/win/FullScreenControllerClient.h
+ platform/graphics/win/ImageBufferDataDirect2D.h
+ platform/graphics/win/LocalWindowsContext.h
+ platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h
+ platform/graphics/win/SharedGDIObject.h
+
+ platform/win/BString.h
+ platform/win/BitmapInfo.h
+ platform/win/COMPtr.h
+ platform/win/DefWndProcWindowClass.h
+ platform/win/GDIObjectCounter.h
+ platform/win/GDIUtilities.h
+ platform/win/HWndDC.h
+ platform/win/PopupMenuWin.h
+ platform/win/ScrollbarThemeWin.h
+ platform/win/SearchPopupMenuDB.h
+ platform/win/SearchPopupMenuWin.h
+ platform/win/SystemInfo.h
+ platform/win/WCDataObject.h
+ platform/win/WebCoreBundleWin.h
+ platform/win/WebCoreInstanceHandle.h
+ platform/win/WebCoreTextRenderer.h
+ platform/win/WindowMessageBroadcaster.h
+ platform/win/WindowMessageListener.h
+ platform/win/WindowsTouch.h
+)
+
+list(APPEND WebCore_USER_AGENT_STYLE_SHEETS
+ ${WEBCORE_DIR}/css/themeWin.css
+ ${WEBCORE_DIR}/css/themeWinQuirks.css
+)
+
list(APPEND WebCore_LIBRARIES
${DirectX_LIBRARIES}
comctl32
@@ -65,4 +200,24 @@
shlwapi
)
+file(COPY
+ "${WEBCORE_DIR}/Modules/mediacontrols/mediaControlsApple.css"
+ "${WEBCORE_DIR}/Modules/mediacontrols/mediaControlsApple.js"
+ DESTINATION
+ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/WebKit.resources
+)
+
+if (EXISTS ${WEBKIT_LIBRARIES_DIR}/etc/ssl/cert.pem)
+ make_directory(${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/WebKit.resources/certificates)
+ file(COPY
+ ${WEBKIT_LIBRARIES_DIR}/etc/ssl/cert.pem
+ DESTINATION
+ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/WebKit.resources/certificates
+ )
+ file(RENAME
+ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/WebKit.resources/certificates/cert.pem
+ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/WebKit.resources/certificates/cacert.pem
+ )
+endif ()
+
set(WebCore_OUTPUT_NAME WebCore${DEBUG_SUFFIX})
Modified: trunk/Source/WebCore/platform/MIMETypeRegistry.cpp (247840 => 247841)
--- trunk/Source/WebCore/platform/MIMETypeRegistry.cpp 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/platform/MIMETypeRegistry.cpp 2019-07-25 22:02:00 UTC (rev 247841)
@@ -183,7 +183,7 @@
}());
#else
static NeverDestroyed<HashSet<String, ASCIICaseInsensitiveHash>> supportedImageMIMETypesForEncoding =std::initializer_list<String> {
-#if USE(CG)
+#if USE(CG) || USE(DIRECT2D)
// FIXME: Add Windows support for all the supported UTI's when a way to convert from MIMEType to UTI reliably is found.
// For now, only support PNG, JPEG and GIF. See <rdar://problem/6095286>.
"image/png"_s,
Modified: trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h (247840 => 247841)
--- trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h 2019-07-25 22:02:00 UTC (rev 247841)
@@ -61,6 +61,11 @@
#include "OpenGLShims.h"
#endif
+// FIXME
+#define GL_VERTEX_SHADER 0x8B31
+#define GL_FRAGMENT_SHADER 0x8B30
+//
+
namespace WebCore {
enum ANGLEShaderType {
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (247840 => 247841)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h 2019-07-25 22:02:00 UTC (rev 247841)
@@ -284,6 +284,14 @@
};
GraphicsContext(PaintInvalidationReasons);
+#if USE(DIRECT2D)
+ enum class BitmapRenderingContextType : uint8_t {
+ CPUMemory,
+ GPUMemory
+ };
+ WEBCORE_EXPORT GraphicsContext(PlatformGraphicsContext*, BitmapRenderingContextType);
+#endif
+
WEBCORE_EXPORT bool hasPlatformContext() const;
WEBCORE_EXPORT PlatformGraphicsContext* platformContext() const;
@@ -339,6 +347,10 @@
WEBCORE_EXPORT void drawNativeImage(const NativeImagePtr&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator = CompositeSourceOver, BlendMode = BlendMode::Normal, ImageOrientation = ImageOrientation());
#endif
+#if USE(DIRECT2D)
+ void drawDeviceBitmap(const COMPtr<ID2D1Bitmap>&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator = CompositeSourceOver, BlendMode = BlendMode::Normal, ImageOrientation = ImageOrientation());
+#endif
+
#if USE(CG) || USE(DIRECT2D)
void applyStrokePattern();
void applyFillPattern();
@@ -607,6 +619,7 @@
#if USE(DIRECT2D)
void platformInit(HDC, ID2D1RenderTarget**, RECT, bool hasAlpha = false);
+ void platformInit(PlatformGraphicsContext*, BitmapRenderingContextType);
void drawWithoutShadow(const FloatRect& boundingRect, const WTF::Function<void(ID2D1RenderTarget*)>&);
void drawWithShadow(const FloatRect& boundingRect, const WTF::Function<void(ID2D1RenderTarget*)>&);
#endif
Modified: trunk/Source/WebCore/platform/graphics/ImageBuffer.h (247840 => 247841)
--- trunk/Source/WebCore/platform/graphics/ImageBuffer.h 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/platform/graphics/ImageBuffer.h 2019-07-25 22:02:00 UTC (rev 247841)
@@ -144,8 +144,8 @@
static RetainPtr<CGImageRef> sinkIntoNativeImage(std::unique_ptr<ImageBuffer>);
void flushContext() const;
#elif USE(DIRECT2D)
- COMPtr<ID2D1Bitmap> copyNativeImage(BackingStoreCopy = CopyBackingStore) const;
- static COMPtr<ID2D1Bitmap> sinkIntoNativeImage(std::unique_ptr<ImageBuffer>);
+ COMPtr<IWICBitmap> copyNativeImage(BackingStoreCopy = CopyBackingStore) const;
+ static COMPtr<IWICBitmap> sinkIntoNativeImage(std::unique_ptr<ImageBuffer>);
void flushContext() const;
#endif
Modified: trunk/Source/WebCore/platform/graphics/NativeImage.h (247840 => 247841)
--- trunk/Source/WebCore/platform/graphics/NativeImage.h 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/platform/graphics/NativeImage.h 2019-07-25 22:02:00 UTC (rev 247841)
@@ -42,6 +42,7 @@
#if USE(DIRECT2D)
#include "COMPtr.h"
#include <d2d1.h>
+#include <wincodec.h>
#endif
namespace WebCore {
@@ -54,7 +55,7 @@
#if USE(CG)
typedef RetainPtr<CGImageRef> NativeImagePtr;
#elif USE(DIRECT2D)
-typedef COMPtr<ID2D1Bitmap> NativeImagePtr;
+typedef COMPtr<IWICBitmap> NativeImagePtr;
#elif USE(CAIRO)
typedef RefPtr<cairo_surface_t> NativeImagePtr;
#elif USE(WINGDI)
Modified: trunk/Source/WebCore/platform/graphics/OpenGLShims.h (247840 => 247841)
--- trunk/Source/WebCore/platform/graphics/OpenGLShims.h 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/platform/graphics/OpenGLShims.h 2019-07-25 22:02:00 UTC (rev 247841)
@@ -20,8 +20,13 @@
#ifndef OpenGLShims_h
#define OpenGLShims_h
+#if OS(WINDOWS)
#include <GL/gl.h>
+#include <GLES2/gl2.h>
+#else
+#include <GL/gl.h>
#include <GL/glext.h>
+#endif
#if defined(GL_ES_VERSION_2_0)
// Some openGL ES systems miss this typedef.
@@ -37,6 +42,7 @@
#if OS(WINDOWS)
#define GLAPIENTRY __stdcall
+typedef char GLchar;
#else
#define GLAPIENTRY
#endif
Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp (247840 => 247841)
--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp 2019-07-25 22:02:00 UTC (rev 247841)
@@ -249,7 +249,7 @@
}
#endif
-#if PLATFORM(WIN) && !USE(CAIRO)
+#if PLATFORM(WIN) && USE(CA)
RefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3DAttributes attributes, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
{
// This implementation doesn't currently support rendering directly to the HostWindow.
Modified: trunk/Source/WebCore/platform/graphics/texmap/BitmapTexture.cpp (247840 => 247841)
--- trunk/Source/WebCore/platform/graphics/texmap/BitmapTexture.cpp 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/platform/graphics/texmap/BitmapTexture.cpp 2019-07-25 22:02:00 UTC (rev 247841)
@@ -27,6 +27,7 @@
#include "config.h"
#include "BitmapTexture.h"
+#include "GraphicsContext.h"
#include "GraphicsLayer.h"
#include "ImageBuffer.h"
#include "TextureMapper.h"
@@ -54,6 +55,11 @@
sourceLayer->paintGraphicsLayerContents(context, sourceRect);
+#if USE(DIRECT2D)
+ // We can't access the bits in the image buffer with an active beginDraw.
+ context.endDraw();
+#endif
+
RefPtr<Image> image = imageBuffer->copyImage(DontCopyBackingStore);
if (!image)
return;
Modified: trunk/Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp (247840 => 247841)
--- trunk/Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp 2019-07-25 22:02:00 UTC (rev 247841)
@@ -28,6 +28,7 @@
#include "FilterOperations.h"
#include "Image.h"
#include "LengthFunctions.h"
+#include "NativeImage.h"
#include "NotImplemented.h"
#include "TextureMapperShaderProgram.h"
#include "Timer.h"
@@ -42,6 +43,11 @@
#include <wtf/text/CString.h>
#endif
+#if USE(DIRECT2D)
+#include <d2d1.h>
+#include <wincodec.h>
+#endif
+
#if OS(DARWIN)
#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367
#endif
@@ -156,6 +162,29 @@
cairo_surface_t* surface = frameImage.get();
imageData = reinterpret_cast<const char*>(cairo_image_surface_get_data(surface));
bytesPerLine = cairo_image_surface_get_stride(surface);
+#elif USE(DIRECT2D)
+ // We can't access the bitmap's memory when it is in the middle of a BeginDraw/EndDraw
+ WICRect rcLock = { 0, 0, targetRect.width(), targetRect.height() };
+
+ COMPtr<IWICBitmapLock> bitmapData;
+ HRESULT hr = frameImage->Lock(&rcLock, WICBitmapLockRead, &bitmapData);
+ if (!SUCCEEDED(hr))
+ return;
+
+ UINT stride = 0;
+ hr = bitmapData->GetStride(&stride);
+ if (!SUCCEEDED(hr))
+ return;
+
+ bytesPerLine = stride;
+
+ UINT bufferSize = 0;
+ WICInProcPointer dataPtr = nullptr;
+ hr = bitmapData->GetDataPointer(&bufferSize, &dataPtr);
+ if (!SUCCEEDED(hr))
+ return;
+
+ imageData = reinterpret_cast<char*>(dataPtr);
#endif
updateContents(imageData, targetRect, offset, bytesPerLine);
Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp (247840 => 247841)
--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp 2019-07-25 22:02:00 UTC (rev 247841)
@@ -257,8 +257,10 @@
::glDeleteTextures(1, &m_intermediateTexture);
#endif
+#if USE(CAIRO)
if (m_vao)
deleteVertexArray(m_vao);
+#endif
auto* activeContext = activeContexts().takeLast([this](auto* it) { return it == this; });
ASSERT_UNUSED(activeContext, !!activeContext);
Copied: trunk/Source/WebCore/platform/graphics/win/GraphicsContext3DDirect2D.cpp (from rev 247840, trunk/Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.h) (0 => 247841)
--- trunk/Source/WebCore/platform/graphics/win/GraphicsContext3DDirect2D.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/win/GraphicsContext3DDirect2D.cpp 2019-07-25 22:02:00 UTC (rev 247841)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "GraphicsContext3D.h"
+
+#if ENABLE(GRAPHICS_CONTEXT_3D) && USE(DIRECT2D)
+
+#include "COMPtr.h"
+#include "NotImplemented.h"
+#include <d2d1.h>
+#include <d2d1effects.h>
+
+namespace WebCore {
+
+GraphicsContext3D::ImageExtractor::~ImageExtractor() = default;
+
+bool GraphicsContext3D::ImageExtractor::extractImage(bool premultiplyAlpha, bool ignoreGammaAndColorProfile)
+{
+ if (!m_image)
+ return false;
+
+ notImplemented();
+
+ return true;
+}
+
+void GraphicsContext3D::paintToCanvas(const unsigned char* imagePixels, const IntSize& imageSize, const IntSize& canvasSize, GraphicsContext& context)
+{
+ if (!imagePixels || imageSize.isEmpty() || canvasSize.isEmpty())
+ return;
+
+ notImplemented();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(GRAPHICS_CONTEXT_3D) && USE(DIRECT2D)
Modified: trunk/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp (247840 => 247841)
--- trunk/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp 2019-07-25 22:02:00 UTC (rev 247841)
@@ -31,6 +31,7 @@
#include "FloatRoundedRect.h"
#include "GraphicsContextPlatformPrivateDirect2D.h"
#include "ImageBuffer.h"
+#include "ImageDecoderDirect2D.h"
#include "Logging.h"
#include "NotImplemented.h"
#include <d2d1.h>
@@ -54,7 +55,7 @@
// Create a DC render target.
auto targetProperties = D2D1::RenderTargetProperties(D2D1_RENDER_TARGET_TYPE_DEFAULT,
- D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE),
+ D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED),
0, 0, D2D1_RENDER_TARGET_USAGE_NONE, D2D1_FEATURE_LEVEL_DEFAULT);
HRESULT hr = GraphicsContext::systemFactory()->CreateDCRenderTarget(&targetProperties, renderTarget);
@@ -62,9 +63,14 @@
(*renderTarget)->BindDC(hdc, &rect);
- m_data = new GraphicsContextPlatformPrivate(*renderTarget);
+ m_data = new GraphicsContextPlatformPrivate(*renderTarget, BitmapRenderingContextType::GPUMemory);
}
+GraphicsContext::GraphicsContext(PlatformGraphicsContext* platformGraphicsContext, BitmapRenderingContextType rendererType)
+{
+ platformInit(platformGraphicsContext, rendererType);
+}
+
ID2D1Factory* GraphicsContext::systemFactory()
{
static ID2D1Factory* direct2DFactory = nullptr;
@@ -106,7 +112,7 @@
DIBPixelData pixelData(bitmap);
auto targetProperties = D2D1::RenderTargetProperties();
- targetProperties.pixelFormat = D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE);
+ targetProperties.pixelFormat = D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED);
COMPtr<ID2D1DCRenderTarget> renderTarget;
HRESULT hr = systemFactory()->CreateDCRenderTarget(&targetProperties, &renderTarget);
@@ -118,7 +124,7 @@
if (!SUCCEEDED(hr))
return;
- m_data = new GraphicsContextPlatformPrivate(renderTarget.get());
+ m_data = new GraphicsContextPlatformPrivate(renderTarget.get(), BitmapRenderingContextType::GPUMemory);
m_data->m_hdc = hdc;
// Make sure the context starts in sync with our state.
setPlatformFillColor(fillColor());
@@ -129,10 +135,15 @@
void GraphicsContext::platformInit(ID2D1RenderTarget* renderTarget)
{
+ platformInit(renderTarget, BitmapRenderingContextType::GPUMemory);
+}
+
+void GraphicsContext::platformInit(ID2D1RenderTarget* renderTarget, BitmapRenderingContextType renderingType)
+{
if (!renderTarget)
return;
- m_data = new GraphicsContextPlatformPrivate(renderTarget);
+ m_data = new GraphicsContextPlatformPrivate(renderTarget, renderingType);
// Make sure the context starts in sync with our state.
setPlatformFillColor(fillColor());
@@ -195,8 +206,18 @@
// FIXME: m_data->m_userToDeviceTransformKnownToBeIdentity = false;
}
-void GraphicsContext::drawNativeImage(const COMPtr<ID2D1Bitmap>& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, BlendMode blendMode, ImageOrientation orientation)
+void GraphicsContext::drawNativeImage(const COMPtr<IWICBitmap>& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, BlendMode blendMode, ImageOrientation orientation)
{
+ COMPtr<ID2D1Bitmap> deviceBitmap;
+ HRESULT hr = platformContext()->CreateBitmapFromWicBitmap(image.get(), &deviceBitmap);
+ if (!SUCCEEDED(hr))
+ return;
+
+ drawDeviceBitmap(deviceBitmap, imageSize, destRect, srcRect, op, blendMode, orientation);
+}
+
+void GraphicsContext::drawDeviceBitmap(const COMPtr<ID2D1Bitmap>& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, BlendMode blendMode, ImageOrientation orientation)
+{
if (paintingDisabled())
return;
@@ -281,7 +302,7 @@
DIBPixelData pixelData(sourceBitmap.get());
ASSERT(pixelData.bitsPerPixel() == 32);
- auto bitmapProperties = D2D1::BitmapProperties(D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE));
+ auto bitmapProperties = D2D1::BitmapProperties(D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED));
COMPtr<ID2D1Bitmap> bitmap;
HRESULT hr = platformContext()->CreateBitmap(pixelData.size(), pixelData.buffer(), pixelData.bytesPerRow(), &bitmapProperties, &bitmap);
@@ -322,13 +343,15 @@
{
}
-GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate(ID2D1RenderTarget* renderTarget)
+GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate(ID2D1RenderTarget* renderTarget, GraphicsContext::BitmapRenderingContextType renderingType)
: m_renderTarget(renderTarget)
+ , m_rendererType(renderingType)
{
if (!m_renderTarget)
return;
- beginDraw();
+ if (m_rendererType == GraphicsContext::BitmapRenderingContextType::GPUMemory)
+ beginDraw();
}
GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate()
@@ -336,7 +359,8 @@
if (!m_renderTarget)
return;
- endDraw();
+ if (beginDrawCount)
+ endDraw();
}
COMPtr<ID2D1SolidColorBrush> GraphicsContextPlatformPrivate::brushWithColor(const D2D1_COLOR_F& color)
@@ -424,6 +448,7 @@
{
ASSERT(m_renderTarget.get());
m_renderTarget->BeginDraw();
+ ++beginDrawCount;
}
void GraphicsContextPlatformPrivate::endDraw()
@@ -433,7 +458,9 @@
HRESULT hr = m_renderTarget->EndDraw(&first, &second);
if (!SUCCEEDED(hr))
- WTFLogAlways("Failed in GraphicsContextPlatformPrivate::endDraw: hr=%ld, first=%ld, second=%ld", hr, first, second);
+ WTFLogAlways("Failed in GraphicsContextPlatformPrivate::endDraw: hr=%xd, first=%ld, second=%ld", hr, first, second);
+
+ --beginDrawCount;
}
void GraphicsContextPlatformPrivate::restore()
@@ -579,6 +606,8 @@
// If we only want a subset of the bitmap, we need to create a cropped bitmap image. According to the documentation,
// this does not allocate new bitmap memory.
if (image.width() > destRect.width() || image.height() > destRect.height()) {
+ ASSERT(0);
+ /*
float dpiX = 0;
float dpiY = 0;
tileImage->GetDpi(&dpiX, &dpiY);
@@ -591,10 +620,16 @@
if (SUCCEEDED(hr))
tileImage = subImage;
}
+ */
}
+ COMPtr<ID2D1Bitmap> bitmap;
+ HRESULT hr = context->CreateBitmapFromWicBitmap(tileImage.get(), nullptr, &bitmap);
+ if (!SUCCEEDED(hr))
+ return;
+
COMPtr<ID2D1BitmapBrush> patternBrush;
- HRESULT hr = context->CreateBitmapBrush(tileImage.get(), &bitmapBrushProperties, &brushProperties, &patternBrush);
+ hr = context->CreateBitmapBrush(bitmap.get(), &bitmapBrushProperties, &brushProperties, &patternBrush);
ASSERT(SUCCEEDED(hr));
if (!SUCCEEDED(hr))
return;
Modified: trunk/Source/WebCore/platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h (247840 => 247841)
--- trunk/Source/WebCore/platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h 2019-07-25 22:02:00 UTC (rev 247841)
@@ -39,7 +39,7 @@
class GraphicsContextPlatformPrivate {
WTF_MAKE_FAST_ALLOCATED;
public:
- GraphicsContextPlatformPrivate(ID2D1RenderTarget*);
+ GraphicsContextPlatformPrivate(ID2D1RenderTarget*, GraphicsContext::BitmapRenderingContextType);
~GraphicsContextPlatformPrivate();
enum Direct2DLayerType { AxisAlignedClip, LayerClip };
@@ -98,6 +98,7 @@
void recomputeStrokeStyle();
COMPtr<ID2D1RenderTarget> m_renderTarget;
+ const GraphicsContext::BitmapRenderingContextType m_rendererType;
HashMap<uint32_t, COMPtr<ID2D1SolidColorBrush>> m_solidColoredBrushCache;
COMPtr<ID2D1SolidColorBrush> m_whiteBrush;
COMPtr<ID2D1SolidColorBrush> m_zeroBrush;
@@ -126,6 +127,8 @@
StrokeStyle m_strokeStyle { SolidStroke };
DashArray m_dashes;
+ unsigned beginDrawCount { 0 };
+
float m_miterLimit { 10.0f };
float m_dashOffset { 0 };
float m_patternWidth { 1.0f };
Modified: trunk/Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.cpp (247840 => 247841)
--- trunk/Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.cpp 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.cpp 2019-07-25 22:02:00 UTC (rev 247841)
@@ -44,8 +44,6 @@
RefPtr<Uint8ClampedArray> ImageBufferData::getData(AlphaPremultiplication, const IntRect& rect, const IntSize& size, bool /* accelerateRendering */, float /* resolutionScale */) const
{
- auto platformContext = context->platformContext();
-
auto numBytes = rect.area<RecordOverflow>() * 4;
if (numBytes.hasOverflowed())
return nullptr;
@@ -55,47 +53,31 @@
if (!resultData)
return nullptr;
- BitmapInfo bitmapInfo = BitmapInfo::createBottomUp(size);
+ WICRect rcLock = { 0, 0, rect.width(), rect.height() };
- void* pixels = nullptr;
- auto bitmap = adoptGDIObject(::CreateDIBSection(0, &bitmapInfo, DIB_RGB_COLORS, &pixels, 0, 0));
+ // We cannot access the data backing an IWICBitmap while an active draw session is open.
+ context->endDraw();
- HWndDC windowDC(nullptr);
- auto bitmapDC = adoptGDIObject(::CreateCompatibleDC(windowDC));
- HGDIOBJ oldBitmap = ::SelectObject(bitmapDC.get(), bitmap.get());
+ COMPtr<IWICBitmapLock> bitmapDataLock;
+ HRESULT hr = bitmapSource->Lock(&rcLock, WICBitmapLockRead, &bitmapDataLock);
+ if (SUCCEEDED(hr)) {
+ UINT bufferSize = 0;
+ WICInProcPointer dataPtr = nullptr;
+ hr = bitmapDataLock->GetDataPointer(&bufferSize, &dataPtr);
+ if (SUCCEEDED(hr))
+ memcpy(result->data(), reinterpret_cast<char*>(dataPtr), numBytes.unsafeGet());
+ }
- COMPtr<ID2D1GdiInteropRenderTarget> gdiRenderTarget;
- HRESULT hr = platformContext->QueryInterface(__uuidof(ID2D1GdiInteropRenderTarget), (void**)&gdiRenderTarget);
- if (FAILED(hr))
- return nullptr;
+ // Once we are done modifying the data, unlock the bitmap
+ bitmapDataLock = nullptr;
- HDC hdc = nullptr;
- hr = gdiRenderTarget->GetDC(D2D1_DC_INITIALIZE_MODE_COPY, &hdc);
+ context->beginDraw();
- BOOL ok = ::BitBlt(bitmapDC.get(), 0, 0, rect.width(), rect.height(), hdc, rect.x(), rect.y(), SRCCOPY);
-
- RECT updateRect = { 0, 0, 0, 0 };
- hr = gdiRenderTarget->ReleaseDC(&updateRect);
-
- if (!ok)
- return nullptr;
-
- memcpy(result->data(), pixels, numBytes.unsafeGet());
-
return result;
}
void ImageBufferData::putData(const Uint8ClampedArray& source, AlphaPremultiplication sourceFormat, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint, const IntSize& size, bool /* accelerateRendering */, float resolutionScale)
{
- auto platformContext = context->platformContext();
- COMPtr<ID2D1BitmapRenderTarget> renderTarget(Query, platformContext);
- if (!renderTarget)
- return;
-
- COMPtr<ID2D1Bitmap> bitmap;
- HRESULT hr = renderTarget->GetBitmap(&bitmap);
- ASSERT(SUCCEEDED(hr));
-
ASSERT(sourceRect.width() > 0);
ASSERT(sourceRect.height() > 0);
@@ -132,7 +114,33 @@
if (width <= 0 || height <= 0)
return;
+ // We cannot access the data backing an IWICBitmap while an active draw session is open.
+ context->endDraw();
+
+ WICRect rcLock = { 0, 0, sourceSize.width(), sourceSize.height() };
+
+ COMPtr<IWICBitmapLock> bitmapDataLock;
+ HRESULT hr = bitmapSource->Lock(&rcLock, WICBitmapLockWrite, &bitmapDataLock);
+ if (!SUCCEEDED(hr))
+ return;
+
+ UINT stride = 0;
+ hr = bitmapDataLock->GetStride(&stride);
+ if (!SUCCEEDED(hr))
+ return;
+
+ UINT bufferSize = 0;
+ WICInProcPointer dataPtr = nullptr;
+ hr = bitmapDataLock->GetDataPointer(&bufferSize, &dataPtr);
+ if (!SUCCEEDED(hr))
+ return;
+
+ ASSERT(bufferSize == source.byteLength());
+
unsigned srcBytesPerRow = 4 * sourceSize.width();
+
+ ASSERT(srcBytesPerRow == stride);
+
const uint8_t* srcRows = source.data() + (originy * srcBytesPerRow + originx * 4).unsafeGet();
auto row = makeUniqueArray<uint8_t>(srcBytesPerRow);
@@ -150,12 +158,15 @@
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);
- hr = bitmap->CopyFromMemory(&dstRect, row.get(), srcBytesPerRow);
- ASSERT(SUCCEEDED(hr));
+ memcpy(reinterpret_cast<char*>(dataPtr + y * srcBytesPerRow), row.get(), srcBytesPerRow);
srcRows += srcBytesPerRow;
}
+
+ // Once we are done modifying the data, unlock the bitmap
+ bitmapDataLock = nullptr;
+
+ context->beginDraw();
}
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.h (247840 => 247841)
--- trunk/Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.h 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.h 2019-07-25 22:02:00 UTC (rev 247841)
@@ -41,9 +41,9 @@
Checked<unsigned, RecordOverflow> bytesPerRow;
// Only for software ImageBuffers.
- void* data { nullptr };
+ Vector<char> data;
std::unique_ptr<GraphicsContext> context;
- ID2D1RenderTarget* m_compatibleTarget { nullptr };
+ COMPtr<IWICBitmap> bitmapSource;
RefPtr<Uint8ClampedArray> getData(AlphaPremultiplication, const IntRect&, const IntSize&, bool accelerateRendering, float resolutionScale) const;
void putData(const Uint8ClampedArray& source, AlphaPremultiplication sourceFormat, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint, const IntSize&, bool accelerateRendering, float resolutionScale);
Modified: trunk/Source/WebCore/platform/graphics/win/ImageBufferDirect2D.cpp (247840 => 247841)
--- trunk/Source/WebCore/platform/graphics/win/ImageBufferDirect2D.cpp 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/platform/graphics/win/ImageBufferDirect2D.cpp 2019-07-25 22:02:00 UTC (rev 247841)
@@ -32,11 +32,13 @@
#include "COMPtr.h"
#include "GraphicsContext.h"
#include "ImageData.h"
+#include "ImageDecoderDirect2D.h"
#include "IntRect.h"
#include "MIMETypeRegistry.h"
#include "NotImplemented.h"
#include <d2d1.h>
#include <math.h>
+#include <wincodec.h>
#include <wtf/Assertions.h>
#include <wtf/CheckedArithmetic.h>
#include <wtf/MainThread.h>
@@ -72,7 +74,7 @@
return buffer;
}
-ImageBuffer::ImageBuffer(const FloatSize& size, float resolutionScale, ColorSpace /*colorSpace*/, RenderingMode renderingMode, const HostWindow*, const GraphicsContext* targetContext, bool& success)
+ImageBuffer::ImageBuffer(const FloatSize& size, float resolutionScale, ColorSpace /*colorSpace*/, RenderingMode renderingMode, const HostWindow*, const GraphicsContext*, bool& success)
: m_logicalSize(size)
, m_resolutionScale(resolutionScale)
{
@@ -97,20 +99,23 @@
if (numBytes.hasOverflowed())
return;
- auto renderTarget = targetContext ? targetContext->platformContext() : nullptr;
- if (!renderTarget)
- renderTarget = GraphicsContext::defaultRenderTarget();
- RELEASE_ASSERT(renderTarget);
+ m_data.data = "" 0);
- COMPtr<ID2D1BitmapRenderTarget> bitmapContext;
- D2D1_SIZE_F desiredSize = FloatSize(m_logicalSize);
- D2D1_SIZE_U pixelSize = IntSize(m_logicalSize);
- HRESULT hr = renderTarget->CreateCompatibleRenderTarget(&desiredSize, &pixelSize, nullptr, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_GDI_COMPATIBLE, &bitmapContext);
+ HRESULT hr = ImageDecoderDirect2D::systemImagingFactory()->CreateBitmapFromMemory(m_size.width(), m_size.height(), GUID_WICPixelFormat32bppPBGRA, static_cast<UINT>(m_data.bytesPerRow.unsafeGet()), static_cast<UINT>(numBytes.unsafeGet()), reinterpret_cast<BYTE*>(m_data.data.data()), &m_data.bitmapSource);
+ if (!SUCCEEDED(hr))
+ return;
+
+ auto targetProperties = D2D1::RenderTargetProperties(D2D1_RENDER_TARGET_TYPE_DEFAULT,
+ D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED),
+ 0, 0, D2D1_RENDER_TARGET_USAGE_NONE, D2D1_FEATURE_LEVEL_DEFAULT);
+
+ COMPtr<ID2D1RenderTarget> bitmapContext;
+ hr = GraphicsContext::systemFactory()->CreateWicBitmapRenderTarget(m_data.bitmapSource.get(), &targetProperties, &bitmapContext);
if (!bitmapContext || !SUCCEEDED(hr))
return;
+ // Note: This places the bitmapcontext into a locked state because of the BeginDraw call in the constructor.
m_data.context = std::make_unique<GraphicsContext>(bitmapContext.get());
- m_data.m_compatibleTarget = renderTarget;
success = true;
}
@@ -137,23 +142,31 @@
context().flush();
}
-static COMPtr<ID2D1Bitmap> createCroppedImageIfNecessary(ID2D1Bitmap* image, const IntSize& bounds)
+static COMPtr<IWICBitmap> createCroppedImageIfNecessary(IWICBitmap* image, const IntSize& bounds)
{
- FloatSize imageSize = image ? image->GetSize() : FloatSize();
+ FloatSize imageSize = image ? nativeImageSize(image) : FloatSize();
if (image && (static_cast<size_t>(imageSize.width()) != static_cast<size_t>(bounds.width()) || static_cast<size_t>(imageSize.height()) != static_cast<size_t>(bounds.height()))) {
D2D_POINT_2U origin = { };
- D2D1_RECT_U croppedDimenstions = IntRect(IntPoint(), bounds);
- COMPtr<ID2D1Bitmap> croppedImage;
- HRESULT hr = croppedImage->CopyFromBitmap(&origin, image, &croppedDimenstions);
- if (SUCCEEDED(hr))
- return croppedImage;
+ WICRect croppedDimensions = { 0, 0, bounds.width(), bounds.height() };
+
+ COMPtr<IWICBitmapClipper> bitmapClipper;
+ HRESULT hr = ImageDecoderDirect2D::systemImagingFactory()->CreateBitmapClipper(&bitmapClipper);
+ if (SUCCEEDED(hr)) {
+ hr = bitmapClipper->Initialize(image, &croppedDimensions);
+ if (SUCCEEDED(hr)) {
+ COMPtr<IWICBitmap> croppedBitmap;
+ hr = ImageDecoderDirect2D::systemImagingFactory()->CreateBitmapFromSource(image, WICBitmapNoCache, &croppedBitmap);
+ if (SUCCEEDED(hr))
+ return croppedBitmap;
+ }
+ }
}
return image;
}
-static RefPtr<Image> createBitmapImageAfterScalingIfNeeded(COMPtr<ID2D1Bitmap>&& image, IntSize internalSize, IntSize logicalSize, IntSize backingStoreSize, float resolutionScale, PreserveResolution preserveResolution)
+static RefPtr<Image> createBitmapImageAfterScalingIfNeeded(COMPtr<IWICBitmap>&& image, IntSize internalSize, IntSize logicalSize, IntSize backingStoreSize, float resolutionScale, PreserveResolution preserveResolution)
{
if (resolutionScale == 1 || preserveResolution == PreserveResolution::Yes)
image = createCroppedImageIfNecessary(image.get(), internalSize);
@@ -170,7 +183,7 @@
RefPtr<Image> ImageBuffer::copyImage(BackingStoreCopy copyBehavior, PreserveResolution preserveResolution) const
{
- COMPtr<ID2D1Bitmap> image;
+ COMPtr<IWICBitmap> image;
if (m_resolutionScale == 1 || preserveResolution == PreserveResolution::Yes)
image = copyNativeImage(copyBehavior);
else
@@ -194,31 +207,31 @@
return DontCopyBackingStore;
}
-COMPtr<ID2D1Bitmap> ImageBuffer::sinkIntoNativeImage(std::unique_ptr<ImageBuffer> imageBuffer)
+COMPtr<IWICBitmap> ImageBuffer::sinkIntoNativeImage(std::unique_ptr<ImageBuffer> imageBuffer)
{
// FIXME: See if we can reuse the on-hardware image.
return imageBuffer->copyNativeImage(DontCopyBackingStore);
}
-COMPtr<ID2D1Bitmap> ImageBuffer::copyNativeImage(BackingStoreCopy copyBehavior) const
+COMPtr<IWICBitmap> ImageBuffer::copyNativeImage(BackingStoreCopy copyBehavior) const
{
- auto bitmapTarget = reinterpret_cast<ID2D1BitmapRenderTarget*>(context().platformContext());
-
- COMPtr<ID2D1Bitmap> image;
- HRESULT hr = bitmapTarget->GetBitmap(&image);
- ASSERT(SUCCEEDED(hr));
-
// FIXME: m_data.data is nullptr even when asking to copy backing store leading to test failures.
- if (copyBehavior == CopyBackingStore && !m_data.data)
+ if (copyBehavior == CopyBackingStore && m_data.data.isEmpty())
copyBehavior = DontCopyBackingStore;
+ Checked<size_t, RecordOverflow> numBytes = Checked<unsigned, RecordOverflow>(m_data.backingStoreSize.height()) * m_data.bytesPerRow;
+ if (numBytes.hasOverflowed())
+ return nullptr;
+
+ HRESULT hr = S_OK;
+ COMPtr<IWICBitmap> image;
if (!context().isAcceleratedContext()) {
switch (copyBehavior) {
case DontCopyBackingStore:
+ hr = ImageDecoderDirect2D::systemImagingFactory()->CreateBitmapFromSource(m_data.bitmapSource.get(), WICBitmapNoCache, &image);
break;
case CopyBackingStore:
- D2D1_RECT_U backingStoreDimenstions = IntRect(IntPoint(), m_data.backingStoreSize);
- image->CopyFromMemory(&backingStoreDimenstions, m_data.data, 32);
+ hr = ImageDecoderDirect2D::systemImagingFactory()->CreateBitmapFromSource(m_data.bitmapSource.get(), WICBitmapCacheOnDemand, &image);
break;
default:
ASSERT_NOT_REACHED();
@@ -240,31 +253,18 @@
void ImageBuffer::draw(GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, BlendMode blendMode)
{
- auto bitmapTarget = reinterpret_cast<ID2D1BitmapRenderTarget*>(context().platformContext());
- auto outputTarget = destContext.platformContext();
+ FloatRect adjustedSrcRect = srcRect;
+ adjustedSrcRect.scale(m_resolutionScale, m_resolutionScale);
- COMPtr<ID2D1Bitmap> image;
- HRESULT hr = bitmapTarget->GetBitmap(&image);
- if (!SUCCEEDED(hr))
- return;
+ FloatSize currentImageSize = nativeImageSize(m_data.bitmapSource);
- // If the render targets for the source and destination contexts do not match, move the image over.
- if (destContext.platformContext() != m_data.m_compatibleTarget) {
- COMPtr<ID2D1Bitmap> sourceImage = image;
- image = nullptr;
+ // You can't convert a IWICBitmap to a ID2D1Bitmap with an active GraphicsContext attached to it.
+ m_data.context->endDraw();
- auto bitmapProperties = D2D1::BitmapProperties();
- GraphicsContext::systemFactory()->GetDesktopDpi(&bitmapProperties.dpiX, &bitmapProperties.dpiY);
- hr = outputTarget->CreateSharedBitmap(__uuidof(ID2D1Bitmap), sourceImage.get(), &bitmapProperties, &image);
- if (!SUCCEEDED(hr))
- return;
- }
+ destContext.drawNativeImage(m_data.bitmapSource, currentImageSize, destRect, adjustedSrcRect, op, blendMode);
- FloatRect adjustedSrcRect = srcRect;
- adjustedSrcRect.scale(m_resolutionScale, m_resolutionScale);
+ m_data.context->beginDraw();
- destContext.drawNativeImage(image, image->GetSize(), destRect, adjustedSrcRect, op, blendMode);
-
destContext.flush();
}
Modified: trunk/Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.cpp (247840 => 247841)
--- trunk/Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.cpp 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.cpp 2019-07-25 22:02:00 UTC (rev 247841)
@@ -236,7 +236,7 @@
NativeImagePtr ImageDecoderDirect2D::createFrameImageAtIndex(size_t index, SubsamplingLevel subsamplingLevel, const DecodingOptions&)
{
- if (!m_nativeDecoder || !m_renderTarget)
+ if (!m_nativeDecoder)
return nullptr;
COMPtr<IWICBitmapFrameDecode> frame;
@@ -249,12 +249,12 @@
if (!SUCCEEDED(hr))
return nullptr;
- hr = converter->Initialize(frame.get(), GUID_WICPixelFormat32bppPBGRA, WICBitmapDitherTypeNone, nullptr, 0.f, WICBitmapPaletteTypeCustom);
+ hr = converter->Initialize(frame.get(), GUID_WICPixelFormat32bppPRGBA, WICBitmapDitherTypeNone, nullptr, 0.f, WICBitmapPaletteTypeCustom);
if (!SUCCEEDED(hr))
return nullptr;
- COMPtr<ID2D1Bitmap> bitmap;
- hr = m_renderTarget->CreateBitmapFromWicBitmap(converter.get(), nullptr, &bitmap);
+ COMPtr<IWICBitmap> bitmap;
+ hr = systemImagingFactory()->CreateBitmapFromSource(converter.get(), WICBitmapCacheOnDemand, &bitmap);
if (!SUCCEEDED(hr))
return nullptr;
Modified: trunk/Source/WebCore/platform/graphics/win/ImageDirect2D.cpp (247840 => 247841)
--- trunk/Source/WebCore/platform/graphics/win/ImageDirect2D.cpp 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/platform/graphics/win/ImageDirect2D.cpp 2019-07-25 22:02:00 UTC (rev 247841)
@@ -77,8 +77,8 @@
size_t frames = frameCount();
for (size_t i = 0; i < frames; ++i) {
auto image = frameImageAtIndex(i).get();
- auto imageSize = image->GetSize();
- if (image && clampTo<size_t>(imageSize.height) == static_cast<size_t>(srcSize.height()) && clampTo<size_t>(imageSize.width) == static_cast<size_t>(srcSize.width())) {
+ auto imageSize = nativeImageSize(image);
+ if (image && clampTo<int>(imageSize.height()) == static_cast<int>(srcSize.height()) && clampTo<int>(imageSize.width()) == static_cast<int>(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, DecodingMode::Synchronous, ImageOrientationDescription());
Modified: trunk/Source/WebCore/platform/graphics/win/NativeImageDirect2D.cpp (247840 => 247841)
--- trunk/Source/WebCore/platform/graphics/win/NativeImageDirect2D.cpp 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/platform/graphics/win/NativeImageDirect2D.cpp 2019-07-25 22:02:00 UTC (rev 247841)
@@ -33,12 +33,33 @@
#include "IntSize.h"
#include "NotImplemented.h"
#include <d2d1.h>
+#include <wincodec.h>
namespace WebCore {
+static IWICImagingFactory* imagingFactory()
+{
+ static IWICImagingFactory* imagingFactory = nullptr;
+ if (!imagingFactory) {
+ HRESULT hr = CoCreateInstance(CLSID_WICImagingFactory, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&imagingFactory));
+ RELEASE_ASSERT(SUCCEEDED(hr));
+ }
+
+ return imagingFactory;
+}
+
IntSize nativeImageSize(const NativeImagePtr& image)
{
- return image ? IntSize(image->GetSize()) : IntSize();
+ UINT width = 0;
+ UINT height = 0;
+ if (!image)
+ return { };
+
+ HRESULT hr = image->GetSize(&width, &height);
+ if (!SUCCEEDED(hr))
+ return { };
+
+ return IntSize(width, height);
}
bool nativeImageHasAlpha(const NativeImagePtr& image)
@@ -46,8 +67,28 @@
if (!image)
return false;
- auto alphaMode = image->GetPixelFormat().alphaMode;
- return (alphaMode >= D2D1_ALPHA_MODE_PREMULTIPLIED) && (alphaMode <= D2D1_ALPHA_MODE_STRAIGHT);
+ WICPixelFormatGUID pixelFormatGUID = { };
+ HRESULT hr = image->GetPixelFormat(&pixelFormatGUID);
+ if (!SUCCEEDED(hr))
+ return false;
+
+ // FIXME: Should we just check the pixelFormatGUID for relevant ID's we use?
+
+ COMPtr<IWICComponentInfo> componentInfo;
+ hr = imagingFactory()->CreateComponentInfo(pixelFormatGUID, &componentInfo);
+ if (!SUCCEEDED(hr))
+ return false;
+
+ COMPtr<IWICPixelFormatInfo> pixelFormatInfo(Query, componentInfo.get());
+ if (!pixelFormatInfo)
+ return false;
+
+ UINT channelCount = 0;
+ hr = pixelFormatInfo->GetChannelCount(&channelCount);
+ if (!SUCCEEDED(hr))
+ return false;
+
+ return channelCount > 3;
}
Color nativeImageSinglePixelSolidColor(const NativeImagePtr& image)
@@ -74,7 +115,12 @@
float opacity = 1.0f;
- platformContext->DrawBitmap(image.get(), destRect, opacity, D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR, adjustedSrcRect);
+ COMPtr<ID2D1Bitmap> bitmap;
+ HRESULT hr = platformContext->CreateBitmapFromWicBitmap(image.get(), &bitmap);
+ if (!SUCCEEDED(hr))
+ return;
+
+ platformContext->DrawBitmap(bitmap.get(), destRect, opacity, D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR, adjustedSrcRect);
context.flush();
}
Modified: trunk/Source/WebCore/platform/graphics/win/PathDirect2D.cpp (247840 => 247841)
--- trunk/Source/WebCore/platform/graphics/win/PathDirect2D.cpp 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/platform/graphics/win/PathDirect2D.cpp 2019-07-25 22:02:00 UTC (rev 247841)
@@ -249,7 +249,7 @@
ASSERT(applier);
- GraphicsContext scratchContext(scratchRenderTarget());
+ GraphicsContext scratchContext(scratchRenderTarget(), GraphicsContext::BitmapRenderingContextType::GPUMemory);
applier->strokeStyle(&scratchContext);
BOOL containsPoint = false;
Modified: trunk/Source/WebCore/platform/graphics/win/PatternDirect2D.cpp (247840 => 247841)
--- trunk/Source/WebCore/platform/graphics/win/PatternDirect2D.cpp 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/platform/graphics/win/PatternDirect2D.cpp 2019-07-25 22:02:00 UTC (rev 247841)
@@ -52,8 +52,15 @@
auto platformContext = context.platformContext();
RELEASE_ASSERT(platformContext);
+ auto nativeImage = patternImage.nativeImage(&context);
+
+ COMPtr<ID2D1Bitmap> bitmap;
+ HRESULT hr = platformContext->CreateBitmapFromWicBitmap(nativeImage.get(), &bitmap);
+ if (!SUCCEEDED(hr))
+ return nullptr;
+
ID2D1BitmapBrush* patternBrush = nullptr;
- HRESULT hr = platformContext->CreateBitmapBrush(patternImage.nativeImage(&context).get(), &bitmapBrushProperties, &brushProperties, &patternBrush);
+ hr = platformContext->CreateBitmapBrush(bitmap.get(), &bitmapBrushProperties, &brushProperties, &patternBrush);
ASSERT(SUCCEEDED(hr));
return patternBrush;
}
Modified: trunk/Source/WebCore/platform/win/PasteboardWin.cpp (247840 => 247841)
--- trunk/Source/WebCore/platform/win/PasteboardWin.cpp 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/platform/win/PasteboardWin.cpp 2019-07-25 22:02:00 UTC (rev 247841)
@@ -355,8 +355,9 @@
for (auto& filename : list->value)
reader.readFilename(filename);
#else
+ UNUSED_PARAM(reader);
notImplemented();
- return { };
+ return;
#endif
}
Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (247840 => 247841)
--- trunk/Source/WebCore/rendering/RenderElement.cpp 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp 2019-07-25 22:02:00 UTC (rev 247841)
@@ -2032,7 +2032,7 @@
RespectImageOrientationEnum RenderElement::shouldRespectImageOrientation() const
{
-#if USE(CG) || USE(CAIRO)
+#if USE(CG) || USE(CAIRO) || USE(DIRECT2D)
// This can only be enabled for ports which honor the orientation flag in their drawing code.
if (document().isImageDocument())
return RespectImageOrientation;
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (247840 => 247841)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2019-07-25 22:02:00 UTC (rev 247841)
@@ -401,7 +401,8 @@
{
if (m_isFrameLayerWithTiledBacking) {
auto tileCoverage = computePageTiledBackingCoverage(m_owningLayer);
- tiledBacking()->setTileCoverage(tileCoverage);
+ if (auto* tiledBacking = this->tiledBacking())
+ tiledBacking->setTileCoverage(tileCoverage);
}
if (m_owningLayer.hasCompositedScrollableOverflow() && m_scrolledContentsLayer) {
Modified: trunk/Source/WebCore/svg/graphics/SVGImage.cpp (247840 => 247841)
--- trunk/Source/WebCore/svg/graphics/SVGImage.cpp 2019-07-25 21:18:04 UTC (rev 247840)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.cpp 2019-07-25 22:02:00 UTC (rev 247841)
@@ -68,6 +68,7 @@
#if USE(DIRECT2D)
#include "COMPtr.h"
+#include "ImageDecoderDirect2D.h"
#include <d2d1.h>
#endif
@@ -232,22 +233,25 @@
if (!m_page || !targetContext)
return nullptr;
- auto platformContext = targetContext->platformContext();
- ASSERT(platformContext);
+ COMPtr<IWICBitmap> nativeImage;
+ HRESULT hr = ImageDecoderDirect2D::systemImagingFactory()->CreateBitmap(rect().width(), rect().height(), GUID_WICPixelFormat32bppPRGBA, WICBitmapCacheOnLoad, &nativeImage);
+ if (!SUCCEEDED(hr))
+ return nullptr;
+ auto targetProperties = D2D1::RenderTargetProperties(D2D1_RENDER_TARGET_TYPE_DEFAULT,
+ D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED),
+ 0, 0, D2D1_RENDER_TARGET_USAGE_NONE, D2D1_FEATURE_LEVEL_DEFAULT);
+
// Draw the SVG into a bitmap.
- COMPtr<ID2D1BitmapRenderTarget> nativeImageTarget;
- HRESULT hr = platformContext->CreateCompatibleRenderTarget(IntSize(rect().size()), &nativeImageTarget);
- ASSERT(SUCCEEDED(hr));
+ COMPtr<ID2D1RenderTarget> nativeImageTarget;
+ hr = GraphicsContext::systemFactory()->CreateWicBitmapRenderTarget(nativeImage.get(), &targetProperties, &nativeImageTarget);
+ if (!nativeImageTarget || !SUCCEEDED(hr))
+ return nullptr;
- GraphicsContext localContext(nativeImageTarget.get());
+ GraphicsContext localContext(nativeImageTarget.get(), GraphicsContext::BitmapRenderingContextType::CPUMemory);
draw(localContext, rect(), rect(), CompositeSourceOver, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientationDescription());
- COMPtr<ID2D1Bitmap> nativeImage;
- hr = nativeImageTarget->GetBitmap(&nativeImage);
- ASSERT(SUCCEEDED(hr));
-
return nativeImage;
}
#endif