Skip to content

Commit

Permalink
ImagePaintingOptions does not have TextStream <<operator
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=262772
rdar://116567502

Reviewed by Simon Fraser.

Most likely TextStream& operator<<(TextStream&, ImagePaintingOptions)
was not implemented sooner since it is a bit more involved.

ImagePaintingOptions had variadic non-explicit constructor, that
accepted, say, CompositeOperator. Since CompositeOperator had
operator<<, adding operator<< to ImagePaintingOptions would create
ambiguity wrt whether to operator<<(..., CompositeOperator) or
operator<<(.., ImagePaintingOptions) and convert implicitly via
ImagePaintingOptions(CompositeOperator).

Making the single-parameter constructor explicit is cumbersome due
to GraphicsContext::someMethod(..., const ImagePaintingOptions& = { param })
default parameter pattern. Due to C++ rules, this involves copy
constructing the ImagePaintingOptions and if the single parameter
constructor is explict, the copy won't happen.

ImagePaintingOptions should not be passed as const& anyway, as:
- the call sites do not reuse the object, so there's no downside
  constructing the original to the call stack of the callee
- the object is just couple bytes of real data
- the object is conceptually overriden in some call receivers and passed
  further. The override cannot reuse the same space in const& case.

Fix by:
- Shrink the ImagePaintingOptions so it's smaller than
  const ImagePaintingOptions&. Reorder fields, select bitfield sizes
  that are quite confortably higher than future theoretical
  additions to the enums (does not try to be optimal for today's enums).
- Pass ImagePaintingOptions by value
- Make the single-parameter constructor explicit
- Implement the <<operator

xcrun python3 Tools/Scripts/dump-class-layout -b ~/Build -c Debug WebCore WebCore::ImagePaintingOptions
  +0 <  3> WebCore::ImagePaintingOptions
  +0 < :5>   WebCore::BlendMode m_blendMode : 5
  +0 < :3>   WebCore::DecodingMode m_decodingMode : 3
  +1 < :4>   WebCore::CompositeOperator m_compositeOperator : 4
  +1 < :4>   WebCore::ImageOrientation::Orientation m_orientation : 4
  +2 < :4>   WebCore::InterpolationQuality m_interpolationQuality : 4
  +2 < :4>   <UNUSED BITS: 4 bits>
Total byte size: 3
Total pad bytes: 0

* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/html/CustomPaintImage.cpp:
(WebCore::CustomPaintImage::draw):
(WebCore::CustomPaintImage::drawPattern):
* Source/WebCore/html/CustomPaintImage.h:
* Source/WebCore/html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::paint):
* Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::compositeBuffer):
(WebCore::drawImageToContext):
* Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::videoFrameToImage):
* Source/WebCore/platform/graphics/BifurcatedGraphicsContext.cpp:
(WebCore::BifurcatedGraphicsContext::drawNativeImageInternal):
(WebCore::BifurcatedGraphicsContext::drawPattern):
(WebCore::BifurcatedGraphicsContext::drawImage):
(WebCore::BifurcatedGraphicsContext::drawTiledImage):
* Source/WebCore/platform/graphics/BifurcatedGraphicsContext.h:
* Source/WebCore/platform/graphics/BitmapImage.cpp:
(WebCore::drawNativeImage):
(WebCore::BitmapImage::draw):
(WebCore::BitmapImage::drawPattern):
* Source/WebCore/platform/graphics/BitmapImage.h:
* Source/WebCore/platform/graphics/CrossfadeGeneratedImage.cpp:
(WebCore::CrossfadeGeneratedImage::draw):
(WebCore::CrossfadeGeneratedImage::drawPattern):
* Source/WebCore/platform/graphics/CrossfadeGeneratedImage.h:
* Source/WebCore/platform/graphics/DecodingOptions.h:
* Source/WebCore/platform/graphics/GeneratedImage.h:
(WebCore::GeneratedImage::draw):
(WebCore::GeneratedImage::drawPattern):
* Source/WebCore/platform/graphics/GradientImage.cpp:
(WebCore::GradientImage::draw):
(WebCore::GradientImage::drawPattern):
* Source/WebCore/platform/graphics/GradientImage.h:
* Source/WebCore/platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::drawNativeImage):
(WebCore::GraphicsContext::drawImage):
(WebCore::GraphicsContext::drawTiledImage):
(WebCore::GraphicsContext::drawImageBuffer):
(WebCore::GraphicsContext::drawConsumingImageBuffer):
(WebCore::GraphicsContext::drawPattern):
* Source/WebCore/platform/graphics/GraphicsContext.h:
(WebCore::GraphicsContext::drawNativeImage):
(WebCore::GraphicsContext::drawImage):
(WebCore::GraphicsContext::drawTiledImage):
(WebCore::GraphicsContext::drawImageBuffer):
(WebCore::GraphicsContext::drawConsumingImageBuffer):
(WebCore::GraphicsContext::drawPattern):
(WebCore::GraphicsContext::drawNativeImageInternal):
* Source/WebCore/platform/graphics/Image.cpp:
(WebCore::Image::drawPattern):
(WebCore::Image::drawTiled):
* Source/WebCore/platform/graphics/Image.h:
(WebCore::Image::drawPattern):
(WebCore::Image::draw):
(WebCore::Image::drawTiled):
* Source/WebCore/platform/graphics/ImageBuffer.cpp:
(WebCore::copyImageBuffer):
* Source/WebCore/platform/graphics/ImageOrientation.h:
* Source/WebCore/platform/graphics/ImagePaintingOptions.cpp: Added.
(WebCore::operator<<):
* Source/WebCore/platform/graphics/ImagePaintingOptions.h:
(WebCore::ImagePaintingOptions::ImagePaintingOptions):
(WebCore::ImagePaintingOptions::setOption):
* Source/WebCore/platform/graphics/NamedImageGeneratedImage.cpp:
(WebCore::NamedImageGeneratedImage::draw):
(WebCore::NamedImageGeneratedImage::drawPattern):
* Source/WebCore/platform/graphics/NamedImageGeneratedImage.h:
* Source/WebCore/platform/graphics/NativeImage.h:
* Source/WebCore/platform/graphics/NullGraphicsContext.h:
(WebCore::NullGraphicsContext::drawImage):
(WebCore::NullGraphicsContext::drawTiledImage):
(WebCore::NullGraphicsContext::drawImageBuffer):
* Source/WebCore/platform/graphics/cairo/CairoOperations.cpp:
(WebCore::Cairo::drawPlatformImage):
(WebCore::Cairo::drawPattern):
* Source/WebCore/platform/graphics/cairo/CairoOperations.h:
* Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContextCairo::drawNativeImageInternal):
(WebCore::GraphicsContextCairo::drawPattern):
* Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.h:
* Source/WebCore/platform/graphics/cairo/NativeImageCairo.cpp:
(WebCore::NativeImage::draw):
* Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContextCG::drawNativeImageInternal):
(WebCore::GraphicsContextCG::drawPattern):
* Source/WebCore/platform/graphics/cg/GraphicsContextCG.h:
* Source/WebCore/platform/graphics/cg/NativeImageCG.cpp:
(WebCore::NativeImage::draw):
* Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp:
(WebCore::PDFDocumentImage::createCachedSubimage):
(WebCore::PDFDocumentImage::drawPDFDocument):
(WebCore::PDFDocumentImage::drawFromCachedSubimage):
(WebCore::PDFDocumentImage::draw):
* Source/WebCore/platform/graphics/cg/PDFDocumentImage.h:
* Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp:
(WebCore::DisplayList::DrawPattern::DrawPattern):
* Source/WebCore/platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::DrawImageBuffer::DrawImageBuffer):
(WebCore::DisplayList::DrawNativeImage::DrawNativeImage):
(WebCore::DisplayList::DrawPattern::DrawPattern):
* Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::drawImageBuffer):
(WebCore::DisplayList::Recorder::drawConsumingImageBuffer):
(WebCore::DisplayList::Recorder::drawNativeImageInternal):
(WebCore::DisplayList::Recorder::drawPattern):
* Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h:
(WebCore::DisplayList::Recorder::recordDrawPattern):
* Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.cpp:
(WebCore::DisplayList::RecorderImpl::recordDrawImageBuffer):
(WebCore::DisplayList::RecorderImpl::recordDrawNativeImage):
(WebCore::DisplayList::RecorderImpl::recordDrawPattern):
* Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.h:
(WebCore::DisplayList::RecorderImpl::recordDrawPattern):
* Source/WebCore/platform/graphics/filters/software/FECompositeSoftwareApplier.cpp:
(WebCore::FECompositeSoftwareApplier::applyNonArithmetic const):
* Source/WebCore/platform/graphics/filters/software/SourceAlphaSoftwareApplier.cpp:
(WebCore::SourceAlphaSoftwareApplier::apply const):
* Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
(Nicosia::CairoOperationRecorder::drawImageBuffer):
(Nicosia::CairoOperationRecorder::drawNativeImageInternal):
(Nicosia::CairoOperationRecorder::drawPattern):
* Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h:
* Source/WebCore/rendering/BackgroundPainter.cpp:
(WebCore::BackgroundPainter::paintFillLayer):
* Source/WebCore/rendering/svg/RenderSVGImage.cpp:
(WebCore::RenderSVGImage::paintIntoRect):
* Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp:
(WebCore::RenderSVGResourceMasker::drawContentIntoContext):
* Source/WebCore/rendering/svg/RenderSVGResourceMasker.h:
* Source/WebCore/svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::drawForContainer):
(WebCore::SVGImage::drawPatternForContainer):
(WebCore::SVGImage::draw):
* Source/WebCore/svg/graphics/SVGImage.h:
* Source/WebCore/svg/graphics/SVGImageForContainer.cpp:
(WebCore::SVGImageForContainer::draw):
(WebCore::SVGImageForContainer::drawPattern):
* Source/WebCore/svg/graphics/SVGImageForContainer.h:
* Source/WebCore/svg/graphics/SVGResourceImage.cpp:
(WebCore::SVGResourceImage::draw):
(WebCore::SVGResourceImage::drawPattern):
* Source/WebCore/svg/graphics/SVGResourceImage.h:
* Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.cpp:
(WebKit::RemoteDisplayListRecorder::drawImageBuffer):
(WebKit::RemoteDisplayListRecorder::drawNativeImage):
(WebKit::RemoteDisplayListRecorder::drawPattern):
* Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.h:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
Changes the argument coders because the member-wise argument coder
asserts the object size == encoded size. It cannot account for the
bitfields being used.

* Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp:
(WebKit::RemoteDisplayListRecorderProxy::recordDrawImageBuffer):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawNativeImage):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawPattern):
* Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h:
(WebKit::RemoteDisplayListRecorderProxy::recordDrawPattern):
* Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.cpp:
(WebKit::RemoteImageBufferProxy::sinkIntoBufferForDifferentThread):
* Tools/TestWebKitAPI/Tests/WebCore/ImageBufferTests.cpp:
(TestWebKitAPI::TEST_P):

Canonical link: https://commits.webkit.org/269066@main
  • Loading branch information
kkinnunen-apple committed Oct 9, 2023
1 parent c56d650 commit 3a5521b
Show file tree
Hide file tree
Showing 67 changed files with 321 additions and 202 deletions.
1 change: 1 addition & 0 deletions Source/WebCore/Sources.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2276,6 +2276,7 @@ platform/graphics/ImageBufferBackend.cpp
platform/graphics/ImageBufferPipe.cpp
platform/graphics/ImageDecoder.cpp
platform/graphics/ImageFrame.cpp
platform/graphics/ImagePaintingOptions.cpp
platform/graphics/ImageSource.cpp
platform/graphics/InbandGenericCue.cpp
platform/graphics/ImageResolution.cpp
Expand Down
6 changes: 4 additions & 2 deletions Source/WebCore/WebCore.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2696,7 +2696,6 @@
721B3ECF29680811004F5FF6 /* ColorWellPart.h in Headers */ = {isa = PBXBuildFile; fileRef = 721B3ECE29680811004F5FF6 /* ColorWellPart.h */; settings = {ATTRIBUTES = (Private, ); }; };
721B3EF52968F47D004F5FF6 /* MenuListButtonPart.h in Headers */ = {isa = PBXBuildFile; fileRef = 721B3EF42968F47D004F5FF6 /* MenuListButtonPart.h */; settings = {ATTRIBUTES = (Private, ); }; };
721B49742512BA3B00FE9D3B /* ImageBitmapBacking.h in Headers */ = {isa = PBXBuildFile; fileRef = 721B49702512AC0400FE9D3B /* ImageBitmapBacking.h */; settings = {ATTRIBUTES = (Private, ); }; };
72283F0E230B268C00F5D828 /* ImagePaintingOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 72C18A3F230B04B7006847C7 /* ImagePaintingOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
722AF2DE27E1C2060078D997 /* GraphicsContextStateSaver.h in Headers */ = {isa = PBXBuildFile; fileRef = 722AF2DB27E1C2040078D997 /* GraphicsContextStateSaver.h */; settings = {ATTRIBUTES = (Private, ); }; };
722AF2DF27E1C2060078D997 /* GraphicsContextState.h in Headers */ = {isa = PBXBuildFile; fileRef = 722AF2DC27E1C2050078D997 /* GraphicsContextState.h */; settings = {ATTRIBUTES = (Private, ); }; };
722AF2E227E1C4050078D997 /* PlatformGraphicsContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 722AF2E127E1C4030078D997 /* PlatformGraphicsContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
Expand Down Expand Up @@ -2837,6 +2836,7 @@
7AF9B20618CFB2DF00C64BEF /* VTTRegionList.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AF9B20018CFB2DF00C64BEF /* VTTRegionList.h */; };
7AF9B20D18CFB5F400C64BEF /* JSVTTRegion.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AF9B20918CFB5F200C64BEF /* JSVTTRegion.h */; };
7AF9B20F18CFB5F400C64BEF /* JSVTTRegionList.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AF9B20B18CFB5F300C64BEF /* JSVTTRegionList.h */; };
7B0C389F2ACEDEF400F1FDDC /* ImagePaintingOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 72C18A3F230B04B7006847C7 /* ImagePaintingOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
7B0E6DCA2AB463E4005189E8 /* NullImageBufferBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B0E6DC82AB463E4005189E8 /* NullImageBufferBackend.h */; settings = {ATTRIBUTES = (Private, ); }; };
7B10339E2549721700C8C1AC /* GraphicsContextGLCV.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B10339D2549720100C8C1AC /* GraphicsContextGLCV.h */; settings = {ATTRIBUTES = (Private, ); }; };
7B10339F2549721E00C8C1AC /* GraphicsContextGLCVCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B10339C2549720100C8C1AC /* GraphicsContextGLCVCocoa.h */; settings = {ATTRIBUTES = (Private, ); }; };
Expand Down Expand Up @@ -13162,6 +13162,7 @@
7AF9B20A18CFB5F300C64BEF /* JSVTTRegionList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSVTTRegionList.cpp; sourceTree = "<group>"; };
7AF9B20B18CFB5F300C64BEF /* JSVTTRegionList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSVTTRegionList.h; sourceTree = "<group>"; };
7B0AA0B92AC413B6002745B6 /* IOSurfaceImageBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IOSurfaceImageBuffer.h; sourceTree = "<group>"; };
7B0C389D2ACED2F000F1FDDC /* ImagePaintingOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImagePaintingOptions.cpp; sourceTree = "<group>"; };
7B0E6DC82AB463E4005189E8 /* NullImageBufferBackend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NullImageBufferBackend.h; sourceTree = "<group>"; };
7B0E6DC92AB463E4005189E8 /* NullImageBufferBackend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NullImageBufferBackend.cpp; sourceTree = "<group>"; };
7B10339A2549720000C8C1AC /* GraphicsContextGLCVCocoa.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContextGLCVCocoa.cpp; sourceTree = "<group>"; };
Expand Down Expand Up @@ -32242,6 +32243,7 @@
5576A5631D88A70800CCC04C /* ImageFrame.h */,
BC7F44A70B9E324E00A9D081 /* ImageObserver.h */,
A8748D6612CC3763001FBA41 /* ImageOrientation.h */,
7B0C389D2ACED2F000F1FDDC /* ImagePaintingOptions.cpp */,
72C18A3F230B04B7006847C7 /* ImagePaintingOptions.h */,
CA3A4AAB25416E3C006CDAE2 /* ImageResolution.cpp */,
CA3A4AAD25416E3E006CDAE2 /* ImageResolution.h */,
Expand Down Expand Up @@ -38940,7 +38942,7 @@
F46D5386273D7E460009FA80 /* ImageOverlay.h in Headers */,
F482434B260C33060022497C /* ImageOverlayController.h in Headers */,
F446EDE1265DB1E50031DA8F /* ImageOverlayDataDetectionResultIdentifier.h in Headers */,
72283F0E230B268C00F5D828 /* ImagePaintingOptions.h in Headers */,
7B0C389F2ACEDEF400F1FDDC /* ImagePaintingOptions.h in Headers */,
B51A2F3F17D7D3AE0072517A /* ImageQualityController.h in Headers */,
CA3A4AAF25416E40006CDAE2 /* ImageResolution.h in Headers */,
417BA339299567CE007AEAB4 /* ImageResource.h in Headers */,
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/html/CustomPaintImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ ImageDrawResult CustomPaintImage::doCustomPaint(GraphicsContext& destContext, co
return ImageDrawResult::DidDraw;
}

ImageDrawResult CustomPaintImage::draw(GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options)
ImageDrawResult CustomPaintImage::draw(GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, ImagePaintingOptions options)
{
GraphicsContextStateSaver stateSaver(destContext);
destContext.setCompositeOperation(options.compositeOperator(), options.blendMode());
Expand All @@ -142,7 +142,7 @@ ImageDrawResult CustomPaintImage::draw(GraphicsContext& destContext, const Float
}

void CustomPaintImage::drawPattern(GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform,
const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options)
const FloatPoint& phase, const FloatSize& spacing, ImagePaintingOptions options)
{
// Allow the generator to provide visually-equivalent tiling parameters for better performance.
FloatSize adjustedSize = size();
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/html/CustomPaintImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ class CustomPaintImage final : public GeneratedImage {

ImageDrawResult doCustomPaint(GraphicsContext&, const FloatSize&);

ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& = { }) final;
void drawPattern(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& = { }) final;
ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, ImagePaintingOptions = { }) final;
void drawPattern(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, ImagePaintingOptions = { }) final;

WeakPtr<PaintWorkletGlobalScope::PaintDefinition> m_paintDefinition;
Vector<AtomString> m_inputProperties;
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/html/HTMLCanvasElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ void HTMLCanvasElement::paint(GraphicsContext& context, const LayoutRect& r)
if (shouldPaint) {
if (hasCreatedImageBuffer()) {
if (ImageBuffer* imageBuffer = buffer())
context.drawImageBuffer(*imageBuffer, snappedIntRect(r), context.compositeOperation());
context.drawImageBuffer(*imageBuffer, snappedIntRect(r), { context.compositeOperation() });
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1921,16 +1921,16 @@ void CanvasRenderingContext2DBase::compositeBuffer(ImageBuffer& buffer, const In
c->clipOut(bufferRect);
c->clearRect(canvasRect);
c->restore();
c->drawImageBuffer(buffer, bufferRect.location(), state().globalComposite);
c->drawImageBuffer(buffer, bufferRect.location(), { state().globalComposite });
c->restore();
}

static void drawImageToContext(Image& image, GraphicsContext& context, const FloatRect& dest, const FloatRect& src, const ImagePaintingOptions& options)
static void drawImageToContext(Image& image, GraphicsContext& context, const FloatRect& dest, const FloatRect& src, ImagePaintingOptions options)
{
context.drawImage(image, dest, src, options);
}

static void drawImageToContext(ImageBuffer& imageBuffer, GraphicsContext& context, const FloatRect& dest, const FloatRect& src, const ImagePaintingOptions& options)
static void drawImageToContext(ImageBuffer& imageBuffer, GraphicsContext& context, const FloatRect& dest, const FloatRect& src, ImagePaintingOptions options)
{
context.drawImageBuffer(imageBuffer, dest, src, options);
}
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4503,7 +4503,7 @@ RefPtr<Image> WebGLRenderingContextBase::videoFrameToImage(HTMLVideoElement& vid
synthesizeGLError(GraphicsContextGL::OUT_OF_MEMORY, functionName, "out of memory");
return nullptr;
}
imageBuffer->context().drawNativeImage(*nativeImage, imageRect.size(), imageRect, imageRect, CompositeOperator::Copy);
imageBuffer->context().drawNativeImage(*nativeImage, imageRect.size(), imageRect, imageRect, { CompositeOperator::Copy });
}
#endif
if (!imageBuffer) {
Expand Down
10 changes: 5 additions & 5 deletions Source/WebCore/platform/graphics/BifurcatedGraphicsContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ void BifurcatedGraphicsContext::setMiterLimit(float miterLimit)
VERIFY_STATE_SYNCHRONIZATION();
}

void BifurcatedGraphicsContext::drawNativeImageInternal(NativeImage& nativeImage, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options)
void BifurcatedGraphicsContext::drawNativeImageInternal(NativeImage& nativeImage, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, ImagePaintingOptions options)
{
m_primaryContext.drawNativeImageInternal(nativeImage, selfSize, destRect, srcRect, options);
m_secondaryContext.drawNativeImageInternal(nativeImage, selfSize, destRect, srcRect, options);
Expand Down Expand Up @@ -386,15 +386,15 @@ void BifurcatedGraphicsContext::drawControlPart(ControlPart& part, const FloatRo
VERIFY_STATE_SYNCHRONIZATION();
}

void BifurcatedGraphicsContext::drawPattern(NativeImage& nativeImage, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options)
void BifurcatedGraphicsContext::drawPattern(NativeImage& nativeImage, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, ImagePaintingOptions options)
{
m_primaryContext.drawPattern(nativeImage, destRect, tileRect, patternTransform, phase, spacing, options);
m_secondaryContext.drawPattern(nativeImage, destRect, tileRect, patternTransform, phase, spacing, options);

VERIFY_STATE_SYNCHRONIZATION();
}

ImageDrawResult BifurcatedGraphicsContext::drawImage(Image& image, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& options)
ImageDrawResult BifurcatedGraphicsContext::drawImage(Image& image, const FloatRect& destination, const FloatRect& source, ImagePaintingOptions options)
{
auto result = m_primaryContext.drawImage(image, destination, source, options);
m_secondaryContext.drawImage(image, destination, source, options);
Expand All @@ -404,7 +404,7 @@ ImageDrawResult BifurcatedGraphicsContext::drawImage(Image& image, const FloatRe
return result;
}

ImageDrawResult BifurcatedGraphicsContext::drawTiledImage(Image& image, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions& options)
ImageDrawResult BifurcatedGraphicsContext::drawTiledImage(Image& image, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, ImagePaintingOptions options)
{
auto result = m_primaryContext.drawTiledImage(image, destination, source, tileSize, spacing, options);
m_secondaryContext.drawTiledImage(image, destination, source, tileSize, spacing, options);
Expand All @@ -414,7 +414,7 @@ ImageDrawResult BifurcatedGraphicsContext::drawTiledImage(Image& image, const Fl
return result;
}

ImageDrawResult BifurcatedGraphicsContext::drawTiledImage(Image& image, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor, Image::TileRule hRule, Image::TileRule vRule, const ImagePaintingOptions& options)
ImageDrawResult BifurcatedGraphicsContext::drawTiledImage(Image& image, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor, Image::TileRule hRule, Image::TileRule vRule, ImagePaintingOptions options)
{
auto result = m_primaryContext.drawTiledImage(image, destination, source, tileScaleFactor, hRule, vRule, options);
m_secondaryContext.drawTiledImage(image, destination, source, tileScaleFactor, hRule, vRule, options);
Expand Down
10 changes: 5 additions & 5 deletions Source/WebCore/platform/graphics/BifurcatedGraphicsContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ class WEBCORE_EXPORT BifurcatedGraphicsContext : public GraphicsContext {
void setLineJoin(LineJoin) final;
void setMiterLimit(float) final;

void drawNativeImageInternal(NativeImage&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& = { }) final;
void drawNativeImageInternal(NativeImage&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, ImagePaintingOptions = { }) final;
bool needsCachedNativeImageInvalidationWorkaround(RenderingMode) final;
void drawSystemImage(SystemImage&, const FloatRect&) final;
void drawPattern(NativeImage&, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& = { }) final;
ImageDrawResult drawImage(Image&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& = { ImageOrientation::Orientation::FromImage }) final;
ImageDrawResult drawTiledImage(Image&, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions& = { }) final;
ImageDrawResult drawTiledImage(Image&, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor, Image::TileRule, Image::TileRule, const ImagePaintingOptions& = { }) final;
void drawPattern(NativeImage&, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, ImagePaintingOptions = { }) final;
ImageDrawResult drawImage(Image&, const FloatRect& destination, const FloatRect& source, ImagePaintingOptions = { ImageOrientation::Orientation::FromImage }) final;
ImageDrawResult drawTiledImage(Image&, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, ImagePaintingOptions = { }) final;
ImageDrawResult drawTiledImage(Image&, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor, Image::TileRule, Image::TileRule, ImagePaintingOptions = { }) final;
void drawControlPart(ControlPart&, const FloatRoundedRect& borderRect, float deviceScaleFactor, const ControlStyle&) final;

#if ENABLE(VIDEO)
Expand Down
6 changes: 3 additions & 3 deletions Source/WebCore/platform/graphics/BitmapImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ bool BitmapImage::notSolidColor()
}
#endif // ASSERT_ENABLED

static inline void drawNativeImage(NativeImage& image, GraphicsContext& context, const FloatRect& destRect, const FloatRect& srcRect, const IntSize& srcSize, const ImagePaintingOptions& options)
static inline void drawNativeImage(NativeImage& image, GraphicsContext& context, const FloatRect& destRect, const FloatRect& srcRect, const IntSize& srcSize, ImagePaintingOptions options)
{
// Subsampling may have given us an image that is smaller than size().
IntSize subsampledImageSize = image.size();
Expand All @@ -231,7 +231,7 @@ static inline void drawNativeImage(NativeImage& image, GraphicsContext& context,
context.drawNativeImage(image, subsampledImageSize, destRect, adjustedSrcRect, options);
}

ImageDrawResult BitmapImage::draw(GraphicsContext& context, const FloatRect& destRect, const FloatRect& requestedSrcRect, const ImagePaintingOptions& options)
ImageDrawResult BitmapImage::draw(GraphicsContext& context, const FloatRect& destRect, const FloatRect& requestedSrcRect, ImagePaintingOptions options)
{
if (destRect.isEmpty() || requestedSrcRect.isEmpty())
return ImageDrawResult::DidNothing;
Expand Down Expand Up @@ -337,7 +337,7 @@ ImageDrawResult BitmapImage::draw(GraphicsContext& context, const FloatRect& des
return result;
}

void BitmapImage::drawPattern(GraphicsContext& ctxt, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& transform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options)
void BitmapImage::drawPattern(GraphicsContext& ctxt, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& transform, const FloatPoint& phase, const FloatSize& spacing, ImagePaintingOptions options)
{
if (tileRect.isEmpty())
return;
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/platform/graphics/BitmapImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ class BitmapImage final : public Image {
FloatSize sourceSize(ImageOrientation orientation = ImageOrientation::Orientation::FromImage) const final { return m_source->sourceSize(orientation); }
bool hasDensityCorrectedSize() const override { return m_source->hasDensityCorrectedSize(); }

ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& = { }) override;
void drawPattern(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& = { }) override;
ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, ImagePaintingOptions = { }) override;
void drawPattern(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, ImagePaintingOptions = { }) override;
#if PLATFORM(WIN)
void drawFrameMatchingSourceSize(GraphicsContext&, const FloatRect& dstRect, const IntSize& srcSize, CompositeOperator) override;
#endif
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/platform/graphics/CrossfadeGeneratedImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void CrossfadeGeneratedImage::drawCrossfade(GraphicsContext& context)
context.endTransparencyLayer();
}

ImageDrawResult CrossfadeGeneratedImage::draw(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& options)
ImageDrawResult CrossfadeGeneratedImage::draw(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, ImagePaintingOptions options)
{
GraphicsContextStateSaver stateSaver(context);
context.setCompositeOperation(options.compositeOperator(), options.blendMode());
Expand All @@ -101,7 +101,7 @@ ImageDrawResult CrossfadeGeneratedImage::draw(GraphicsContext& context, const Fl
return ImageDrawResult::DidDraw;
}

void CrossfadeGeneratedImage::drawPattern(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options)
void CrossfadeGeneratedImage::drawPattern(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, ImagePaintingOptions options)
{
auto imageBuffer = context.createImageBuffer(size());
if (!imageBuffer)
Expand Down
Loading

0 comments on commit 3a5521b

Please sign in to comment.