WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-217573-20201017022520.patch (text/plain), 49.98 KB, created by
Said Abou-Hallawa
on 2020-10-17 02:25:21 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2020-10-17 02:25:21 PDT
Size:
49.98 KB
patch
obsolete
>Subversion Revision: 268638 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index b45f647174b1b55147d54132c299c55e4565d54b..0cef92b8423d8571471bdf092d9202316244ca2b 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,60 @@ >+2020-10-17 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ [GPU Process] Clean the DisplayList recording of the NativeImage >+ https://bugs.webkit.org/show_bug.cgi?id=217573 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 1) Move the definition of NativeImagePtr to a separate header file named >+ NativeImagePtr. >+ 2) Remove the class ImageHandle and allow encoding and decoding NativeImagePtr >+ directly. >+ 3) Remove the compilation directives around the DisplayList::DrawNativeImage >+ item and the method drawNativeImage(). >+ 4) Move the drawNativeImage() methods to the sources of their callers. >+ >+ * Headers.cmake: >+ * WebCore.xcodeproj/project.pbxproj: >+ * loader/cache/MemoryCache.h: >+ * platform/graphics/BitmapImage.cpp: >+ (WebCore::drawNativeImage): >+ * platform/graphics/GraphicsContext.cpp: >+ (WebCore::GraphicsContext::drawNativeImage): >+ * platform/graphics/GraphicsContext.h: >+ (WebCore::GraphicsContext::drawNativeImage): >+ * platform/graphics/GraphicsContextImpl.h: >+ * platform/graphics/Image.h: >+ * platform/graphics/ImageBufferBackend.h: >+ * platform/graphics/NativeImage.h: >+ * platform/graphics/NativeImagePtr.h: Copied from Source/WebCore/platform/graphics/NativeImage.h. >+ * platform/graphics/cairo/GraphicsContextCairo.cpp: >+ (WebCore::GraphicsContext::platformDrawNativeImage): >+ (WebCore::GraphicsContext::drawNativeImage): Deleted. >+ * platform/graphics/cg/GraphicsContextCG.cpp: >+ (WebCore::GraphicsContext::platformDrawNativeImage): >+ (WebCore::GraphicsContext::drawNativeImage): Deleted. >+ * platform/graphics/cg/NativeImageCG.cpp: >+ (WebCore::drawNativeImage): Deleted. >+ * platform/graphics/displaylists/DisplayList.h: >+ * platform/graphics/displaylists/DisplayListItems.cpp: >+ (WebCore::DisplayList::Item::sizeInBytes): >+ (WebCore::DisplayList::DrawNativeImage::DrawNativeImage): >+ (WebCore::DisplayList::DrawNativeImage::apply const): >+ (WebCore::DisplayList::operator<<): >+ * platform/graphics/displaylists/DisplayListItems.h: >+ (WebCore::DisplayList::DrawNativeImage::encode const): >+ (WebCore::DisplayList::DrawNativeImage::decode): >+ (WebCore::DisplayList::Item::encode const): >+ (WebCore::DisplayList::Item::decode): >+ * platform/graphics/displaylists/DisplayListRecorder.cpp: >+ (WebCore::DisplayList::Recorder::drawNativeImage): >+ * platform/graphics/displaylists/DisplayListRecorder.h: >+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: >+ * platform/graphics/nicosia/NicosiaImageBufferPipe.cpp: >+ * platform/graphics/win/GraphicsContextDirect2D.cpp: >+ (WebCore::GraphicsContext::platformDrawNativeImage): >+ (WebCore::GraphicsContext::drawNativeImage): Deleted. >+ > 2020-10-17 Myles C. Maxfield <mmaxfield@apple.com> > > REGRESSION(r268561): Synthetic oblique text is drawn upside-down >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index bde88111ffe8f80d5a9c039556d9a48fbac44987..382c3435c61018fb0a1cf93aaba79a5ad6a049f7 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,24 @@ >+2020-10-17 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ [GPU Process] Clean the DisplayList recording of the NativeImage >+ https://bugs.webkit.org/show_bug.cgi?id=217573 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Support encoding and decoding NativeImagePtr directly. >+ >+ * Scripts/webkit/messages.py: >+ * Shared/WebCoreArgumentCoders.cpp: >+ (IPC::encodeNativeImage): >+ (IPC::encodeOptionalNativeImage): >+ (IPC::ArgumentCoder<NativeImagePtr>::encode): >+ (IPC::ArgumentCoder<NativeImagePtr>::decode): >+ (IPC::ArgumentCoder<NativeImageHandle>::encode): Deleted. >+ (IPC::ArgumentCoder<NativeImageHandle>::decode): Deleted. >+ * Shared/WebCoreArgumentCoders.h: >+ * Shared/cg/ShareableBitmapCG.cpp: >+ (WebKit::ShareableBitmap::paint): >+ > 2020-10-16 Said Abou-Hallawa <sabouhallawa@apple.com> > > [GPU Process] Introduce RemoteResourceCacheProxy to manage the resources in the GPU Process >diff --git a/Source/WebCore/Headers.cmake b/Source/WebCore/Headers.cmake >index 03d5389a4c72ade915afadca56cfdcbeadaa2742..7556820a38c3410185e732438a4e11d5edb5fc14 100644 >--- a/Source/WebCore/Headers.cmake >+++ b/Source/WebCore/Headers.cmake >@@ -1198,6 +1198,7 @@ set(WebCore_PRIVATE_FRAMEWORK_HEADERS > platform/graphics/MediaPlayerPrivate.h > platform/graphics/MediaUsageInfo.h > platform/graphics/NativeImage.h >+ platform/graphics/NativeImagePtr.h > platform/graphics/OpenGLESShims.h > platform/graphics/OpenGLShims.h > platform/graphics/Path.h >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 963ac91a38bf1ab9aa84fff9decfb532348e4164..048ec2b5665788b33f61a3003eb5b3623655b07a 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -2009,7 +2009,6 @@ > 6A72798B1F16C29C003F39B8 /* InspectorShaderProgram.h in Headers */ = {isa = PBXBuildFile; fileRef = 6A7279881F16C29B003F39B8 /* InspectorShaderProgram.h */; }; > 6B0A07F221FA4B5C00D57391 /* AdClickAttribution.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B0A07F021FA4B5C00D57391 /* AdClickAttribution.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 6B1F48112298A37E00DE8B82 /* CrossSiteNavigationDataTransfer.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B1F480F22989EC400DE8B82 /* CrossSiteNavigationDataTransfer.h */; settings = {ATTRIBUTES = (Private, ); }; }; >- 6B3480940EEF50D400AC1B41 /* NativeImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B3480920EEF50D400AC1B41 /* NativeImage.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 6B4D412D23983F88002494C2 /* LoggedInStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B4D412B23983F88002494C2 /* LoggedInStatus.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 6B4E8613221B713F0022F389 /* RegistrableDomain.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B4E8612221B713F0022F389 /* RegistrableDomain.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 6B507A24234BF34100BE7C62 /* NavigatorIsLoggedIn.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B507A21234BF34100BE7C62 /* NavigatorIsLoggedIn.h */; }; >@@ -2159,6 +2158,8 @@ > 724ED3321A3A8B2300F5F13C /* JSEXTBlendMinMax.h in Headers */ = {isa = PBXBuildFile; fileRef = 724ED3301A3A8B2300F5F13C /* JSEXTBlendMinMax.h */; }; > 724EE5501DC80D7F00A91FFB /* ActivityState.h in Headers */ = {isa = PBXBuildFile; fileRef = 724EE54E1DC7F25B00A91FFB /* ActivityState.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 724EE5511DC80D8400A91FFB /* ActivityStateChangeObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 724EE54F1DC7F25B00A91FFB /* ActivityStateChangeObserver.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 726D56E2253AE28D0002EF90 /* NativeImagePtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 726D56E1253AE0430002EF90 /* NativeImagePtr.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 726D56E3253AE3660002EF90 /* NativeImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 55A336F61D8209F40022C4C7 /* NativeImage.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 727A7F3A24078B84004D2931 /* ImageBufferIOSurfaceBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = 72BAC3AB23E1E544008D741C /* ImageBufferIOSurfaceBackend.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 7299BC6723D6A53200CC6883 /* AlphaPremultiplication.h in Headers */ = {isa = PBXBuildFile; fileRef = 7299BC6423D686A600CC6883 /* AlphaPremultiplication.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 7299BC6823D6A53E00CC6883 /* RenderingMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 7299BC6623D686C600CC6883 /* RenderingMode.h */; settings = {ATTRIBUTES = (Private, ); }; }; >@@ -9498,7 +9499,6 @@ > 6B0A07F021FA4B5C00D57391 /* AdClickAttribution.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AdClickAttribution.h; sourceTree = "<group>"; }; > 6B0A07F121FA4B5C00D57391 /* AdClickAttribution.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AdClickAttribution.cpp; sourceTree = "<group>"; }; > 6B1F480F22989EC400DE8B82 /* CrossSiteNavigationDataTransfer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CrossSiteNavigationDataTransfer.h; sourceTree = "<group>"; }; >- 6B3480920EEF50D400AC1B41 /* NativeImage.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NativeImage.h; sourceTree = "<group>"; }; > 6B4D412B23983F88002494C2 /* LoggedInStatus.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoggedInStatus.h; sourceTree = "<group>"; }; > 6B4D412C23983F88002494C2 /* LoggedInStatus.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LoggedInStatus.cpp; sourceTree = "<group>"; }; > 6B4E8612221B713F0022F389 /* RegistrableDomain.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RegistrableDomain.h; sourceTree = "<group>"; }; >@@ -9927,6 +9927,7 @@ > 7266F0282243120300833975 /* SVGAnimationAdditiveListFunctionImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAnimationAdditiveListFunctionImpl.h; sourceTree = "<group>"; }; > 7266F029224312B100833975 /* SVGAnimationAdditiveListFunction.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAnimationAdditiveListFunction.h; sourceTree = "<group>"; }; > 7266F02A2243149B00833975 /* SVGAnimatedPropertyList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyList.h; sourceTree = "<group>"; }; >+ 726D56E1253AE0430002EF90 /* NativeImagePtr.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NativeImagePtr.h; sourceTree = "<group>"; }; > 727AFED11A2EA6A0000442E8 /* EXTsRGB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EXTsRGB.cpp; sourceTree = "<group>"; }; > 727AFED21A2EA6A0000442E8 /* EXTsRGB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EXTsRGB.h; sourceTree = "<group>"; }; > 727AFED31A2EA6A0000442E8 /* EXTsRGB.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EXTsRGB.idl; sourceTree = "<group>"; }; >@@ -12165,11 +12166,11 @@ > A37A42E22527B49D00F75AFF /* EXTTextureCompressionRGTC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EXTTextureCompressionRGTC.h; sourceTree = "<group>"; }; > A37A42E32527B49E00F75AFF /* EXTTextureCompressionRGTC.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EXTTextureCompressionRGTC.idl; sourceTree = "<group>"; }; > A38A87A32538BEE70037A472 /* GPUPlatformTypesMetal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUPlatformTypesMetal.h; sourceTree = "<group>"; }; >- A3C3DC5D253A19920061F32A /* GPUPlatformTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPUPlatformTypes.h; sourceTree = "<group>"; }; > A3AF9D81203252EE006CAD06 /* UserAgentCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UserAgentCocoa.mm; sourceTree = "<group>"; }; > A3AF9D8220325324006CAD06 /* UserAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserAgent.h; sourceTree = "<group>"; }; > A3AF9D8320325691006CAD06 /* UserAgentIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UserAgentIOS.mm; sourceTree = "<group>"; }; > A3AF9D84203256A3006CAD06 /* UserAgentMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UserAgentMac.mm; sourceTree = "<group>"; }; >+ A3C3DC5D253A19920061F32A /* GPUPlatformTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPUPlatformTypes.h; sourceTree = "<group>"; }; > A3D42A841F33BA3600A64B62 /* LayoutUnit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutUnit.cpp; sourceTree = "<group>"; }; > A409C982116D0DDD007197BD /* AccessibilityProgressIndicator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityProgressIndicator.cpp; sourceTree = "<group>"; }; > A409C983116D0DDD007197BD /* AccessibilityProgressIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityProgressIndicator.h; sourceTree = "<group>"; }; >@@ -26232,8 +26233,8 @@ > 07B93FF923B92AAA0036F8EA /* MIMETypeCache.h */, > 314BE3A41B3103FB00141982 /* NamedImageGeneratedImage.cpp */, > 314BE3A51B3103FB00141982 /* NamedImageGeneratedImage.h */, >- 6B3480920EEF50D400AC1B41 /* NativeImage.h */, > 55A336F61D8209F40022C4C7 /* NativeImage.h */, >+ 726D56E1253AE0430002EF90 /* NativeImagePtr.h */, > B27535520B053814002CE64F /* Path.cpp */, > B27535530B053814002CE64F /* Path.h */, > A88DD4880B4629B000C02990 /* PathTraversalState.cpp */, >@@ -33187,7 +33188,8 @@ > 314BE3A71B3103FB00141982 /* NamedImageGeneratedImage.h in Headers */, > A81872230977D3C0005826D9 /* NamedNodeMap.h in Headers */, > A818721E0977D3C0005826D9 /* NameNodeList.h in Headers */, >- 6B3480940EEF50D400AC1B41 /* NativeImage.h in Headers */, >+ 726D56E3253AE3660002EF90 /* NativeImage.h in Headers */, >+ 726D56E2253AE28D0002EF90 /* NativeImagePtr.h in Headers */, > 83B2D1751B8BCD6A00A02E47 /* NativeNodeFilter.h in Headers */, > E10B9B6C0B747599003ED890 /* NativeXPathNSResolver.h in Headers */, > 93CCF0270AF6C52900018E89 /* NavigationAction.h in Headers */, >diff --git a/Source/WebCore/loader/cache/MemoryCache.h b/Source/WebCore/loader/cache/MemoryCache.h >index a1413c6f679b15e907c7b6cfa7605f270e2f9557..57447ff1af046c648e84d976abf00610bf0028db 100644 >--- a/Source/WebCore/loader/cache/MemoryCache.h >+++ b/Source/WebCore/loader/cache/MemoryCache.h >@@ -24,7 +24,6 @@ > > #pragma once > >-#include "NativeImage.h" > #include "SecurityOriginHash.h" > #include "Timer.h" > #include <pal/SessionID.h> >diff --git a/Source/WebCore/platform/graphics/BitmapImage.cpp b/Source/WebCore/platform/graphics/BitmapImage.cpp >index b476a35b82d93708d3b0f2b4d1a6d254812d0e11..b1ed4e4e847997b59c7dfd3d26107566cca4713f 100644 >--- a/Source/WebCore/platform/graphics/BitmapImage.cpp >+++ b/Source/WebCore/platform/graphics/BitmapImage.cpp >@@ -28,6 +28,7 @@ > #include "BitmapImage.h" > > #include "FloatRect.h" >+#include "GeometryUtilities.h" > #include "GraphicsContext.h" > #include "ImageBuffer.h" > #include "ImageObserver.h" >@@ -204,6 +205,21 @@ bool BitmapImage::notSolidColor() > } > #endif // ASSERT_ENABLED > >+static inline void drawNativeImage(const NativeImagePtr& image, GraphicsContext& context, const FloatRect& destRect, const FloatRect& srcRect, const IntSize& srcSize, const ImagePaintingOptions& options) >+{ >+ // Subsampling may have given us an image that is smaller than size(). >+ IntSize subsampledImageSize = nativeImageSize(image); >+ if (options.orientation().usesWidthAsHeight()) >+ subsampledImageSize = subsampledImageSize.transposedSize(); >+ >+ // srcRect is in the coordinates of the unsubsampled image, so we have to map it to the subsampled image. >+ FloatRect adjustedSrcRect = srcRect; >+ if (subsampledImageSize != srcSize) >+ adjustedSrcRect = mapRect(srcRect, FloatRect({ }, srcSize), FloatRect({ }, subsampledImageSize)); >+ >+ context.drawNativeImage(image, subsampledImageSize, destRect, adjustedSrcRect, options); >+} >+ > ImageDrawResult BitmapImage::draw(GraphicsContext& context, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options) > { > if (destRect.isEmpty() || srcRect.isEmpty()) >diff --git a/Source/WebCore/platform/graphics/GraphicsContext.cpp b/Source/WebCore/platform/graphics/GraphicsContext.cpp >index 555cc664570a34bea995deccd52ac861f5fe3144..0dc0557b0d4f072edb98bc58c129b421a808f06d 100644 >--- a/Source/WebCore/platform/graphics/GraphicsContext.cpp >+++ b/Source/WebCore/platform/graphics/GraphicsContext.cpp >@@ -731,6 +731,19 @@ void GraphicsContext::drawBidiText(const FontCascade& font, const TextRun& run, > bidiRuns.clear(); > } > >+void GraphicsContext::drawNativeImage(const NativeImagePtr& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options) >+{ >+ if (paintingDisabled()) >+ return; >+ >+ if (m_impl) { >+ m_impl->drawNativeImage(image, imageSize, destRect, srcRect, options); >+ return; >+ } >+ >+ platformDrawNativeImage(image, imageSize, destRect, srcRect, options); >+} >+ > ImageDrawResult GraphicsContext::drawImage(Image& image, const FloatPoint& destination, const ImagePaintingOptions& imagePaintingOptions) > { > return drawImage(image, FloatRect(destination, image.size()), FloatRect(FloatPoint(), image.size()), imagePaintingOptions); >diff --git a/Source/WebCore/platform/graphics/GraphicsContext.h b/Source/WebCore/platform/graphics/GraphicsContext.h >index db4c002eccd22e6fe94087c69f9128d4289927bf..0d1ca92d6045eb37a78d3e1897c26f42b9c76f3a 100644 >--- a/Source/WebCore/platform/graphics/GraphicsContext.h >+++ b/Source/WebCore/platform/graphics/GraphicsContext.h >@@ -334,10 +334,6 @@ public: > > const GraphicsContextState& state() const { return m_state; } > >-#if USE(CG) || USE(DIRECT2D) || USE(CAIRO) >- WEBCORE_EXPORT void drawNativeImage(const NativeImagePtr&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& = { }); >-#endif >- > #if USE(CG) || USE(DIRECT2D) > void applyStrokePattern(); > void applyFillPattern(); >@@ -383,6 +379,8 @@ public: > > WEBCORE_EXPORT void strokeRect(const FloatRect&, float lineWidth); > >+ WEBCORE_EXPORT void drawNativeImage(const NativeImagePtr&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& = { }); >+ > WEBCORE_EXPORT ImageDrawResult drawImage(Image&, const FloatPoint& destination, const ImagePaintingOptions& = { ImageOrientation::FromImage }); > WEBCORE_EXPORT ImageDrawResult drawImage(Image&, const FloatRect& destination, const ImagePaintingOptions& = { ImageOrientation::FromImage }); > ImageDrawResult drawImage(Image&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& = { ImageOrientation::FromImage }); >@@ -652,6 +650,8 @@ private: > > void platformFillRoundedRect(const FloatRoundedRect&, const Color&); > >+ void platformDrawNativeImage(const NativeImagePtr&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions&); >+ > FloatRect computeLineBoundsAndAntialiasingModeForText(const FloatRect&, bool printing, Color&); > > float dashedLineCornerWidthForStrokeWidth(float) const; >diff --git a/Source/WebCore/platform/graphics/GraphicsContextImpl.h b/Source/WebCore/platform/graphics/GraphicsContextImpl.h >index 3d5075bcedcbf502871cd550935f51ac8db2f55c..c2cafe336cc56995dc40ded40167e683b42a57f7 100644 >--- a/Source/WebCore/platform/graphics/GraphicsContextImpl.h >+++ b/Source/WebCore/platform/graphics/GraphicsContextImpl.h >@@ -72,9 +72,8 @@ public: > virtual ImageDrawResult drawImage(Image&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions&) = 0; > virtual ImageDrawResult drawTiledImage(Image&, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions&) = 0; > virtual ImageDrawResult drawTiledImage(Image&, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor, Image::TileRule hRule, Image::TileRule vRule, const ImagePaintingOptions&) = 0; >-#if USE(CG) || USE(CAIRO) || USE(DIRECT2D) >+ > virtual void drawNativeImage(const NativeImagePtr&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions&) = 0; >-#endif > virtual void drawPattern(Image&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions&) = 0; > > virtual void drawRect(const FloatRect&, float borderThickness) = 0; >diff --git a/Source/WebCore/platform/graphics/Image.h b/Source/WebCore/platform/graphics/Image.h >index d39feaa82f371cf8aaf76d27f33573f35198d089..ea4d63a94ed6cf0223fd9ea05088a37bd712d6c6 100644 >--- a/Source/WebCore/platform/graphics/Image.h >+++ b/Source/WebCore/platform/graphics/Image.h >@@ -32,8 +32,9 @@ > #include "FloatSize.h" > #include "GraphicsTypes.h" > #include "ImageOrientation.h" >+#include "ImagePaintingOptions.h" > #include "ImageTypes.h" >-#include "NativeImage.h" >+#include "NativeImagePtr.h" > #include "Timer.h" > #include <wtf/EnumTraits.h> > #include <wtf/Optional.h> >@@ -72,7 +73,6 @@ class FloatSize; > class GraphicsContext; > class GraphicsContextImpl; > class SharedBuffer; >-struct ImagePaintingOptions; > struct Length; > > // This class gets notified when an image creates or destroys decoded frames and when it advances animation frames. >diff --git a/Source/WebCore/platform/graphics/ImageBufferBackend.h b/Source/WebCore/platform/graphics/ImageBufferBackend.h >index c010a0f0cfcd8c5e7ab6c94c5c3c36f48386d01f..58fc14836d92aa20019f20feedc5571e9ab5e95c 100644 >--- a/Source/WebCore/platform/graphics/ImageBufferBackend.h >+++ b/Source/WebCore/platform/graphics/ImageBufferBackend.h >@@ -31,13 +31,14 @@ > #include "GraphicsTypesGL.h" > #include "ImagePaintingOptions.h" > #include "IntRect.h" >-#include "NativeImage.h" >+#include "NativeImagePtr.h" > #include "PlatformLayer.h" > #include <wtf/RefPtr.h> > #include <wtf/Vector.h> > > namespace WebCore { > >+class GraphicsContext; > class GraphicsContextGLOpenGL; > class HostWindow; > class Image; >diff --git a/Source/WebCore/platform/graphics/NativeImage.h b/Source/WebCore/platform/graphics/NativeImage.h >index 6b2d81e35b08cf74f4f361aebc74f3129c7d9b7f..0334759607f8f20de3124859a6f0f09451e18e5b 100644 >--- a/Source/WebCore/platform/graphics/NativeImage.h >+++ b/Source/WebCore/platform/graphics/NativeImage.h >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2004, 2005, 2006, 2016 Apple Inc. All rights reserved. >+ * Copyright (C) 2004-2020 Apple Inc. All rights reserved. > * Copyright (C) 2007-2008 Torch Mobile, Inc. > * Copyright (C) 2012 Company 100 Inc. > * >@@ -27,52 +27,16 @@ > > #pragma once > >-#include "ImagePaintingOptions.h" >- >-#if USE(CG) >-#include <wtf/RetainPtr.h> >-typedef struct CGImage* CGImageRef; >-#elif USE(CAIRO) >-#include "RefPtrCairo.h" >-#elif USE(WINGDI) >-#include "SharedBitmap.h" >-#endif >- >-#if USE(DIRECT2D) >-#include "COMPtr.h" >-#include <d2d1.h> >-#include <wincodec.h> >-#endif >+#include "NativeImagePtr.h" > > namespace WebCore { > > class Color; >-class FloatRect; > class IntSize; >-class GraphicsContext; >- >-#if USE(CG) >-typedef RetainPtr<CGImageRef> NativeImagePtr; >-#elif USE(DIRECT2D) >-typedef COMPtr<ID2D1Bitmap> NativeImagePtr; >-#elif USE(CAIRO) >-typedef RefPtr<cairo_surface_t> NativeImagePtr; >-#elif USE(WINGDI) >-typedef RefPtr<SharedBitmap> NativeImagePtr; >-#endif > > WEBCORE_EXPORT IntSize nativeImageSize(const NativeImagePtr&); > bool nativeImageHasAlpha(const NativeImagePtr&); > Color nativeImageSinglePixelSolidColor(const NativeImagePtr&); >- >-void drawNativeImage(const NativeImagePtr&, GraphicsContext&, const FloatRect&, const FloatRect&, const IntSize&, const ImagePaintingOptions&); >-WEBCORE_EXPORT void drawNativeImage(const NativeImagePtr&, GraphicsContext&, float scaleFactor, const IntPoint& destination, const IntRect& source); >- > void clearNativeImageSubimages(const NativeImagePtr&); > >-class NativeImageHandle { >-public: >- NativeImagePtr image; >-}; >- > } >diff --git a/Source/WebCore/platform/graphics/NativeImagePtr.h b/Source/WebCore/platform/graphics/NativeImagePtr.h >new file mode 100644 >index 0000000000000000000000000000000000000000..3d77a898d398736411174f19f7514071d07c9582 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/NativeImagePtr.h >@@ -0,0 +1,49 @@ >+/* >+ * Copyright (C) 2020 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. >+ */ >+ >+#pragma once >+ >+#if USE(CG) >+#include <wtf/RetainPtr.h> >+typedef struct CGImage* CGImageRef; >+#elif USE(CAIRO) >+#include "RefPtrCairo.h" >+#elif USE(WINGDI) >+#include "SharedBitmap.h" >+#endif >+ >+namespace WebCore { >+ >+#if USE(CG) >+typedef RetainPtr<CGImageRef> NativeImagePtr; >+#elif USE(DIRECT2D) >+typedef COMPtr<ID2D1Bitmap> NativeImagePtr; >+#elif USE(CAIRO) >+typedef RefPtr<cairo_surface_t> NativeImagePtr; >+#elif USE(WINGDI) >+typedef RefPtr<SharedBitmap> NativeImagePtr; >+#endif >+ >+} >diff --git a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp >index a104656cb5d5ddea0321daa44a04465175088e4f..2ab9ce3bba25ea5485448f34aa777afe04e734ee 100644 >--- a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp >+++ b/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp >@@ -123,16 +123,11 @@ void GraphicsContext::drawRect(const FloatRect& rect, float borderThickness) > Cairo::drawRect(*platformContext(), rect, borderThickness, state.fillColor, state.strokeStyle, state.strokeColor); > } > >-void GraphicsContext::drawNativeImage(const NativeImagePtr& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options) >+void GraphicsContext::platformDrawNativeImage(const NativeImagePtr& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options) > { > if (paintingDisabled()) > return; > >- if (m_impl) { >- m_impl->drawNativeImage(image, imageSize, destRect, srcRect, options); >- return; >- } >- > ASSERT(hasPlatformContext()); > auto& state = this->state(); > Cairo::drawNativeImage(*platformContext(), image.get(), destRect, srcRect, { options, state.imageInterpolationQuality }, state.alpha, Cairo::ShadowState(state)); >diff --git a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp >index ea37c786ef6db6e5afeb917798fa531bf98ac84d..c292db42cc0f9f0f9c47c78ed69c2d8331c98239 100644 >--- a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp >+++ b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp >@@ -280,16 +280,11 @@ void GraphicsContext::restorePlatformState() > m_data->m_userToDeviceTransformKnownToBeIdentity = false; > } > >-void GraphicsContext::drawNativeImage(const RetainPtr<CGImageRef>& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options) >+void GraphicsContext::platformDrawNativeImage(const RetainPtr<CGImageRef>& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options) > { > if (paintingDisabled()) > return; > >- if (m_impl) { >- m_impl->drawNativeImage(image, imageSize, destRect, srcRect, options); >- return; >- } >- > #if !LOG_DISABLED > MonotonicTime startTime = MonotonicTime::now(); > #endif >diff --git a/Source/WebCore/platform/graphics/cg/NativeImageCG.cpp b/Source/WebCore/platform/graphics/cg/NativeImageCG.cpp >index 5cc5c207b44a4835be2e08028a3a71095a55e1e0..400d6ef0a4577d5d7cc5bd9cb646a5badebdadc2 100644 >--- a/Source/WebCore/platform/graphics/cg/NativeImageCG.cpp >+++ b/Source/WebCore/platform/graphics/cg/NativeImageCG.cpp >@@ -30,7 +30,6 @@ > > #include "Color.h" > #include "FloatRect.h" >-#include "GeometryUtilities.h" > #include "GraphicsContextCG.h" > #include "IntSize.h" > #include "SubimageCacheWithTimer.h" >@@ -69,40 +68,6 @@ Color nativeImageSinglePixelSolidColor(const NativeImagePtr& image) > return clampToComponentBytes<SRGBA>(pixel[0] * 255 / pixel[3], pixel[1] * 255 / pixel[3], pixel[2] * 255 / pixel[3], pixel[3]); > } > >-void drawNativeImage(const NativeImagePtr& image, GraphicsContext& context, const FloatRect& destRect, const FloatRect& srcRect, const IntSize& srcSize, const ImagePaintingOptions& options) >-{ >- // Subsampling may have given us an image that is smaller than size(). >- IntSize subsampledImageSize = nativeImageSize(image); >- if (options.orientation().usesWidthAsHeight()) >- subsampledImageSize = subsampledImageSize.transposedSize(); >- >- // srcRect is in the coordinates of the unsubsampled image, so we have to map it to the subsampled image. >- FloatRect adjustedSrcRect = srcRect; >- if (subsampledImageSize != srcSize) >- adjustedSrcRect = mapRect(srcRect, FloatRect({ }, srcSize), FloatRect({ }, subsampledImageSize)); >- >- context.drawNativeImage(image, subsampledImageSize, destRect, adjustedSrcRect, options); >-} >- >-void drawNativeImage(const NativeImagePtr& image, GraphicsContext& context, float scaleFactor, const IntPoint& destination, const IntRect& source) >-{ >- CGContextRef cgContext = context.platformContext(); >- CGContextSaveGState(cgContext); >- >- CGContextClipToRect(cgContext, CGRectMake(destination.x(), destination.y(), source.width(), source.height())); >- CGContextScaleCTM(cgContext, 1, -1); >- >- CGFloat imageHeight = CGImageGetHeight(image.get()) / scaleFactor; >- CGFloat imageWidth = CGImageGetWidth(image.get()) / scaleFactor; >- >- CGFloat destX = destination.x() - source.x(); >- CGFloat destY = -imageHeight - destination.y() + source.y(); >- >- CGContextDrawImage(cgContext, CGRectMake(destX, destY, imageWidth, imageHeight), image.get()); >- >- CGContextRestoreGState(cgContext); >-} >- > void clearNativeImageSubimages(const NativeImagePtr& image) > { > #if CACHE_SUBIMAGES >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayList.h b/Source/WebCore/platform/graphics/displaylists/DisplayList.h >index a63836921d8dfca16638bd86aa933efa7e264d81..f1253a767c340bcdd9a531aae40ee378e9fc3df2 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayList.h >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayList.h >@@ -62,9 +62,7 @@ enum class ItemType : uint8_t { > DrawImage, > DrawTiledImage, > DrawTiledScaledImage, >-#if USE(CG) || USE(CAIRO) || USE(DIRECT2D) > DrawNativeImage, >-#endif > DrawPattern, > DrawRect, > DrawLine, >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp b/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp >index c7a39d831ce0f0a3fafe01b4bee158de34dabdce..72526092a2eabbcbae0bc81c401b1f9927e4eb1e 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp >@@ -106,10 +106,8 @@ size_t Item::sizeInBytes(const Item& item) > return sizeof(downcast<DrawTiledImage>(item)); > case ItemType::DrawTiledScaledImage: > return sizeof(downcast<DrawTiledScaledImage>(item)); >-#if USE(CG) || USE(CAIRO) > case ItemType::DrawNativeImage: > return sizeof(downcast<DrawNativeImage>(item)); >-#endif > case ItemType::DrawPattern: > return sizeof(downcast<DrawPattern>(item)); > case ItemType::DrawRect: >@@ -698,32 +696,21 @@ static TextStream& operator<<(TextStream& ts, const DrawTiledScaledImage& item) > return ts; > } > >-#if USE(CG) || USE(CAIRO) || USE(DIRECT2D) > DrawNativeImage::DrawNativeImage(const NativeImagePtr& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options) > : DrawingItem(ItemType::DrawNativeImage) >-#if USE(CG) >- // FIXME: Need to store an image for Cairo. > , m_image(image) >-#endif > , m_imageSize(imageSize) > , m_destinationRect(destRect) > , m_srcRect(srcRect) > , m_options(options) > { >-#if !USE(CG) >- UNUSED_PARAM(image); >-#endif > } > > DrawNativeImage::~DrawNativeImage() = default; > > void DrawNativeImage::apply(GraphicsContext& context) const > { >-#if USE(CG) > context.drawNativeImage(m_image, m_imageSize, m_destinationRect, m_srcRect, m_options); >-#else >- UNUSED_PARAM(context); >-#endif > } > > static TextStream& operator<<(TextStream& ts, const DrawNativeImage& item) >@@ -734,7 +721,6 @@ static TextStream& operator<<(TextStream& ts, const DrawNativeImage& item) > ts.dumpProperty("dest-rect", item.destinationRect()); > return ts; > } >-#endif > > DrawPattern::DrawPattern(Image& image, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options) > : DrawingItem(ItemType::DrawPattern) >@@ -1464,9 +1450,7 @@ static TextStream& operator<<(TextStream& ts, const ItemType& type) > case ItemType::DrawImage: ts << "draw-image"; break; > case ItemType::DrawTiledImage: ts << "draw-tiled-image"; break; > case ItemType::DrawTiledScaledImage: ts << "draw-tiled-scaled-image"; break; >-#if USE(CG) || USE(CAIRO) > case ItemType::DrawNativeImage: ts << "draw-native-image"; break; >-#endif > case ItemType::DrawPattern: ts << "draw-pattern"; break; > case ItemType::DrawRect: ts << "draw-rect"; break; > case ItemType::DrawLine: ts << "draw-line"; break; >@@ -1566,11 +1550,9 @@ TextStream& operator<<(TextStream& ts, const Item& item) > case ItemType::DrawTiledScaledImage: > ts << downcast<DrawTiledScaledImage>(item); > break; >-#if USE(CG) || USE(CAIRO) > case ItemType::DrawNativeImage: > ts << downcast<DrawNativeImage>(item); > break; >-#endif > case ItemType::DrawPattern: > ts << downcast<DrawPattern>(item); > break; >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h b/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h >index f0b54b4456419bd0e17aa05c26854af1f72bc726..7d345cb78c45ba37ee543e8c80b170bdee4d0792 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h >@@ -1422,7 +1422,6 @@ Optional<Ref<DrawTiledScaledImage>> DrawTiledScaledImage::decode(Decoder& decode > return DrawTiledScaledImage::create(*imageHandle->image, *destination, *source, *tileScaleFactor, hRule, vRule, *imagePaintingOptions); > } > >-#if USE(CG) || USE(CAIRO) || USE(DIRECT2D) > class DrawNativeImage : public DrawingItem { > public: > static Ref<DrawNativeImage> create(const NativeImagePtr& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options) >@@ -1445,9 +1444,7 @@ private: > > Optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_destinationRect; } > >-#if USE(CG) > NativeImagePtr m_image; >-#endif > FloatSize m_imageSize; > FloatRect m_destinationRect; > FloatRect m_srcRect; >@@ -1457,10 +1454,7 @@ private: > template<class Encoder> > void DrawNativeImage::encode(Encoder& encoder) const > { >-#if USE(CG) >- NativeImageHandle handle { m_image }; >- encoder << handle; >-#endif >+ encoder << m_image; > encoder << m_imageSize; > encoder << m_destinationRect; > encoder << m_srcRect; >@@ -1470,12 +1464,10 @@ void DrawNativeImage::encode(Encoder& encoder) const > template<class Decoder> > Optional<Ref<DrawNativeImage>> DrawNativeImage::decode(Decoder& decoder) > { >-#if USE(CG) >- Optional<NativeImageHandle> handle; >- decoder >> handle; >- if (!handle) >+ Optional<NativeImagePtr> image; >+ decoder >> image; >+ if (!image) > return WTF::nullopt; >-#endif > > Optional<FloatSize> imageSize; > decoder >> imageSize; >@@ -1497,14 +1489,8 @@ Optional<Ref<DrawNativeImage>> DrawNativeImage::decode(Decoder& decoder) > if (!options) > return WTF::nullopt; > >-#if USE(CG) >- NativeImagePtr image = handle->image; >-#else >- NativeImagePtr image = nullptr; >-#endif >- return DrawNativeImage::create(image, *imageSize, *destinationRect, *srcRect, *options); >+ return DrawNativeImage::create(*image, *imageSize, *destinationRect, *srcRect, *options); > } >-#endif > > class DrawPattern : public DrawingItem { > public: >@@ -2963,11 +2949,9 @@ void Item::encode(Encoder& encoder) const > case ItemType::DrawTiledScaledImage: > encoder << downcast<DrawTiledScaledImage>(*this); > break; >-#if USE(CG) || USE(CAIRO) || USE(DIRECT2D) > case ItemType::DrawNativeImage: > encoder << downcast<DrawNativeImage>(*this); > break; >-#endif > case ItemType::DrawPattern: > encoder << downcast<DrawPattern>(*this); > break; >@@ -3154,12 +3138,10 @@ Optional<Ref<Item>> Item::decode(Decoder& decoder) > if (auto item = DrawTiledScaledImage::decode(decoder)) > return static_reference_cast<Item>(WTFMove(*item)); > break; >-#if USE(CG) || USE(CAIRO) || USE(DIRECT2D) > case ItemType::DrawNativeImage: > if (auto item = DrawNativeImage::decode(decoder)) > return static_reference_cast<Item>(WTFMove(*item)); > break; >-#endif > case ItemType::DrawPattern: > if (auto item = DrawPattern::decode(decoder)) > return static_reference_cast<Item>(WTFMove(*item)); >@@ -3316,9 +3298,7 @@ SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawGlyphs) > SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawImage) > SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawTiledImage) > SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawTiledScaledImage) >-#if USE(CG) || USE(CAIRO) > SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawNativeImage) >-#endif > SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawPattern) > SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawRect) > SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawLine) >@@ -3378,9 +3358,7 @@ template<> struct EnumTraits<WebCore::DisplayList::ItemType> { > WebCore::DisplayList::ItemType::DrawImage, > WebCore::DisplayList::ItemType::DrawTiledImage, > WebCore::DisplayList::ItemType::DrawTiledScaledImage, >-#if USE(CG) || USE(CAIRO) || USE(DIRECT2D) > WebCore::DisplayList::ItemType::DrawNativeImage, >-#endif > WebCore::DisplayList::ItemType::DrawPattern, > WebCore::DisplayList::ItemType::DrawRect, > WebCore::DisplayList::ItemType::DrawLine, >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp b/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp >index 1c54ae822939420dd40b7b70ba7e39dbba65fe9b..cf26c8289c0fed9e6330e7463314fa236968063b 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp >@@ -132,12 +132,10 @@ ImageDrawResult Recorder::drawTiledImage(Image& image, const FloatRect& destinat > return ImageDrawResult::DidRecord; > } > >-#if USE(CG) || USE(CAIRO) || USE(DIRECT2D) > void Recorder::drawNativeImage(const NativeImagePtr& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options) > { > appendItemAndUpdateExtent(DrawNativeImage::create(image, imageSize, destRect, srcRect, options)); > } >-#endif > > void Recorder::drawPattern(Image& image, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options) > { >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h b/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h >index 9ee1d3938f232f3f18d978af718701d8be463072..1b24c26c67288f817273a2d2aef2b4bc96e35c75 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h >@@ -104,9 +104,8 @@ private: > ImageDrawResult drawImage(Image&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions&) override; > ImageDrawResult drawTiledImage(Image&, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions&) override; > ImageDrawResult drawTiledImage(Image&, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor, Image::TileRule hRule, Image::TileRule vRule, const ImagePaintingOptions&) override; >-#if USE(CG) || USE(CAIRO) || USE(DIRECT2D) >+ > void drawNativeImage(const NativeImagePtr&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions&) override; >-#endif > void drawPattern(Image&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions&) override; > > void drawRect(const FloatRect&, float borderThickness) override; >diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h >index f31d375b02da0979289acc200dd862fae134104b..4b5e3e43b03964a51c273e5be7aedb0df1aa91f7 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h >+++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h >@@ -28,6 +28,7 @@ > > #include "GStreamerCommon.h" > #include "GStreamerEMEUtilities.h" >+#include "ImageOrientation.h" > #include "Logging.h" > #include "MainThreadNotifier.h" > #include "MediaPlayerPrivate.h" >diff --git a/Source/WebCore/platform/graphics/nicosia/NicosiaImageBufferPipe.cpp b/Source/WebCore/platform/graphics/nicosia/NicosiaImageBufferPipe.cpp >index 18b4f8de97170ce644eb64be3eab857f3a7432f4..6298cf36073c7ae44f43c6b564422b37b86cf107 100644 >--- a/Source/WebCore/platform/graphics/nicosia/NicosiaImageBufferPipe.cpp >+++ b/Source/WebCore/platform/graphics/nicosia/NicosiaImageBufferPipe.cpp >@@ -28,6 +28,7 @@ > #include "ImageBuffer.h" > > #include "ImageBufferPipe.h" >+#include "NativeImage.h" > #include "NicosiaContentLayerTextureMapperImpl.h" > #include "NicosiaPlatformLayer.h" > #include "TextureMapperPlatformLayerBuffer.h" >diff --git a/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp b/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp >index 374071715bcb791d589d50d99b29c66b010b7081..57ba858ff99c2db29f5d91492e6aac8ed974ec99 100644 >--- a/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp >+++ b/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp >@@ -207,16 +207,11 @@ void GraphicsContext::restorePlatformState() > Direct2D::restore(*platformContext()); > } > >-void GraphicsContext::drawNativeImage(const COMPtr<ID2D1Bitmap>& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options) >+void GraphicsContext::platformDrawNativeImage(const COMPtr<ID2D1Bitmap>& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options) > { > if (paintingDisabled()) > return; > >- if (m_impl) { >- m_impl->drawNativeImage(image, imageSize, destRect, srcRect, options); >- return; >- } >- > ASSERT(hasPlatformContext()); > auto& state = this->state(); > Direct2D::drawNativeImage(*platformContext(), image.get(), imageSize, destRect, srcRect, options, state.alpha, Direct2D::ShadowState(state)); >diff --git a/Source/WebKit/Scripts/webkit/messages.py b/Source/WebKit/Scripts/webkit/messages.py >index 253287318cf4cb7978ac1f3906c11c1b86da4654..058577e5f7deb6d2bdf25b1c755356f96adf8889 100644 >--- a/Source/WebKit/Scripts/webkit/messages.py >+++ b/Source/WebKit/Scripts/webkit/messages.py >@@ -217,6 +217,7 @@ def types_that_cannot_be_forward_declared(): > 'WebCore::PlaybackTargetClientContextIdentifier', > 'WebCore::MediaPlayerIdentifier', > 'WebCore::MediaSessionIdentifier', >+ 'WebCore::NativeImagePtr', > 'WebCore::PageIdentifier', > 'WebCore::PluginLoadClientPolicy', > 'WebCore::PointerID', >diff --git a/Source/WebKit/Shared/WebCoreArgumentCoders.cpp b/Source/WebKit/Shared/WebCoreArgumentCoders.cpp >index 0811214a108377b1775d2cfb76484641e23d1d3a..3379596be69d924ae0ca6d8f9f1ffb01b20c3d6c 100644 >--- a/Source/WebKit/Shared/WebCoreArgumentCoders.cpp >+++ b/Source/WebKit/Shared/WebCoreArgumentCoders.cpp >@@ -39,6 +39,7 @@ > #include <WebCore/CompositionUnderline.h> > #include <WebCore/Credential.h> > #include <WebCore/Cursor.h> >+#include <WebCore/DOMCacheEngine.h> > #include <WebCore/DatabaseDetails.h> > #include <WebCore/DictationAlternative.h> > #include <WebCore/DictionaryPopupInfo.h> >@@ -1099,7 +1100,7 @@ bool ArgumentCoder<ImageHandle>::decode(Decoder& decoder, ImageHandle& imageHand > return true; > } > >-static void encodeNativeImage(Encoder& encoder, NativeImagePtr image) >+static void encodeNativeImage(Encoder& encoder, const NativeImagePtr& image) > { > auto imageSize = nativeImageSize(image); > auto bitmap = ShareableBitmap::createShareable(imageSize, { }); >@@ -1142,7 +1143,7 @@ static WARN_UNUSED_RETURN bool decodeNativeImage(Decoder& decoder, NativeImagePt > return true; > } > >-static void encodeOptionalNativeImage(Encoder& encoder, NativeImagePtr image) >+static void encodeOptionalNativeImage(Encoder& encoder, const NativeImagePtr& image) > { > bool hasImage = !!image; > encoder << hasImage; >@@ -1165,14 +1166,14 @@ static WARN_UNUSED_RETURN bool decodeOptionalNativeImage(Decoder& decoder, Nativ > return decodeNativeImage(decoder, image); > } > >-void ArgumentCoder<NativeImageHandle>::encode(Encoder& encoder, const NativeImageHandle& imageHandle) >+void ArgumentCoder<NativeImagePtr>::encode(Encoder& encoder, const NativeImagePtr& image) > { >- encodeOptionalNativeImage(encoder, imageHandle.image.get()); >+ encodeOptionalNativeImage(encoder, image); > } > >-bool ArgumentCoder<NativeImageHandle>::decode(Decoder& decoder, NativeImageHandle& imageHandle) >+bool ArgumentCoder<NativeImagePtr>::decode(Decoder& decoder, NativeImagePtr& image) > { >- return decodeOptionalNativeImage(decoder, imageHandle.image); >+ return decodeOptionalNativeImage(decoder, image); > } > > void ArgumentCoder<Ref<Font>>::encode(Encoder& encoder, const Ref<WebCore::Font>& font) >diff --git a/Source/WebKit/Shared/WebCoreArgumentCoders.h b/Source/WebKit/Shared/WebCoreArgumentCoders.h >index 5c523e882e03df7e5ccfc12e45d78fb41033bb90..6459fa41ee8e7ab1320ee27d22e6974135943097 100644 >--- a/Source/WebKit/Shared/WebCoreArgumentCoders.h >+++ b/Source/WebKit/Shared/WebCoreArgumentCoders.h >@@ -34,6 +34,7 @@ > #include <WebCore/IndexedDB.h> > #include <WebCore/InputMode.h> > #include <WebCore/MediaSelectionOption.h> >+#include <WebCore/NativeImagePtr.h> > #include <WebCore/NetworkLoadMetrics.h> > #include <WebCore/NotificationDirection.h> > #include <WebCore/RealtimeMediaSource.h> >@@ -109,7 +110,6 @@ class KeyframeValueList; > class LayoutSize; > class LayoutPoint; > class LinearTimingFunction; >-class NativeImageHandle; > class Notification; > class PasteboardCustomData; > class PaymentInstallmentConfiguration; >@@ -419,9 +419,9 @@ template<> struct ArgumentCoder<WebCore::ImageHandle> { > static WARN_UNUSED_RETURN bool decode(Decoder&, WebCore::ImageHandle&); > }; > >-template<> struct ArgumentCoder<WebCore::NativeImageHandle> { >- static void encode(Encoder&, const WebCore::NativeImageHandle&); >- static WARN_UNUSED_RETURN bool decode(Decoder&, WebCore::NativeImageHandle&); >+template<> struct ArgumentCoder<WebCore::NativeImagePtr> { >+ static void encode(Encoder&, const WebCore::NativeImagePtr&); >+ static WARN_UNUSED_RETURN bool decode(Decoder&, WebCore::NativeImagePtr&); > }; > > template<> struct ArgumentCoder<WebCore::ResourceRequest> { >diff --git a/Source/WebKit/Shared/cg/ShareableBitmapCG.cpp b/Source/WebKit/Shared/cg/ShareableBitmapCG.cpp >index 730da648f2b2fe9e784fd04052e190f0d0bf21ad..959da83d5f6988b211588da7ddb4ff183dce7d60 100644 >--- a/Source/WebKit/Shared/cg/ShareableBitmapCG.cpp >+++ b/Source/WebKit/Shared/cg/ShareableBitmapCG.cpp >@@ -106,12 +106,27 @@ std::unique_ptr<GraphicsContext> ShareableBitmap::createGraphicsContext() > > void ShareableBitmap::paint(WebCore::GraphicsContext& context, const IntPoint& destination, const IntRect& source) > { >- drawNativeImage(makeCGImageCopy(), context, 1, destination, source); >+ paint(context, 1, destination, source); > } > > void ShareableBitmap::paint(WebCore::GraphicsContext& context, float scaleFactor, const IntPoint& destination, const IntRect& source) > { >- drawNativeImage(makeCGImageCopy(), context, scaleFactor, destination, source); >+ CGContextRef cgContext = context.platformContext(); >+ CGContextSaveGState(cgContext); >+ >+ CGContextClipToRect(cgContext, CGRectMake(destination.x(), destination.y(), source.width(), source.height())); >+ CGContextScaleCTM(cgContext, 1, -1); >+ >+ auto image = makeCGImageCopy(); >+ CGFloat imageHeight = CGImageGetHeight(image.get()) / scaleFactor; >+ CGFloat imageWidth = CGImageGetWidth(image.get()) / scaleFactor; >+ >+ CGFloat destX = destination.x() - source.x(); >+ CGFloat destY = -imageHeight - destination.y() + source.y(); >+ >+ CGContextDrawImage(cgContext, CGRectMake(destX, destY, imageWidth, imageHeight), image.get()); >+ >+ CGContextRestoreGState(cgContext); > } > > RetainPtr<CGImageRef> ShareableBitmap::makeCGImageCopy()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 217573
:
411041
|
411042
|
411044
|
411660
| 411662