Changeset 191049 in webkit
- Timestamp:
- Oct 14, 2015, 11:10:32 AM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 61 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/css/CSSCrossfadeValue.cpp (modified) (1 diff)
-
WebCore/css/CSSFilterImageValue.cpp (modified) (1 diff)
-
WebCore/html/HTMLCanvasElement.cpp (modified) (1 diff)
-
WebCore/html/canvas/CanvasRenderingContext2D.cpp (modified) (8 diffs)
-
WebCore/html/canvas/CanvasRenderingContext2D.h (modified) (1 diff)
-
WebCore/html/canvas/WebGL2RenderingContext.cpp (modified) (1 diff)
-
WebCore/html/canvas/WebGLRenderingContext.cpp (modified) (1 diff)
-
WebCore/html/canvas/WebGLRenderingContextBase.cpp (modified) (3 diffs)
-
WebCore/html/canvas/WebGLRenderingContextBase.h (modified) (1 diff)
-
WebCore/platform/ScrollView.cpp (modified) (1 diff)
-
WebCore/platform/graphics/CrossfadeGeneratedImage.cpp (modified) (4 diffs)
-
WebCore/platform/graphics/CrossfadeGeneratedImage.h (modified) (2 diffs)
-
WebCore/platform/graphics/GradientImage.cpp (modified) (1 diff)
-
WebCore/platform/graphics/GraphicsContext.cpp (modified) (5 diffs)
-
WebCore/platform/graphics/GraphicsContext.h (modified) (3 diffs)
-
WebCore/platform/graphics/ShadowBlur.cpp (modified) (9 diffs)
-
WebCore/platform/graphics/cairo/ImageBufferCairo.cpp (modified) (1 diff)
-
WebCore/platform/graphics/cg/PDFDocumentImage.cpp (modified) (1 diff)
-
WebCore/platform/graphics/filters/FEBlend.cpp (modified) (1 diff)
-
WebCore/platform/graphics/filters/FEColorMatrix.cpp (modified) (1 diff)
-
WebCore/platform/graphics/filters/FEComposite.cpp (modified) (2 diffs)
-
WebCore/platform/graphics/filters/FEDropShadow.cpp (modified) (2 diffs)
-
WebCore/platform/graphics/filters/FEMerge.cpp (modified) (1 diff)
-
WebCore/platform/graphics/filters/FEOffset.cpp (modified) (2 diffs)
-
WebCore/platform/graphics/filters/FETile.cpp (modified) (2 diffs)
-
WebCore/platform/graphics/filters/SourceAlpha.cpp (modified) (1 diff)
-
WebCore/platform/graphics/filters/SourceGraphic.cpp (modified) (1 diff)
-
WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (modified) (1 diff)
-
WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp (modified) (3 diffs)
-
WebCore/platform/mac/ThemeMac.mm (modified) (1 diff)
-
WebCore/rendering/FilterEffectRenderer.cpp (modified) (1 diff)
-
WebCore/rendering/ImageQualityController.cpp (modified) (3 diffs)
-
WebCore/rendering/ImageQualityController.h (modified) (1 diff)
-
WebCore/rendering/RenderBoxModelObject.cpp (modified) (2 diffs)
-
WebCore/rendering/RenderBoxModelObject.h (modified) (1 diff)
-
WebCore/rendering/RenderEmbeddedObject.cpp (modified) (3 diffs)
-
WebCore/rendering/RenderEmbeddedObject.h (modified) (1 diff)
-
WebCore/rendering/RenderImage.cpp (modified) (2 diffs)
-
WebCore/rendering/RenderImageResourceStyleImage.cpp (modified) (2 diffs)
-
WebCore/rendering/RenderLayer.cpp (modified) (1 diff)
-
WebCore/rendering/RenderListMarker.cpp (modified) (1 diff)
-
WebCore/rendering/RenderSnapshottedPlugIn.cpp (modified) (2 diffs)
-
WebCore/rendering/RenderThemeMac.mm (modified) (2 diffs)
-
WebCore/rendering/RenderThemeWin.cpp (modified) (3 diffs)
-
WebCore/rendering/shapes/Shape.cpp (modified) (1 diff)
-
WebCore/rendering/shapes/ShapeOutsideInfo.cpp (modified) (1 diff)
-
WebCore/rendering/style/NinePieceImage.cpp (modified) (3 diffs)
-
WebCore/rendering/svg/RenderSVGImage.cpp (modified) (2 diffs)
-
WebCore/rendering/svg/RenderSVGResourceFilter.cpp (modified) (1 diff)
-
WebCore/rendering/svg/SVGRenderingContext.cpp (modified) (3 diffs)
-
WebCore/svg/graphics/filters/SVGFEImage.cpp (modified) (1 diff)
-
WebKit/win/ChangeLog (modified) (1 diff)
-
WebKit/win/FullscreenVideoController.cpp (modified) (1 diff)
-
WebKit/win/Plugins/PluginView.cpp (modified) (1 diff)
-
WebKit2/ChangeLog (modified) (1 diff)
-
WebKit2/Shared/ContextMenuContextData.cpp (modified) (1 diff)
-
WebKit2/Shared/WebCoreArgumentCoders.cpp (modified) (5 diffs)
-
WebKit2/WebProcess/WebPage/WebFrame.cpp (modified) (1 diff)
-
WebKit2/WebProcess/WebPage/ios/FindControllerIOS.mm (modified) (1 diff)
-
WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r191048 r191049 1 2015-10-14 Simon Fraser <simon.fraser@apple.com> 2 3 Change GraphicsContext image-drawing functions to take references 4 https://bugs.webkit.org/show_bug.cgi?id=150108 5 6 Reviewed by Tim Horton and Sam Weinig. 7 8 Change GraphicsContext::drawImage(), drawTiledImage(), drawImageBuffer(), clipToImageBuffer() 9 and isCompatibleWithBuffer() to take references, and adjust calling code, adding 10 null-checks where necessary. 11 12 * css/CSSCrossfadeValue.cpp: 13 (WebCore::CSSCrossfadeValue::image): 14 * css/CSSFilterImageValue.cpp: 15 (WebCore::CSSFilterImageValue::image): 16 * html/HTMLCanvasElement.cpp: 17 (WebCore::HTMLCanvasElement::paint): 18 * html/canvas/CanvasRenderingContext2D.cpp: 19 (WebCore::CanvasRenderingContext2D::drawImage): 20 (WebCore::CanvasRenderingContext2D::compositeBuffer): 21 (WebCore::drawImageToContext): 22 (WebCore::CanvasRenderingContext2D::fullCanvasCompositedDrawImage): 23 (WebCore::CanvasRenderingContext2D::drawTextInternal): 24 * html/canvas/CanvasRenderingContext2D.h: 25 * html/canvas/WebGL2RenderingContext.cpp: 26 (WebCore::WebGL2RenderingContext::texSubImage2D): 27 * html/canvas/WebGLRenderingContext.cpp: 28 (WebCore::WebGLRenderingContext::texSubImage2D): 29 * html/canvas/WebGLRenderingContextBase.cpp: 30 (WebCore::WebGLRenderingContextBase::drawImageIntoBuffer): 31 (WebCore::WebGLRenderingContextBase::texImage2D): 32 * html/canvas/WebGLRenderingContextBase.h: 33 * platform/ScrollView.cpp: 34 (WebCore::ScrollView::paintPanScrollIcon): 35 * platform/graphics/CrossfadeGeneratedImage.cpp: 36 (WebCore::CrossfadeGeneratedImage::CrossfadeGeneratedImage): 37 (WebCore::drawCrossfadeSubimage): 38 (WebCore::CrossfadeGeneratedImage::drawCrossfade): 39 * platform/graphics/CrossfadeGeneratedImage.h: 40 * platform/graphics/GradientImage.cpp: 41 (WebCore::GradientImage::drawPattern): 42 * platform/graphics/GraphicsContext.cpp: 43 (WebCore::GraphicsContext::drawImage): 44 (WebCore::GraphicsContext::drawTiledImage): 45 (WebCore::GraphicsContext::drawImageBuffer): 46 (WebCore::GraphicsContext::clipToImageBuffer): 47 (WebCore::GraphicsContext::isCompatibleWithBuffer): 48 * platform/graphics/GraphicsContext.h: 49 * platform/graphics/ShadowBlur.cpp: 50 (WebCore::ShadowBlur::drawShadowBuffer): 51 (WebCore::ShadowBlur::drawRectShadowWithoutTiling): 52 (WebCore::ShadowBlur::drawInsetShadowWithoutTiling): 53 (WebCore::ShadowBlur::drawInsetShadowWithTiling): 54 (WebCore::ShadowBlur::drawRectShadowWithTiling): 55 (WebCore::ShadowBlur::drawLayerPieces): 56 (WebCore::ShadowBlur::endShadowLayer): 57 * platform/graphics/cairo/ImageBufferCairo.cpp: 58 (WebCore::ImageBuffer::draw): 59 * platform/graphics/cg/PDFDocumentImage.cpp: 60 (WebCore::PDFDocumentImage::draw): 61 * platform/graphics/filters/FEBlend.cpp: 62 (WebCore::FEBlend::platformApplySoftware): 63 * platform/graphics/filters/FEColorMatrix.cpp: 64 (WebCore::FEColorMatrix::platformApplySoftware): 65 * platform/graphics/filters/FEComposite.cpp: 66 (WebCore::FEComposite::platformApplySoftware): 67 * platform/graphics/filters/FEDropShadow.cpp: 68 (WebCore::FEDropShadow::platformApplySoftware): 69 * platform/graphics/filters/FEMerge.cpp: 70 (WebCore::FEMerge::platformApplySoftware): 71 * platform/graphics/filters/FEOffset.cpp: 72 (WebCore::FEOffset::platformApplySoftware): 73 * platform/graphics/filters/FETile.cpp: 74 (WebCore::FETile::platformApplySoftware): 75 * platform/graphics/filters/SourceAlpha.cpp: 76 (WebCore::SourceAlpha::platformApplySoftware): 77 * platform/graphics/filters/SourceGraphic.cpp: 78 (WebCore::SourceGraphic::platformApplySoftware): 79 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: 80 (WebCore::MediaPlayerPrivateGStreamerBase::paint): 81 * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp: 82 (WebCore::ImageBackingSurfaceClient::ImageBackingSurfaceClient): 83 (WebCore::CoordinatedImageBacking::update): 84 * platform/mac/ThemeMac.mm: 85 (WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext): 86 * rendering/FilterEffectRenderer.cpp: 87 (WebCore::FilterEffectRendererHelper::applyFilterEffect): 88 * rendering/ImageQualityController.cpp: 89 (WebCore::ImageQualityController::shouldPaintAtLowQuality): 90 * rendering/ImageQualityController.h: 91 * rendering/RenderBoxModelObject.cpp: 92 (WebCore::RenderBoxModelObject::shouldPaintAtLowQuality): 93 (WebCore::RenderBoxModelObject::paintFillLayerExtended): 94 * rendering/RenderBoxModelObject.h: 95 * rendering/RenderEmbeddedObject.cpp: 96 (WebCore::RenderEmbeddedObject::paintSnapshotImage): 97 (WebCore::RenderEmbeddedObject::paintContents): 98 * rendering/RenderEmbeddedObject.h: 99 * rendering/RenderImage.cpp: 100 (WebCore::RenderImage::paintReplaced): 101 (WebCore::RenderImage::paintIntoRect): 102 * rendering/RenderImageResourceStyleImage.cpp: 103 (WebCore::RenderImageResourceStyleImage::shutdown): 104 (WebCore::RenderImageResourceStyleImage::image): 105 * rendering/RenderLayer.cpp: 106 (WebCore::RenderLayer::drawPlatformResizerImage): 107 * rendering/RenderListMarker.cpp: 108 (WebCore::RenderListMarker::paint): 109 * rendering/RenderSnapshottedPlugIn.cpp: 110 (WebCore::RenderSnapshottedPlugIn::paintSnapshot): 111 * rendering/RenderThemeMac.mm: 112 (WebCore::RenderThemeMac::paintProgressBar): 113 (WebCore::RenderThemeMac::paintSnapshottedPluginOverlay): 114 * rendering/RenderThemeWin.cpp: 115 (WebCore::RenderThemeWin::paintSearchFieldCancelButton): 116 (WebCore::RenderThemeWin::paintSearchFieldResultsDecorationPart): 117 (WebCore::RenderThemeWin::paintSearchFieldResultsButton): 118 * rendering/shapes/Shape.cpp: 119 (WebCore::Shape::createRasterShape): 120 * rendering/shapes/ShapeOutsideInfo.cpp: 121 (WebCore::ShapeOutsideInfo::createShapeForImage): Deleted. 122 * rendering/style/NinePieceImage.cpp: 123 (WebCore::NinePieceImage::paint): 124 * rendering/svg/RenderSVGImage.cpp: 125 (WebCore::RenderSVGImage::paintForeground): 126 * rendering/svg/RenderSVGResourceFilter.cpp: 127 (WebCore::RenderSVGResourceFilter::postApplyResource): 128 * rendering/svg/SVGRenderingContext.cpp: 129 (WebCore::SVGRenderingContext::clipToImageBuffer): 130 (WebCore::SVGRenderingContext::bufferForeground): 131 * svg/graphics/filters/SVGFEImage.cpp: 132 (WebCore::FEImage::platformApplySoftware): 133 1 134 2015-10-14 Said Abou-Hallawa <sabouhallawa@apple.com> 2 135 -
trunk/Source/WebCore/css/CSSCrossfadeValue.cpp
r188315 r191049 166 166 return Image::nullImage(); 167 167 168 m_generatedImage = CrossfadeGeneratedImage::create( fromImage,toImage, m_percentageValue->getFloatValue(), fixedSize(renderer), size);168 m_generatedImage = CrossfadeGeneratedImage::create(*fromImage, *toImage, m_percentageValue->getFloatValue(), fixedSize(renderer), size); 169 169 170 170 return m_generatedImage; -
trunk/Source/WebCore/css/CSSFilterImageValue.cpp
r190124 r191049 125 125 if (!texture) 126 126 return Image::nullImage(); 127 127 128 FloatRect imageRect = FloatRect(FloatPoint(), size); 128 texture->context().drawImage( image, ColorSpaceDeviceRGB, imageRect);129 texture->context().drawImage(*image, ColorSpaceDeviceRGB, imageRect); 129 130 130 131 RefPtr<FilterEffectRenderer> filterRenderer = FilterEffectRenderer::create(); -
trunk/Source/WebCore/html/HTMLCanvasElement.cpp
r190613 r191049 389 389 orientationDescription.setImageOrientationEnum(renderer()->style().imageOrientation()); 390 390 #endif 391 context.drawImage( m_presentedImage.get(), ColorSpaceDeviceRGB, snappedIntRect(r), ImagePaintingOptions(orientationDescription, useLowQualityScale));391 context.drawImage(*m_presentedImage, ColorSpaceDeviceRGB, snappedIntRect(r), ImagePaintingOptions(orientationDescription, useLowQualityScale)); 392 392 } else 393 context.drawImageBuffer( imageBuffer, ColorSpaceDeviceRGB, snappedIntRect(r), useLowQualityScale);393 context.drawImageBuffer(*imageBuffer, ColorSpaceDeviceRGB, snappedIntRect(r), useLowQualityScale); 394 394 } 395 395 } -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r190618 r191049 1449 1449 1450 1450 if (rectContainsCanvas(normalizedDstRect)) { 1451 c->drawImage( image, ColorSpaceDeviceRGB, normalizedDstRect, normalizedSrcRect, ImagePaintingOptions(op, blendMode));1451 c->drawImage(*image, ColorSpaceDeviceRGB, normalizedDstRect, normalizedSrcRect, ImagePaintingOptions(op, blendMode)); 1452 1452 didDrawEntireCanvas(); 1453 1453 } else if (isFullCanvasCompositeMode(op)) { 1454 fullCanvasCompositedDrawImage( image, ColorSpaceDeviceRGB, normalizedDstRect, normalizedSrcRect, op);1454 fullCanvasCompositedDrawImage(*image, ColorSpaceDeviceRGB, normalizedDstRect, normalizedSrcRect, op); 1455 1455 didDrawEntireCanvas(); 1456 1456 } else if (op == CompositeCopy) { 1457 1457 clearCanvas(); 1458 c->drawImage( image, ColorSpaceDeviceRGB, normalizedDstRect, normalizedSrcRect, ImagePaintingOptions(op, blendMode));1458 c->drawImage(*image, ColorSpaceDeviceRGB, normalizedDstRect, normalizedSrcRect, ImagePaintingOptions(op, blendMode)); 1459 1459 didDrawEntireCanvas(); 1460 1460 } else { 1461 c->drawImage( image, ColorSpaceDeviceRGB, normalizedDstRect, normalizedSrcRect, ImagePaintingOptions(op, blendMode));1461 c->drawImage(*image, ColorSpaceDeviceRGB, normalizedDstRect, normalizedSrcRect, ImagePaintingOptions(op, blendMode)); 1462 1462 didDraw(normalizedDstRect); 1463 1463 } … … 1537 1537 1538 1538 if (rectContainsCanvas(dstRect)) { 1539 c->drawImageBuffer( buffer, ColorSpaceDeviceRGB, dstRect, srcRect, ImagePaintingOptions(state().globalComposite, state().globalBlend));1539 c->drawImageBuffer(*buffer, ColorSpaceDeviceRGB, dstRect, srcRect, ImagePaintingOptions(state().globalComposite, state().globalBlend)); 1540 1540 didDrawEntireCanvas(); 1541 1541 } else if (isFullCanvasCompositeMode(state().globalComposite)) { 1542 fullCanvasCompositedDrawImage( buffer, ColorSpaceDeviceRGB, dstRect, srcRect, state().globalComposite);1542 fullCanvasCompositedDrawImage(*buffer, ColorSpaceDeviceRGB, dstRect, srcRect, state().globalComposite); 1543 1543 didDrawEntireCanvas(); 1544 1544 } else if (state().globalComposite == CompositeCopy) { 1545 1545 clearCanvas(); 1546 c->drawImageBuffer( buffer, ColorSpaceDeviceRGB, dstRect, srcRect, ImagePaintingOptions(state().globalComposite, state().globalBlend));1546 c->drawImageBuffer(*buffer, ColorSpaceDeviceRGB, dstRect, srcRect, ImagePaintingOptions(state().globalComposite, state().globalBlend)); 1547 1547 didDrawEntireCanvas(); 1548 1548 } else { 1549 c->drawImageBuffer( buffer, ColorSpaceDeviceRGB, dstRect, srcRect, ImagePaintingOptions(state().globalComposite, state().globalBlend));1549 c->drawImageBuffer(*buffer, ColorSpaceDeviceRGB, dstRect, srcRect, ImagePaintingOptions(state().globalComposite, state().globalBlend)); 1550 1550 didDraw(dstRect); 1551 1551 } … … 1710 1710 } 1711 1711 1712 void CanvasRenderingContext2D::compositeBuffer(ImageBuffer *buffer, const IntRect& bufferRect, CompositeOperator op)1712 void CanvasRenderingContext2D::compositeBuffer(ImageBuffer& buffer, const IntRect& bufferRect, CompositeOperator op) 1713 1713 { 1714 1714 IntRect canvasRect(0, 0, canvas()->width(), canvas()->height()); … … 1731 1731 } 1732 1732 1733 static void drawImageToContext(Image *image, GraphicsContext& context, ColorSpace styleColorSpace, const FloatRect& dest, const FloatRect& src, CompositeOperator op)1733 static void drawImageToContext(Image& image, GraphicsContext& context, ColorSpace styleColorSpace, const FloatRect& dest, const FloatRect& src, CompositeOperator op) 1734 1734 { 1735 1735 context.drawImage(image, styleColorSpace, dest, src, op); 1736 1736 } 1737 1737 1738 static void drawImageToContext(ImageBuffer *imageBuffer, GraphicsContext& context, ColorSpace styleColorSpace, const FloatRect& dest, const FloatRect& src, CompositeOperator op)1738 static void drawImageToContext(ImageBuffer& imageBuffer, GraphicsContext& context, ColorSpace styleColorSpace, const FloatRect& dest, const FloatRect& src, CompositeOperator op) 1739 1739 { 1740 1740 context.drawImageBuffer(imageBuffer, styleColorSpace, dest, src, op); 1741 1741 } 1742 1742 1743 template<class T> void CanvasRenderingContext2D::fullCanvasCompositedDrawImage(T *image, ColorSpace styleColorSpace, const FloatRect& dest, const FloatRect& src, CompositeOperator op)1743 template<class T> void CanvasRenderingContext2D::fullCanvasCompositedDrawImage(T& image, ColorSpace styleColorSpace, const FloatRect& dest, const FloatRect& src, CompositeOperator op) 1744 1744 { 1745 1745 ASSERT(isFullCanvasCompositeMode(op)); … … 1769 1769 drawImageToContext(image, buffer->context(), styleColorSpace, adjustedDest, src, CompositeSourceOver); 1770 1770 1771 compositeBuffer( buffer.get(), bufferRect, op);1771 compositeBuffer(*buffer, bufferRect, op); 1772 1772 } 1773 1773 … … 2420 2420 // The slop built in to this mask rect matches the heuristic used in FontCGWin.cpp for GDI text. 2421 2421 FloatRect textRect = FloatRect(location.x() - fontMetrics.height() / 2, location.y() - fontMetrics.ascent() - fontMetrics.lineGap(), 2422 width + fontMetrics.height(), fontMetrics.lineSpacing());2422 width + fontMetrics.height(), fontMetrics.lineSpacing()); 2423 2423 if (!fill) 2424 2424 inflateStrokeRect(textRect); … … 2462 2462 2463 2463 std::unique_ptr<ImageBuffer> maskImage = c->createCompatibleBuffer(maskRect.size()); 2464 if (!maskImage) 2465 return; 2464 2466 2465 2467 GraphicsContext& maskImageContext = maskImage->context(); … … 2485 2487 2486 2488 GraphicsContextStateSaver stateSaver(*c); 2487 c->clipToImageBuffer( maskImage.get(), maskRect);2489 c->clipToImageBuffer(*maskImage, maskRect); 2488 2490 drawStyle.applyFillColor(c); 2489 2491 c->fillRect(maskRect); -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h
r190383 r191049 364 364 template<class T> IntRect calculateCompositingBufferRect(const T&, IntSize*); 365 365 std::unique_ptr<ImageBuffer> createCompositingBuffer(const IntRect&); 366 void compositeBuffer(ImageBuffer *, const IntRect&, CompositeOperator);366 void compositeBuffer(ImageBuffer&, const IntRect&, CompositeOperator); 367 367 368 368 void inflateStrokeRect(FloatRect&) const; 369 369 370 template<class T> void fullCanvasCompositedDrawImage(T *, ColorSpace, const FloatRect&, const FloatRect&, CompositeOperator);370 template<class T> void fullCanvasCompositedDrawImage(T&, ColorSpace, const FloatRect&, const FloatRect&, CompositeOperator); 371 371 372 372 void prepareGradientForDashboard(CanvasGradient& gradient) const; -
trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp
r190595 r191049 1420 1420 1421 1421 RefPtr<Image> imageForRender = image->cachedImage()->imageForRenderer(image->renderer()); 1422 if (!imageForRender) 1423 return; 1424 1422 1425 if (imageForRender->isSVGImage()) 1423 imageForRender = drawImageIntoBuffer( imageForRender.get(), image->width(), image->height(), 1);1426 imageForRender = drawImageIntoBuffer(*imageForRender, image->width(), image->height(), 1); 1424 1427 1425 1428 if (!imageForRender || !validateTexFunc("texSubImage2D", TexSubImage, SourceHTMLImageElement, target, level, GraphicsContext3D::NONE, imageForRender->width(), imageForRender->height(), 0, format, type, xoffset, yoffset)) -
trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp
r190595 r191049 624 624 625 625 RefPtr<Image> imageForRender = image->cachedImage()->imageForRenderer(image->renderer()); 626 if (!imageForRender) 627 return; 628 626 629 if (imageForRender->isSVGImage()) 627 imageForRender = drawImageIntoBuffer( imageForRender.get(), image->width(), image->height(), 1);630 imageForRender = drawImageIntoBuffer(*imageForRender, image->width(), image->height(), 1); 628 631 629 632 if (!imageForRender || !validateTexFunc("texSubImage2D", TexSubImage, SourceHTMLImageElement, target, level, format, imageForRender->width(), imageForRender->height(), 0, format, type, xoffset, yoffset)) -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
r190613 r191049 3165 3165 } 3166 3166 3167 PassRefPtr<Image> WebGLRenderingContextBase::drawImageIntoBuffer(Image *image, int width, int height, int deviceScaleFactor)3167 PassRefPtr<Image> WebGLRenderingContextBase::drawImageIntoBuffer(Image& image, int width, int height, int deviceScaleFactor) 3168 3168 { 3169 3169 IntSize size(width, height); … … 3175 3175 } 3176 3176 3177 FloatRect srcRect(FloatPoint(), image ->size());3177 FloatRect srcRect(FloatPoint(), image.size()); 3178 3178 FloatRect destRect(FloatPoint(), size); 3179 3179 buf->context().drawImage(image, ColorSpaceDeviceRGB, destRect, srcRect); … … 3189 3189 3190 3190 RefPtr<Image> imageForRender = image->cachedImage()->imageForRenderer(image->renderer()); 3191 if (!imageForRender) 3192 return; 3193 3191 3194 if (imageForRender->isSVGImage()) 3192 imageForRender = drawImageIntoBuffer( imageForRender.get(), image->width(), image->height(), 1);3195 imageForRender = drawImageIntoBuffer(*imageForRender, image->width(), image->height(), 1); 3193 3196 3194 3197 if (!imageForRender || !validateTexFunc("texImage2D", TexImage, SourceHTMLImageElement, target, level, internalformat, imageForRender->width(), imageForRender->height(), 0, format, type, 0, 0)) -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h
r190481 r191049 427 427 void addCompressedTextureFormat(GC3Denum); 428 428 429 PassRefPtr<Image> drawImageIntoBuffer(Image *, int width, int height, int deviceScaleFactor);429 PassRefPtr<Image> drawImageIntoBuffer(Image&, int width, int height, int deviceScaleFactor); 430 430 431 431 #if ENABLE(VIDEO) -
trunk/Source/WebCore/platform/ScrollView.cpp
r189270 r191049 1179 1179 { 1180 1180 static Image* panScrollIcon = Image::loadPlatformResource("panIcon").leakRef(); 1181 if (!panScrollIcon) 1182 return; 1181 1183 IntPoint iconGCPoint = m_panScrollIconPoint; 1182 1184 if (parent()) 1183 1185 iconGCPoint = parent()->windowToContents(iconGCPoint); 1184 context.drawImage( panScrollIcon, ColorSpaceDeviceRGB, iconGCPoint);1186 context.drawImage(*panScrollIcon, ColorSpaceDeviceRGB, iconGCPoint); 1185 1187 } 1186 1188 -
trunk/Source/WebCore/platform/graphics/CrossfadeGeneratedImage.cpp
r190910 r191049 33 33 namespace WebCore { 34 34 35 CrossfadeGeneratedImage::CrossfadeGeneratedImage(Image * fromImage, Image*toImage, float percentage, const FloatSize& crossfadeSize, const FloatSize& size)35 CrossfadeGeneratedImage::CrossfadeGeneratedImage(Image& fromImage, Image& toImage, float percentage, const FloatSize& crossfadeSize, const FloatSize& size) 36 36 : m_fromImage(fromImage) 37 37 , m_toImage(toImage) … … 42 42 } 43 43 44 static void drawCrossfadeSubimage(GraphicsContext& context, Image *image, CompositeOperator operation, float opacity, const FloatSize& targetSize)44 static void drawCrossfadeSubimage(GraphicsContext& context, Image& image, CompositeOperator operation, float opacity, const FloatSize& targetSize) 45 45 { 46 FloatSize imageSize = image ->size();46 FloatSize imageSize = image.size(); 47 47 48 48 // SVGImage resets the opacity when painting, so we have to use transparency layers to accurately paint one at a given opacity. 49 bool useTransparencyLayer = image ->isSVGImage();49 bool useTransparencyLayer = image.isSVGImage(); 50 50 51 51 GraphicsContextStateSaver stateSaver(context); … … 69 69 { 70 70 // Draw nothing if either of the images hasn't loaded yet. 71 if (m_fromImage == Image::nullImage() || m_toImage== Image::nullImage())71 if (m_fromImage.ptr() == Image::nullImage() || m_toImage.ptr() == Image::nullImage()) 72 72 return; 73 73 … … 77 77 context.beginTransparencyLayer(1); 78 78 79 drawCrossfadeSubimage(context, m_fromImage , CompositeSourceOver, 1 - m_percentage, m_crossfadeSize);80 drawCrossfadeSubimage(context, m_toImage , CompositePlusLighter, m_percentage, m_crossfadeSize);79 drawCrossfadeSubimage(context, m_fromImage.get(), CompositeSourceOver, 1 - m_percentage, m_crossfadeSize); 80 drawCrossfadeSubimage(context, m_toImage.get(), CompositePlusLighter, m_percentage, m_crossfadeSize); 81 81 82 82 context.endTransparencyLayer(); -
trunk/Source/WebCore/platform/graphics/CrossfadeGeneratedImage.h
r190910 r191049 37 37 class CrossfadeGeneratedImage final : public GeneratedImage { 38 38 public: 39 static Ref<CrossfadeGeneratedImage> create(Image * fromImage, Image*toImage, float percentage, const FloatSize& crossfadeSize, const FloatSize& size)39 static Ref<CrossfadeGeneratedImage> create(Image& fromImage, Image& toImage, float percentage, const FloatSize& crossfadeSize, const FloatSize& size) 40 40 { 41 41 return adoptRef(*new CrossfadeGeneratedImage(fromImage, toImage, percentage, crossfadeSize, size)); … … 53 53 virtual void drawPattern(GraphicsContext&, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& dstRect, BlendMode) override; 54 54 55 CrossfadeGeneratedImage(Image * fromImage, Image*toImage, float percentage, const FloatSize& crossfadeSize, const FloatSize&);55 CrossfadeGeneratedImage(Image& fromImage, Image& toImage, float percentage, const FloatSize& crossfadeSize, const FloatSize&); 56 56 57 57 private: 58 58 void drawCrossfade(GraphicsContext&); 59 59 60 Image*m_fromImage;61 Image*m_toImage;60 Ref<Image> m_fromImage; 61 Ref<Image> m_toImage; 62 62 63 63 float m_percentage; -
trunk/Source/WebCore/platform/graphics/GradientImage.cpp
r191048 r191049 74 74 unsigned generatorHash = m_gradient->hash(); 75 75 76 if (!m_cachedImageBuffer || m_cachedGeneratorHash != generatorHash || m_cachedAdjustedSize != adjustedSize || !destContext.isCompatibleWithBuffer( m_cachedImageBuffer.get())) {76 if (!m_cachedImageBuffer || m_cachedGeneratorHash != generatorHash || m_cachedAdjustedSize != adjustedSize || !destContext.isCompatibleWithBuffer(*m_cachedImageBuffer)) { 77 77 m_cachedImageBuffer = destContext.createCompatibleBuffer(adjustedSize, m_gradient->hasAlpha()); 78 78 if (!m_cachedImageBuffer) -
trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp
r190910 r191049 369 369 } 370 370 371 void GraphicsContext::drawImage(Image* image, ColorSpace colorSpace, const FloatPoint& destination, const ImagePaintingOptions& imagePaintingOptions) 372 { 373 if (!image) 374 return; 375 drawImage(image, colorSpace, FloatRect(destination, image->size()), FloatRect(FloatPoint(), image->size()), imagePaintingOptions); 376 } 377 378 void GraphicsContext::drawImage(Image* image, ColorSpace colorSpace, const FloatRect& destination, const ImagePaintingOptions& imagePaintingOptions) 379 { 380 if (!image) 381 return; 382 371 void GraphicsContext::drawImage(Image& image, ColorSpace colorSpace, const FloatPoint& destination, const ImagePaintingOptions& imagePaintingOptions) 372 { 373 drawImage(image, colorSpace, FloatRect(destination, image.size()), FloatRect(FloatPoint(), image.size()), imagePaintingOptions); 374 } 375 376 void GraphicsContext::drawImage(Image& image, ColorSpace colorSpace, const FloatRect& destination, const ImagePaintingOptions& imagePaintingOptions) 377 { 383 378 #if PLATFORM(IOS) 384 FloatRect srcRect(FloatPoint(), image ->originalSize());379 FloatRect srcRect(FloatPoint(), image.originalSize()); 385 380 #else 386 FloatRect srcRect(FloatPoint(), image ->size());381 FloatRect srcRect(FloatPoint(), image.size()); 387 382 #endif 388 383 … … 390 385 } 391 386 392 void GraphicsContext::drawImage(Image *image, ColorSpace colorSpace, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& imagePaintingOptions)393 { 394 if (paintingDisabled() || !image)387 void GraphicsContext::drawImage(Image& image, ColorSpace colorSpace, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& imagePaintingOptions) 388 { 389 if (paintingDisabled()) 395 390 return; 396 391 397 392 // FIXME (49002): Should be InterpolationLow 398 393 InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_useLowQualityScale ? InterpolationNone : imageInterpolationQuality()); 399 image ->draw(*this, destination, source, colorSpace, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode, imagePaintingOptions.m_orientationDescription);400 } 401 402 void GraphicsContext::drawTiledImage(Image *image, ColorSpace colorSpace, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions& imagePaintingOptions)403 { 404 if (paintingDisabled() || !image)394 image.draw(*this, destination, source, colorSpace, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode, imagePaintingOptions.m_orientationDescription); 395 } 396 397 void GraphicsContext::drawTiledImage(Image& image, ColorSpace colorSpace, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions& imagePaintingOptions) 398 { 399 if (paintingDisabled()) 405 400 return; 406 401 407 402 InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_useLowQualityScale ? InterpolationLow : imageInterpolationQuality()); 408 image ->drawTiled(*this, destination, source, tileSize, spacing, colorSpace, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode);409 } 410 411 void GraphicsContext::drawTiledImage(Image *image, ColorSpace colorSpace, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor,403 image.drawTiled(*this, destination, source, tileSize, spacing, colorSpace, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode); 404 } 405 406 void GraphicsContext::drawTiledImage(Image& image, ColorSpace colorSpace, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor, 412 407 Image::TileRule hRule, Image::TileRule vRule, const ImagePaintingOptions& imagePaintingOptions) 413 408 { 414 if (paintingDisabled() || !image)409 if (paintingDisabled()) 415 410 return; 416 411 … … 422 417 423 418 InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_useLowQualityScale ? InterpolationLow : imageInterpolationQuality()); 424 image->drawTiled(*this, destination, source, tileScaleFactor, hRule, vRule, colorSpace, imagePaintingOptions.m_compositeOperator); 425 } 426 427 void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace colorSpace, const FloatPoint& destination, const ImagePaintingOptions& imagePaintingOptions) 428 { 429 if (!image) 430 return; 431 drawImageBuffer(image, colorSpace, FloatRect(destination, image->logicalSize()), FloatRect(FloatPoint(), image->logicalSize()), imagePaintingOptions); 432 } 433 434 void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace colorSpace, const FloatRect& destination, const ImagePaintingOptions& imagePaintingOptions) 435 { 436 if (!image) 437 return; 438 drawImageBuffer(image, colorSpace, destination, FloatRect(FloatPoint(), FloatSize(image->logicalSize())), imagePaintingOptions); 439 } 440 441 void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace colorSpace, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& imagePaintingOptions) 442 { 443 if (paintingDisabled() || !image) 419 image.drawTiled(*this, destination, source, tileScaleFactor, hRule, vRule, colorSpace, imagePaintingOptions.m_compositeOperator); 420 } 421 422 void GraphicsContext::drawImageBuffer(ImageBuffer& image, ColorSpace colorSpace, const FloatPoint& destination, const ImagePaintingOptions& imagePaintingOptions) 423 { 424 drawImageBuffer(image, colorSpace, FloatRect(destination, image.logicalSize()), FloatRect(FloatPoint(), image.logicalSize()), imagePaintingOptions); 425 } 426 427 void GraphicsContext::drawImageBuffer(ImageBuffer& image, ColorSpace colorSpace, const FloatRect& destination, const ImagePaintingOptions& imagePaintingOptions) 428 { 429 drawImageBuffer(image, colorSpace, destination, FloatRect(FloatPoint(), FloatSize(image.logicalSize())), imagePaintingOptions); 430 } 431 432 void GraphicsContext::drawImageBuffer(ImageBuffer& image, ColorSpace colorSpace, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& imagePaintingOptions) 433 { 434 if (paintingDisabled()) 444 435 return; 445 436 446 437 // FIXME (49002): Should be InterpolationLow 447 438 InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_useLowQualityScale ? InterpolationNone : imageInterpolationQuality()); 448 image ->draw(*this, colorSpace, destination, source, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode, imagePaintingOptions.m_useLowQualityScale);439 image.draw(*this, colorSpace, destination, source, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode, imagePaintingOptions.m_useLowQualityScale); 449 440 } 450 441 … … 479 470 } 480 471 481 void GraphicsContext::clipToImageBuffer(ImageBuffer *buffer, const FloatRect& rect)482 { 483 if (paintingDisabled()) 484 return; 485 buffer ->clip(*this, rect);472 void GraphicsContext::clipToImageBuffer(ImageBuffer& buffer, const FloatRect& rect) 473 { 474 if (paintingDisabled()) 475 return; 476 buffer.clip(*this, rect); 486 477 } 487 478 … … 649 640 } 650 641 651 bool GraphicsContext::isCompatibleWithBuffer(ImageBuffer *buffer) const652 { 653 GraphicsContext& bufferContext = buffer ->context();642 bool GraphicsContext::isCompatibleWithBuffer(ImageBuffer& buffer) const 643 { 644 GraphicsContext& bufferContext = buffer.context(); 654 645 655 646 return scalesMatch(getCTM(), bufferContext.getCTM()) && isAcceleratedContext() == bufferContext.isAcceleratedContext(); -
trunk/Source/WebCore/platform/graphics/GraphicsContext.h
r191000 r191049 309 309 WEBCORE_EXPORT void strokeRect(const FloatRect&, float lineWidth); 310 310 311 WEBCORE_EXPORT void drawImage(Image *, ColorSpace, const FloatPoint& destination, const ImagePaintingOptions& = ImagePaintingOptions());312 WEBCORE_EXPORT void drawImage(Image *, ColorSpace, const FloatRect& destination, const ImagePaintingOptions& = ImagePaintingOptions());313 void drawImage(Image *, ColorSpace, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& = ImagePaintingOptions());314 315 void drawTiledImage(Image *, ColorSpace, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions& = ImagePaintingOptions());316 void drawTiledImage(Image *, ColorSpace, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor,311 WEBCORE_EXPORT void drawImage(Image&, ColorSpace, const FloatPoint& destination, const ImagePaintingOptions& = ImagePaintingOptions()); 312 WEBCORE_EXPORT void drawImage(Image&, ColorSpace, const FloatRect& destination, const ImagePaintingOptions& = ImagePaintingOptions()); 313 void drawImage(Image&, ColorSpace, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& = ImagePaintingOptions()); 314 315 void drawTiledImage(Image&, ColorSpace, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions& = ImagePaintingOptions()); 316 void drawTiledImage(Image&, ColorSpace, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor, 317 317 Image::TileRule, Image::TileRule, const ImagePaintingOptions& = ImagePaintingOptions()); 318 318 319 WEBCORE_EXPORT void drawImageBuffer(ImageBuffer *, ColorSpace, const FloatPoint& destination, const ImagePaintingOptions& = ImagePaintingOptions());320 void drawImageBuffer(ImageBuffer *, ColorSpace, const FloatRect& destination, const ImagePaintingOptions& = ImagePaintingOptions());321 void drawImageBuffer(ImageBuffer *, ColorSpace, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& = ImagePaintingOptions());319 WEBCORE_EXPORT void drawImageBuffer(ImageBuffer&, ColorSpace, const FloatPoint& destination, const ImagePaintingOptions& = ImagePaintingOptions()); 320 void drawImageBuffer(ImageBuffer&, ColorSpace, const FloatRect& destination, const ImagePaintingOptions& = ImagePaintingOptions()); 321 void drawImageBuffer(ImageBuffer&, ColorSpace, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& = ImagePaintingOptions()); 322 322 323 323 void drawPattern(Image&, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, ColorSpace, CompositeOperator, const FloatRect& destRect, BlendMode = BlendModeNormal); … … 334 334 void clipPath(const Path&, WindRule); 335 335 void clipConvexPolygon(size_t numPoints, const FloatPoint*, bool antialias = true); 336 void clipToImageBuffer(ImageBuffer *, const FloatRect&);336 void clipToImageBuffer(ImageBuffer&, const FloatRect&); 337 337 338 338 IntRect clipBounds() const; … … 444 444 // for drawing into the buffer and then into this context. 445 445 std::unique_ptr<ImageBuffer> createCompatibleBuffer(const FloatSize&, bool hasAlpha = true) const; 446 bool isCompatibleWithBuffer(ImageBuffer *) const;446 bool isCompatibleWithBuffer(ImageBuffer&) const; 447 447 448 448 // This function applies the device scale factor to the context, making the context capable of -
trunk/Source/WebCore/platform/graphics/ShadowBlur.cpp
r190124 r191049 473 473 graphicsContext.clip(FloatRect(m_layerOrigin, m_layerSize)); 474 474 } 475 graphicsContext.clipToImageBuffer( m_layerImage, FloatRect(m_layerOrigin, bufferSize));475 graphicsContext.clipToImageBuffer(*m_layerImage, FloatRect(m_layerOrigin, bufferSize)); 476 476 graphicsContext.setFillColor(m_color, m_colorSpace); 477 477 … … 594 594 595 595 drawShadowBuffer(graphicsContext); 596 m_layerImage = 0;596 m_layerImage = nullptr; 597 597 ScratchBuffer::singleton().scheduleScratchBufferPurge(); 598 598 } … … 635 635 636 636 drawShadowBuffer(graphicsContext); 637 m_layerImage = 0;637 m_layerImage = nullptr; 638 638 ScratchBuffer::singleton().scheduleScratchBufferPurge(); 639 639 } … … 732 732 drawLayerPieces(graphicsContext, destHoleBounds, holeRect.radii(), edgeSize, templateSize, InnerShadow); 733 733 734 m_layerImage = 0;734 m_layerImage = nullptr; 735 735 ScratchBuffer::singleton().scheduleScratchBufferPurge(); 736 736 } … … 778 778 drawLayerPieces(graphicsContext, shadowBounds, shadowedRect.radii(), edgeSize, templateSize, OuterShadow); 779 779 780 m_layerImage = 0;780 m_layerImage = nullptr; 781 781 ScratchBuffer::singleton().scheduleScratchBufferPurge(); 782 782 } … … 817 817 FloatRect tileRect = FloatRect(leftSlice, 0, templateSideLength, topSlice); 818 818 FloatRect destRect = FloatRect(centerRect.x(), centerRect.y() - topSlice, centerRect.width(), topSlice); 819 graphicsContext.drawImageBuffer( m_layerImage, ColorSpaceDeviceRGB, destRect, tileRect);819 graphicsContext.drawImageBuffer(*m_layerImage, ColorSpaceDeviceRGB, destRect, tileRect); 820 820 821 821 // Draw the bottom side. … … 824 824 destRect.setY(centerRect.maxY()); 825 825 destRect.setHeight(bottomSlice); 826 graphicsContext.drawImageBuffer( m_layerImage, ColorSpaceDeviceRGB, destRect, tileRect);826 graphicsContext.drawImageBuffer(*m_layerImage, ColorSpaceDeviceRGB, destRect, tileRect); 827 827 828 828 // Left side. 829 829 tileRect = FloatRect(0, topSlice, leftSlice, templateSideLength); 830 830 destRect = FloatRect(centerRect.x() - leftSlice, centerRect.y(), leftSlice, centerRect.height()); 831 graphicsContext.drawImageBuffer( m_layerImage, ColorSpaceDeviceRGB, destRect, tileRect);831 graphicsContext.drawImageBuffer(*m_layerImage, ColorSpaceDeviceRGB, destRect, tileRect); 832 832 833 833 // Right side. … … 836 836 destRect.setX(centerRect.maxX()); 837 837 destRect.setWidth(rightSlice); 838 graphicsContext.drawImageBuffer( m_layerImage, ColorSpaceDeviceRGB, destRect, tileRect);838 graphicsContext.drawImageBuffer(*m_layerImage, ColorSpaceDeviceRGB, destRect, tileRect); 839 839 840 840 // Top left corner. 841 841 tileRect = FloatRect(0, 0, leftSlice, topSlice); 842 842 destRect = FloatRect(centerRect.x() - leftSlice, centerRect.y() - topSlice, leftSlice, topSlice); 843 graphicsContext.drawImageBuffer( m_layerImage, ColorSpaceDeviceRGB, destRect, tileRect);843 graphicsContext.drawImageBuffer(*m_layerImage, ColorSpaceDeviceRGB, destRect, tileRect); 844 844 845 845 // Top right corner. 846 846 tileRect = FloatRect(templateSize.width() - rightSlice, 0, rightSlice, topSlice); 847 847 destRect = FloatRect(centerRect.maxX(), centerRect.y() - topSlice, rightSlice, topSlice); 848 graphicsContext.drawImageBuffer( m_layerImage, ColorSpaceDeviceRGB, destRect, tileRect);848 graphicsContext.drawImageBuffer(*m_layerImage, ColorSpaceDeviceRGB, destRect, tileRect); 849 849 850 850 // Bottom right corner. 851 851 tileRect = FloatRect(templateSize.width() - rightSlice, templateSize.height() - bottomSlice, rightSlice, bottomSlice); 852 852 destRect = FloatRect(centerRect.maxX(), centerRect.maxY(), rightSlice, bottomSlice); 853 graphicsContext.drawImageBuffer( m_layerImage, ColorSpaceDeviceRGB, destRect, tileRect);853 graphicsContext.drawImageBuffer(*m_layerImage, ColorSpaceDeviceRGB, destRect, tileRect); 854 854 855 855 // Bottom left corner. 856 856 tileRect = FloatRect(0, templateSize.height() - bottomSlice, leftSlice, bottomSlice); 857 857 destRect = FloatRect(centerRect.x() - leftSlice, centerRect.maxY(), leftSlice, bottomSlice); 858 graphicsContext.drawImageBuffer( m_layerImage, ColorSpaceDeviceRGB, destRect, tileRect);858 graphicsContext.drawImageBuffer(*m_layerImage, ColorSpaceDeviceRGB, destRect, tileRect); 859 859 } 860 860 … … 916 916 917 917 context.clearShadow(); 918 context.drawImageBuffer( m_layerImage, ColorSpaceDeviceRGB, FloatRect(roundedIntPoint(m_layerOrigin), m_layerSize), FloatRect(FloatPoint(), m_layerSize), context.compositeOperation());919 920 m_layerImage = 0;918 context.drawImageBuffer(*m_layerImage, ColorSpaceDeviceRGB, FloatRect(roundedIntPoint(m_layerOrigin), m_layerSize), FloatRect(FloatPoint(), m_layerSize), context.compositeOperation()); 919 920 m_layerImage = nullptr; 921 921 ScratchBuffer::singleton().scheduleScratchBufferPurge(); 922 922 } -
trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
r190914 r191049 171 171 BackingStoreCopy copyMode = &destinationContext == &context() ? CopyBackingStore : DontCopyBackingStore; 172 172 RefPtr<Image> image = copyImage(copyMode); 173 destinationContext.drawImage( image.get(), styleColorSpace, destRect, srcRect, ImagePaintingOptions(op, blendMode, ImageOrientationDescription(), useLowQualityScale));173 destinationContext.drawImage(*image, styleColorSpace, destRect, srcRect, ImagePaintingOptions(op, blendMode, ImageOrientationDescription(), useLowQualityScale)); 174 174 } 175 175 -
trunk/Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp
r189144 r191049 191 191 192 192 if (m_cachedImageBuffer) 193 context.drawImageBuffer( m_cachedImageBuffer.get(), ColorSpaceDeviceRGB, dstRect);193 context.drawImageBuffer(*m_cachedImageBuffer, ColorSpaceDeviceRGB, dstRect); 194 194 else { 195 195 transformContextForPainting(context, dstRect, srcRect); -
trunk/Source/WebCore/platform/graphics/filters/FEBlend.cpp
r189144 r191049 73 73 ImageBuffer* imageBuffer = in->asImageBuffer(); 74 74 ImageBuffer* imageBuffer2 = in2->asImageBuffer(); 75 ASSERT(imageBuffer);76 ASSERT(imageBuffer2);75 if (!imageBuffer || !imageBuffer2) 76 return; 77 77 78 filterContext.drawImageBuffer( imageBuffer2, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in2->absolutePaintRect()));79 filterContext.drawImageBuffer( imageBuffer, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in->absolutePaintRect()), IntRect(IntPoint(), imageBuffer->logicalSize()), ImagePaintingOptions(CompositeSourceOver, m_mode));78 filterContext.drawImageBuffer(*imageBuffer2, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in2->absolutePaintRect())); 79 filterContext.drawImageBuffer(*imageBuffer, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in->absolutePaintRect()), IntRect(IntPoint(), imageBuffer->logicalSize()), ImagePaintingOptions(CompositeSourceOver, m_mode)); 80 80 } 81 81 #endif -
trunk/Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp
r189144 r191049 148 148 return; 149 149 150 resultImage->context().drawImageBuffer(in->asImageBuffer(), ColorSpaceDeviceRGB, drawingRegionOfInputImage(in->absolutePaintRect())); 150 ImageBuffer* inBuffer = in->asImageBuffer(); 151 if (inBuffer) 152 resultImage->context().drawImageBuffer(*inBuffer, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in->absolutePaintRect())); 151 153 152 154 IntRect imageRect(IntPoint(), resultImage->logicalSize()); -
trunk/Source/WebCore/platform/graphics/filters/FEComposite.cpp
r189144 r191049 277 277 ImageBuffer* imageBuffer = in->asImageBuffer(); 278 278 ImageBuffer* imageBuffer2 = in2->asImageBuffer(); 279 ASSERT(imageBuffer);280 ASSERT(imageBuffer2);279 if (!imageBuffer || !imageBuffer2) 280 return; 281 281 282 282 switch (m_type) { 283 283 case FECOMPOSITE_OPERATOR_OVER: 284 filterContext.drawImageBuffer( imageBuffer2, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in2->absolutePaintRect()));285 filterContext.drawImageBuffer( imageBuffer, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in->absolutePaintRect()));284 filterContext.drawImageBuffer(*imageBuffer2, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in2->absolutePaintRect())); 285 filterContext.drawImageBuffer(*imageBuffer, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in->absolutePaintRect())); 286 286 break; 287 287 case FECOMPOSITE_OPERATOR_IN: { … … 295 295 IntRect sourceRect = destinationRect - in->absolutePaintRect().location(); 296 296 IntRect source2Rect = destinationRect - in2->absolutePaintRect().location(); 297 filterContext.drawImageBuffer( imageBuffer2, ColorSpaceDeviceRGB, adjustedDestinationRect, source2Rect);298 filterContext.drawImageBuffer( imageBuffer, ColorSpaceDeviceRGB, adjustedDestinationRect, sourceRect, CompositeSourceIn);297 filterContext.drawImageBuffer(*imageBuffer2, ColorSpaceDeviceRGB, adjustedDestinationRect, source2Rect); 298 filterContext.drawImageBuffer(*imageBuffer, ColorSpaceDeviceRGB, adjustedDestinationRect, sourceRect, CompositeSourceIn); 299 299 break; 300 300 } 301 301 case FECOMPOSITE_OPERATOR_OUT: 302 filterContext.drawImageBuffer( imageBuffer, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in->absolutePaintRect()));303 filterContext.drawImageBuffer( imageBuffer2, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in2->absolutePaintRect()), IntRect(IntPoint(), imageBuffer2->logicalSize()), CompositeDestinationOut);302 filterContext.drawImageBuffer(*imageBuffer, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in->absolutePaintRect())); 303 filterContext.drawImageBuffer(*imageBuffer2, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in2->absolutePaintRect()), IntRect(IntPoint(), imageBuffer2->logicalSize()), CompositeDestinationOut); 304 304 break; 305 305 case FECOMPOSITE_OPERATOR_ATOP: 306 filterContext.drawImageBuffer( imageBuffer2, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in2->absolutePaintRect()));307 filterContext.drawImageBuffer( imageBuffer, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in->absolutePaintRect()), IntRect(IntPoint(), imageBuffer->logicalSize()), CompositeSourceAtop);306 filterContext.drawImageBuffer(*imageBuffer2, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in2->absolutePaintRect())); 307 filterContext.drawImageBuffer(*imageBuffer, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in->absolutePaintRect()), IntRect(IntPoint(), imageBuffer->logicalSize()), CompositeSourceAtop); 308 308 break; 309 309 case FECOMPOSITE_OPERATOR_XOR: 310 filterContext.drawImageBuffer( imageBuffer2, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in2->absolutePaintRect()));311 filterContext.drawImageBuffer( imageBuffer, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in->absolutePaintRect()), IntRect(IntPoint(), imageBuffer->logicalSize()), CompositeXOR);310 filterContext.drawImageBuffer(*imageBuffer2, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in2->absolutePaintRect())); 311 filterContext.drawImageBuffer(*imageBuffer, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in->absolutePaintRect()), IntRect(IntPoint(), imageBuffer->logicalSize()), CompositeXOR); 312 312 break; 313 313 default: -
trunk/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp
r189144 r191049 89 89 90 90 ImageBuffer* sourceImage = in->asImageBuffer(); 91 ASSERT(sourceImage); 91 if (!sourceImage) 92 return; 93 92 94 GraphicsContext& resultContext = resultImage->context(); 93 95 resultContext.setAlpha(m_shadowOpacity); 94 resultContext.drawImageBuffer( sourceImage, ColorSpaceDeviceRGB, drawingRegionWithOffset);96 resultContext.drawImageBuffer(*sourceImage, ColorSpaceDeviceRGB, drawingRegionWithOffset); 95 97 resultContext.setAlpha(1); 96 98 … … 109 111 resultContext.setCompositeOperation(CompositeDestinationOver); 110 112 111 resultImage->context().drawImageBuffer( sourceImage, ColorSpaceDeviceRGB, drawingRegion);113 resultImage->context().drawImageBuffer(*sourceImage, ColorSpaceDeviceRGB, drawingRegion); 112 114 } 113 115 -
trunk/Source/WebCore/platform/graphics/filters/FEMerge.cpp
r189144 r191049 48 48 return; 49 49 50 50 51 GraphicsContext& filterContext = resultImage->context(); 51 52 for (unsigned i = 0; i < size; ++i) { 52 53 FilterEffect* in = inputEffect(i); 53 filterContext.drawImageBuffer(in->asImageBuffer(), ColorSpaceDeviceRGB, drawingRegionOfInputImage(in->absolutePaintRect())); 54 if (ImageBuffer* inBuffer = in->asImageBuffer()) 55 filterContext.drawImageBuffer(*inBuffer, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in->absolutePaintRect())); 54 56 } 55 57 } -
trunk/Source/WebCore/platform/graphics/filters/FEOffset.cpp
r189144 r191049 80 80 81 81 ImageBuffer* resultImage = createImageBufferResult(); 82 if (!resultImage) 82 ImageBuffer* inBuffer = in->asImageBuffer(); 83 if (!resultImage || !inBuffer) 83 84 return; 84 85 … … 88 89 Filter& filter = this->filter(); 89 90 drawingRegion.move(filter.applyHorizontalScale(m_dx), filter.applyVerticalScale(m_dy)); 90 resultImage->context().drawImageBuffer( in->asImageBuffer(), ColorSpaceDeviceRGB, drawingRegion);91 resultImage->context().drawImageBuffer(*inBuffer, ColorSpaceDeviceRGB, drawingRegion); 91 92 } 92 93 -
trunk/Source/WebCore/platform/graphics/filters/FETile.cpp
r189144 r191049 48 48 49 49 ImageBuffer* resultImage = createImageBufferResult(); 50 if (!resultImage) 50 ImageBuffer* inBuffer = in->asImageBuffer(); 51 if (!resultImage || !inBuffer) 51 52 return; 52 53 … … 70 71 GraphicsContext& tileImageContext = tileImage->context(); 71 72 tileImageContext.translate(-inMaxEffectLocation.x(), -inMaxEffectLocation.y()); 72 tileImageContext.drawImageBuffer( in->asImageBuffer(), ColorSpaceDeviceRGB, in->absolutePaintRect().location());73 tileImageContext.drawImageBuffer(*inBuffer, ColorSpaceDeviceRGB, in->absolutePaintRect().location()); 73 74 74 75 auto tileImageCopy = tileImage->copyImage(CopyBackingStore); -
trunk/Source/WebCore/platform/graphics/filters/SourceAlpha.cpp
r189144 r191049 55 55 56 56 ImageBuffer* imageBuffer = inputEffect(0)->asImageBuffer(); 57 ASSERT(imageBuffer); 57 if (!imageBuffer) 58 return; 58 59 59 60 FloatRect imageRect(FloatPoint(), absolutePaintRect().size()); 60 61 filterContext.fillRect(imageRect, Color::black, ColorSpaceDeviceRGB); 61 filterContext.drawImageBuffer( imageBuffer, ColorSpaceDeviceRGB, IntPoint(), CompositeDestinationIn);62 filterContext.drawImageBuffer(*imageBuffer, ColorSpaceDeviceRGB, IntPoint(), CompositeDestinationIn); 62 63 } 63 64 -
trunk/Source/WebCore/platform/graphics/filters/SourceGraphic.cpp
r189144 r191049 50 50 void SourceGraphic::platformApplySoftware() 51 51 { 52 Filter& filter = this->filter(); 53 52 54 ImageBuffer* resultImage = createImageBufferResult(); 53 Filter& filter = this->filter();54 if (!resultImage || ! filter.sourceImage())55 ImageBuffer* sourceImage = filter.sourceImage(); 56 if (!resultImage || !sourceImage) 55 57 return; 56 58 57 resultImage->context().drawImageBuffer( filter.sourceImage(), ColorSpaceDeviceRGB, IntPoint());59 resultImage->context().drawImageBuffer(*sourceImage, ColorSpaceDeviceRGB, IntPoint()); 58 60 } 59 61 -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp
r190852 r191049 526 526 return; 527 527 528 context.drawImage(reinterpret_cast<Image*>(gstImage->image().get()), ColorSpaceSRGB,529 rect, gstImage->rect(), CompositeCopy);528 if (Image* image = reinterpret_cast<Image*>(gstImage->image().get())) 529 context.drawImage(*image, ColorSpaceSRGB, rect, gstImage->rect(), CompositeCopy); 530 530 } 531 531 -
trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp
r190095 r191049 36 36 class ImageBackingSurfaceClient : public CoordinatedSurface::Client { 37 37 public: 38 ImageBackingSurfaceClient(Image *image, const IntRect& rect)38 ImageBackingSurfaceClient(Image& image, const IntRect& rect) 39 39 : m_image(image) 40 40 , m_rect(rect) … … 48 48 49 49 private: 50 Image *m_image;50 Image& m_image; 51 51 IntRect m_rect; 52 52 }; … … 129 129 IntRect rect(IntPoint::zero(), IntSize(m_image->size())); 130 130 131 ImageBackingSurfaceClient surfaceClient( m_image.get(), rect);131 ImageBackingSurfaceClient surfaceClient(*m_image, rect); 132 132 m_surface->paintToSurface(rect, &surfaceClient); 133 133 -
trunk/Source/WebCore/platform/mac/ThemeMac.mm
r190623 r191049 687 687 NSRect imageBufferDrawRect = NSRect(FloatRect(buttonFocusRectOutlineWidth, buttonFocusRectOutlineWidth, rect.width(), rect.height())); 688 688 auto imageBuffer = ImageBuffer::createCompatibleBuffer(rect.size() + 2 * FloatSize(buttonFocusRectOutlineWidth, buttonFocusRectOutlineWidth), deviceScaleFactor, ColorSpaceSRGB, context, false); 689 if (!imageBuffer) 690 return needsRepaint; 689 691 { 690 692 LocalCurrentGraphicsContext localContext(imageBuffer->context()); 691 693 needsRepaint = drawCellOrFocusRingIntoRectWithView(cell, imageBufferDrawRect, view, drawButtonCell, drawFocusRing); 692 694 } 693 context.drawImageBuffer( imageBuffer.get(), ColorSpaceSRGB, rect.location() - FloatSize(buttonFocusRectOutlineWidth, buttonFocusRectOutlineWidth));695 context.drawImageBuffer(*imageBuffer, ColorSpaceSRGB, rect.location() - FloatSize(buttonFocusRectOutlineWidth, buttonFocusRectOutlineWidth)); 694 696 return needsRepaint; 695 697 } -
trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp
r190124 r191049 430 430 destRect.move(m_paintOffset.x(), m_paintOffset.y()); 431 431 432 destinationContext.drawImageBuffer(filter->output(), m_renderLayer->renderer().style().colorSpace(), 433 snapRectToDevicePixels(destRect, m_renderLayer->renderer().document().deviceScaleFactor())); 432 if (ImageBuffer* outputBuffer = filter->output()) { 433 destinationContext.drawImageBuffer(*outputBuffer, m_renderLayer->renderer().style().colorSpace(), 434 snapRectToDevicePixels(destRect, m_renderLayer->renderer().document().deviceScaleFactor())); 435 } 434 436 435 437 filter->clearIntermediateResults(); -
trunk/Source/WebCore/rendering/ImageQualityController.cpp
r189144 r191049 100 100 } 101 101 102 bool ImageQualityController::shouldPaintAtLowQuality(GraphicsContext& context, RenderBoxModelObject* object, Image *image, const void *layer, const LayoutSize& size)102 bool ImageQualityController::shouldPaintAtLowQuality(GraphicsContext& context, RenderBoxModelObject* object, Image& image, const void *layer, const LayoutSize& size) 103 103 { 104 104 // If the image is not a bitmap image, then none of this is relevant and we just paint at high 105 105 // quality. 106 if (! image || !(image->isBitmapImage() || image->isPDFDocumentImage()) || context.paintingDisabled())106 if (!(image.isBitmapImage() || image.isPDFDocumentImage()) || context.paintingDisabled()) 107 107 return false; 108 108 … … 119 119 // Make sure to use the unzoomed image size, since if a full page zoom is in effect, the image 120 120 // is actually being scaled. 121 IntSize imageSize(image ->width(), image->height());121 IntSize imageSize(image.width(), image.height()); 122 122 123 123 // Look ourselves up in the hashtables. … … 157 157 // There is no need to hash scaled images that always use low quality mode when the page demands it. This is the iChat case. 158 158 if (m_renderView.frame().page()->inLowQualityImageInterpolationMode()) { 159 double totalPixels = static_cast<double>(image ->width()) * static_cast<double>(image->height());159 double totalPixels = static_cast<double>(image.width()) * static_cast<double>(image.height()); 160 160 if (totalPixels > cInterpolationCutoff) 161 161 return true; -
trunk/Source/WebCore/rendering/ImageQualityController.h
r189144 r191049 44 44 explicit ImageQualityController(const RenderView&); 45 45 46 bool shouldPaintAtLowQuality(GraphicsContext&, RenderBoxModelObject*, Image *, const void* layer, const LayoutSize&);46 bool shouldPaintAtLowQuality(GraphicsContext&, RenderBoxModelObject*, Image&, const void* layer, const LayoutSize&); 47 47 void rendererWillBeDestroyed(RenderBoxModelObject& renderer) { removeObject(&renderer); } 48 48 -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r190910 r191049 162 162 } 163 163 164 bool RenderBoxModelObject::shouldPaintAtLowQuality(GraphicsContext& context, Image *image, const void* layer, const LayoutSize& size)164 bool RenderBoxModelObject::shouldPaintAtLowQuality(GraphicsContext& context, Image& image, const void* layer, const LayoutSize& size) 165 165 { 166 166 return view().imageQualityController().shouldPaintAtLowQuality(context, this, image, layer, size); … … 831 831 BackgroundImageGeometry geometry = calculateBackgroundImageGeometry(paintInfo.paintContainer, *bgLayer, rect.location(), scrolledPaintRect, backgroundObject); 832 832 geometry.clip(LayoutRect(pixelSnappedRect)); 833 if (!geometry.destRect().isEmpty()) { 833 RefPtr<Image> image; 834 if (!geometry.destRect().isEmpty() && (image = bgImage->image(backgroundObject ? backgroundObject : this, geometry.tileSize()))) { 834 835 CompositeOperator compositeOp = op == CompositeSourceOver ? bgLayer->composite() : op; 835 auto clientForBackgroundImage = backgroundObject ? backgroundObject : this;836 RefPtr<Image> image = bgImage->image(clientForBackgroundImage, geometry.tileSize());837 836 context.setDrawLuminanceMask(bgLayer->maskSourceType() == MaskLuminance); 838 bool useLowQualityScaling = shouldPaintAtLowQuality(context, image.get(), bgLayer, geometry.tileSize());839 context.drawTiledImage( image.get(), style().colorSpace(), geometry.destRect(), toLayoutPoint(geometry.relativePhase()), geometry.tileSize(), geometry.spaceSize(), ImagePaintingOptions(compositeOp, bgLayer->blendMode(), ImageOrientationDescription(), useLowQualityScaling));840 } 841 } 842 843 if ( bgLayer->clip() == TextFillBox) {844 context.drawImageBuffer( maskImage.get(), ColorSpaceDeviceRGB, maskRect, CompositeDestinationIn);837 bool useLowQualityScaling = shouldPaintAtLowQuality(context, *image, bgLayer, geometry.tileSize()); 838 context.drawTiledImage(*image, style().colorSpace(), geometry.destRect(), toLayoutPoint(geometry.relativePhase()), geometry.tileSize(), geometry.spaceSize(), ImagePaintingOptions(compositeOp, bgLayer->blendMode(), ImageOrientationDescription(), useLowQualityScaling)); 839 } 840 } 841 842 if (maskImage && bgLayer->clip() == TextFillBox) { 843 context.drawImageBuffer(*maskImage, ColorSpaceDeviceRGB, maskRect, CompositeDestinationIn); 845 844 context.endTransparencyLayer(); 846 845 } -
trunk/Source/WebCore/rendering/RenderBoxModelObject.h
r190883 r191049 252 252 LayoutRect borderInnerRectAdjustedForBleedAvoidance(const GraphicsContext&, const LayoutRect&, BackgroundBleedAvoidance) const; 253 253 254 bool shouldPaintAtLowQuality(GraphicsContext&, Image *, const void*, const LayoutSize&);254 bool shouldPaintAtLowQuality(GraphicsContext&, Image&, const void*, const LayoutSize&); 255 255 256 256 RenderBoxModelObject* continuation() const; -
trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp
r189830 r191049 198 198 } 199 199 200 void RenderEmbeddedObject::paintSnapshotImage(PaintInfo& paintInfo, const LayoutPoint& paintOffset, Image *image)200 void RenderEmbeddedObject::paintSnapshotImage(PaintInfo& paintInfo, const LayoutPoint& paintOffset, Image& image) 201 201 { 202 202 LayoutUnit cWidth = contentWidth(); … … 215 215 return; 216 216 217 bool useLowQualityScaling = shouldPaintAtLowQuality(context, image, image, alignedRect.size());217 bool useLowQualityScaling = shouldPaintAtLowQuality(context, image, &image, alignedRect.size()); 218 218 ImageOrientationDescription orientationDescription(shouldRespectImageOrientation()); 219 219 #if ENABLE(CSS_IMAGE_ORIENTATION) … … 240 240 241 241 if (Image* snapshot = downcast<HTMLPlugInImageElement>(plugInElement).snapshotImage()) 242 paintSnapshotImage(paintInfo, paintOffset, snapshot);242 paintSnapshotImage(paintInfo, paintOffset, *snapshot); 243 243 } 244 244 -
trunk/Source/WebCore/rendering/RenderEmbeddedObject.h
r178510 r191049 74 74 virtual bool isEmbeddedObject() const override final { return true; } 75 75 76 void paintSnapshotImage(PaintInfo&, const LayoutPoint&, Image *);76 void paintSnapshotImage(PaintInfo&, const LayoutPoint&, Image&); 77 77 virtual void paintContents(PaintInfo&, const LayoutPoint&) override final; 78 78 -
trunk/Source/WebCore/rendering/RenderImage.cpp
r189144 r191049 425 425 orientationDescription.setImageOrientationEnum(style().imageOrientation()); 426 426 #endif 427 context.drawImage( image.get(), style().colorSpace(), snapRectToDevicePixels(LayoutRect(paintOffset + imageOffset, imageSize), deviceScaleFactor), orientationDescription);427 context.drawImage(*image, style().colorSpace(), snapRectToDevicePixels(LayoutRect(paintOffset + imageOffset, imageSize), deviceScaleFactor), orientationDescription); 428 428 errorPictureDrawn = true; 429 429 } … … 549 549 CompositeOperator compositeOperator = imageElement ? imageElement->compositeOperator() : CompositeSourceOver; 550 550 Image* image = imageResource().image().get(); 551 bool useLowQualityScaling = shouldPaintAtLowQuality(context,image, image, LayoutSize(rect.size()));551 bool useLowQualityScaling = image && shouldPaintAtLowQuality(context, *image, image, LayoutSize(rect.size())); 552 552 ImageOrientationDescription orientationDescription(shouldRespectImageOrientation()); 553 553 #if ENABLE(CSS_IMAGE_ORIENTATION) 554 554 orientationDescription.setImageOrientationEnum(style().imageOrientation()); 555 555 #endif 556 context.drawImage( imageResource().image(rect.width(), rect.height()).get(), style().colorSpace(), rect,556 context.drawImage(*img, style().colorSpace(), rect, 557 557 ImagePaintingOptions(compositeOperator, BlendModeNormal, orientationDescription, useLowQualityScaling)); 558 558 } -
trunk/Source/WebCore/rendering/RenderImageResourceStyleImage.cpp
r158163 r191049 58 58 ASSERT(m_renderer); 59 59 m_styleImage->removeClient(m_renderer); 60 m_cachedImage = 0;60 m_cachedImage = nullptr; 61 61 } 62 62 … … 65 65 // Generated content may trigger calls to image() while we're still pending, don't assert but gracefully exit. 66 66 if (m_styleImage->isPendingImage()) 67 return 0;67 return nullptr; 68 68 return m_styleImage->image(m_renderer, IntSize(width, height)); 69 69 } -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r191002 r191049 3656 3656 context.translate(resizerCornerRect.x() + cornerResizerSize.width(), resizerCornerRect.y() + resizerCornerRect.height() - cornerResizerSize.height()); 3657 3657 context.scale(FloatSize(-1.0, 1.0)); 3658 context.drawImage(resizeCornerImage.get(), renderer().style().colorSpace(), FloatRect(FloatPoint(), cornerResizerSize)); 3658 if (resizeCornerImage) 3659 context.drawImage(*resizeCornerImage, renderer().style().colorSpace(), FloatRect(FloatPoint(), cornerResizerSize)); 3659 3660 context.restore(); 3660 3661 return; 3661 3662 } 3663 3664 if (!resizeCornerImage) 3665 return; 3662 3666 FloatRect imageRect = snapRectToDevicePixels(LayoutRect(resizerCornerRect.maxXMaxYCorner() - cornerResizerSize, cornerResizerSize), renderer().document().deviceScaleFactor()); 3663 context.drawImage( resizeCornerImage.get(), renderer().style().colorSpace(), imageRect);3667 context.drawImage(*resizeCornerImage, renderer().style().colorSpace(), imageRect); 3664 3668 } 3665 3669 -
trunk/Source/WebCore/rendering/RenderListMarker.cpp
r190883 r191049 1198 1198 1199 1199 if (isImage()) { 1200 context.drawImage(m_image->image(this, marker.size()).get(), style().colorSpace(), marker); 1200 if (RefPtr<Image> markerImage = m_image->image(this, marker.size())) 1201 context.drawImage(*markerImage, style().colorSpace(), marker); 1201 1202 if (selectionState() != SelectionNone) { 1202 1203 LayoutRect selRect = localSelectionRect(); -
trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp
r189144 r191049 136 136 return; 137 137 138 bool useLowQualityScaling = shouldPaintAtLowQuality(context, image, image, alignedRect.size());138 bool useLowQualityScaling = shouldPaintAtLowQuality(context, *image, image, alignedRect.size()); 139 139 140 140 ImageOrientationDescription orientationDescription(shouldRespectImageOrientation()); … … 142 142 orientationDescription.setImageOrientationEnum(style().imageOrientation()); 143 143 #endif 144 context.drawImage( image, style().colorSpace(), alignedRect, ImagePaintingOptions(orientationDescription, useLowQualityScaling));144 context.drawImage(*image, style().colorSpace(), alignedRect, ImagePaintingOptions(orientationDescription, useLowQualityScaling)); 145 145 } 146 146 -
trunk/Source/WebCore/rendering/RenderThemeMac.mm
r190800 r191049 1159 1159 } 1160 1160 1161 paintInfo.context().drawImageBuffer( imageBuffer.get(), ColorSpaceDeviceRGB, inflatedRect.location());1161 paintInfo.context().drawImageBuffer(*imageBuffer, ColorSpaceDeviceRGB, inflatedRect.location()); 1162 1162 return false; 1163 1163 } … … 1913 1913 return true; 1914 1914 1915 context.drawImage( snapshot, plugInRenderer.style().colorSpace(), alignedPluginRect, CompositeSourceOver);1915 context.drawImage(*snapshot, plugInRenderer.style().colorSpace(), alignedPluginRect, CompositeSourceOver); 1916 1916 return false; 1917 1917 } -
trunk/Source/WebCore/rendering/RenderThemeWin.cpp
r189830 r191049 893 893 static Image* cancelImage = Image::loadPlatformResource("searchCancel").leakRef(); 894 894 static Image* cancelPressedImage = Image::loadPlatformResource("searchCancelPressed").leakRef(); 895 paintInfo.context().drawImage(isPressed(o) ? cancelPressedImage :cancelImage, o.style().colorSpace(), bounds);895 paintInfo.context().drawImage(isPressed(o) ? *cancelPressedImage : *cancelImage, o.style().colorSpace(), bounds); 896 896 return false; 897 897 } … … 941 941 942 942 static Image* magnifierImage = Image::loadPlatformResource("searchMagnifier").leakRef(); 943 paintInfo.context().drawImage( magnifierImage, o.style().colorSpace(), bounds);943 paintInfo.context().drawImage(*magnifierImage, o.style().colorSpace(), bounds); 944 944 return false; 945 945 } … … 976 976 977 977 static Image* magnifierImage = Image::loadPlatformResource("searchMagnifierResults").leakRef(); 978 paintInfo.context().drawImage( magnifierImage, o.style().colorSpace(), bounds);978 paintInfo.context().drawImage(*magnifierImage, o.style().colorSpace(), bounds); 979 979 return false; 980 980 } -
trunk/Source/WebCore/rendering/shapes/Shape.cpp
r190124 r191049 185 185 if (imageBuffer) { 186 186 GraphicsContext& graphicsContext = imageBuffer->context(); 187 graphicsContext.drawImage(image, ColorSpaceDeviceRGB, IntRect(IntPoint(), imageRect.size())); 187 if (image) 188 graphicsContext.drawImage(*image, ColorSpaceDeviceRGB, IntRect(IntPoint(), imageRect.size())); 188 189 189 190 RefPtr<Uint8ClampedArray> pixelArray = imageBuffer->getUnmultipliedImageData(IntRect(IntPoint(), imageRect.size())); -
trunk/Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp
r190883 r191049 159 159 ASSERT(!styleImage->isPendingImage()); 160 160 RefPtr<Image> image = styleImage->image(const_cast<RenderBox*>(&m_renderer), imageSize); 161 162 161 return Shape::createRasterShape(image.get(), shapeImageThreshold, imageRect, marginRect, writingMode, margin); 163 162 } -
trunk/Source/WebCore/rendering/style/NinePieceImage.cpp
r191017 r191049 207 207 208 208 RefPtr<Image> image = styleImage->image(renderer, source); 209 if (!image) 210 return; 211 209 212 ColorSpace colorSpace = style.colorSpace(); 210 213 … … 214 217 215 218 if (isCornerPiece(piece)) { 216 graphicsContext.drawImage( image.get(), colorSpace, destinationRects[piece], sourceRects[piece], op);219 graphicsContext.drawImage(*image, colorSpace, destinationRects[piece], sourceRects[piece], op); 217 220 continue; 218 221 } … … 220 223 Image::TileRule hRule = isHorizontalPiece(piece) ? static_cast<Image::TileRule>(horizontalRule()) : Image::StretchTile; 221 224 Image::TileRule vRule = isVerticalPiece(piece) ? static_cast<Image::TileRule>(verticalRule()) : Image::StretchTile; 222 graphicsContext.drawTiledImage( image.get(), colorSpace, destinationRects[piece], sourceRects[piece], tileScales[piece], hRule, vRule, op);225 graphicsContext.drawTiledImage(*image, colorSpace, destinationRects[piece], sourceRects[piece], tileScales[piece], hRule, vRule, op); 223 226 } 224 227 } -
trunk/Source/WebCore/rendering/svg/RenderSVGImage.cpp
r189144 r191049 162 162 { 163 163 RefPtr<Image> image = imageResource().image(); 164 if (!image) 165 return; 166 164 167 FloatRect destRect = m_objectBoundingBox; 165 168 FloatRect srcRect(0, 0, image->width(), image->height()); … … 167 170 imageElement().preserveAspectRatio().transformRect(destRect, srcRect); 168 171 169 paintInfo.context().drawImage( image.get(), ColorSpaceDeviceRGB, destRect, srcRect);172 paintInfo.context().drawImage(*image, ColorSpaceDeviceRGB, destRect, srcRect); 170 173 } 171 174 -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp
r189565 r191049 271 271 272 272 context->scale(FloatSize(1 / filterData->filter->filterResolution().width(), 1 / filterData->filter->filterResolution().height())); 273 context->drawImageBuffer( resultImage, renderer.style().colorSpace(), lastEffect->absolutePaintRect());273 context->drawImageBuffer(*resultImage, renderer.style().colorSpace(), lastEffect->absolutePaintRect()); 274 274 context->scale(filterData->filter->filterResolution()); 275 275 -
trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp
r190124 r191049 310 310 void SVGRenderingContext::clipToImageBuffer(GraphicsContext& context, const AffineTransform& absoluteTransform, const FloatRect& targetRect, std::unique_ptr<ImageBuffer>& imageBuffer, bool safeToClear) 311 311 { 312 ASSERT(imageBuffer); 312 if (!imageBuffer) 313 return; 313 314 314 315 FloatRect absoluteTargetRect = calculateImageBufferRect(targetRect, absoluteTransform); … … 317 318 // So the actual masking process has to be done in the absolute coordinate space as well. 318 319 context.concatCTM(absoluteTransform.inverse()); 319 context.clipToImageBuffer( imageBuffer.get(), absoluteTargetRect);320 context.clipToImageBuffer(*imageBuffer, absoluteTargetRect); 320 321 context.concatCTM(absoluteTransform); 321 322 … … 361 362 } 362 363 363 m_paintInfo->context().drawImageBuffer( imageBuffer.get(), ColorSpaceDeviceRGB, boundingBox);364 m_paintInfo->context().drawImageBuffer(*imageBuffer, ColorSpaceDeviceRGB, boundingBox); 364 365 return true; 365 366 } -
trunk/Source/WebCore/svg/graphics/filters/SVGFEImage.cpp
r189144 r191049 136 136 } 137 137 138 resultImage->context().drawImage( m_image.get(), ColorSpaceDeviceRGB, destRect, srcRect);138 resultImage->context().drawImage(*m_image, ColorSpaceDeviceRGB, destRect, srcRect); 139 139 } 140 140 -
trunk/Source/WebKit/win/ChangeLog
r190859 r191049 1 2015-10-14 Simon Fraser <simon.fraser@apple.com> 2 3 Change GraphicsContext image-drawing functions to take references 4 https://bugs.webkit.org/show_bug.cgi?id=150108 5 6 Reviewed by Tim Horton and Sam Weinig. 7 8 Change GraphicsContext::drawImage(), drawTiledImage(), drawImageBuffer(), clipToImageBuffer() 9 and isCompatibleWithBuffer() to take references, and adjust calling code, adding 10 null-checks where necessary. 11 12 * FullscreenVideoController.cpp: 13 (HUDButton::draw): 14 * Plugins/PluginView.cpp: 15 (WebCore::PluginView::paintMissingPluginIcon): 16 1 17 2015-10-09 Anders Carlsson <andersca@apple.com> 2 18 -
trunk/Source/WebKit/win/FullscreenVideoController.cpp
r189830 r191049 119 119 { 120 120 Image* image = (m_showAltButton && m_buttonImageAlt) ? m_buttonImageAlt.get() : m_buttonImage.get(); 121 context.drawImage( image, ColorSpaceDeviceRGB, m_rect.location());121 context.drawImage(*image, ColorSpaceDeviceRGB, m_rect.location()); 122 122 } 123 123 -
trunk/Source/WebKit/win/Plugins/PluginView.cpp
r189919 r191049 1123 1123 context.save(); 1124 1124 context.clip(windowClipRect()); 1125 context.drawImage( nullPluginImage.get(), ColorSpaceDeviceRGB, imageRect.location());1125 context.drawImage(*nullPluginImage, ColorSpaceDeviceRGB, imageRect.location()); 1126 1126 context.restore(); 1127 1127 } -
trunk/Source/WebKit2/ChangeLog
r191047 r191049 1 2015-10-14 Simon Fraser <simon.fraser@apple.com> 2 3 Change GraphicsContext image-drawing functions to take references 4 https://bugs.webkit.org/show_bug.cgi?id=150108 5 6 Reviewed by Tim Horton and Sam Weinig. 7 8 Change GraphicsContext::drawImage(), drawTiledImage(), drawImageBuffer(), clipToImageBuffer() 9 and isCompatibleWithBuffer() to take references, and adjust calling code, adding 10 null-checks where necessary. 11 12 * Shared/ContextMenuContextData.cpp: 13 (WebKit::ContextMenuContextData::ContextMenuContextData): 14 * Shared/WebCoreArgumentCoders.cpp: 15 (IPC::encodeImage): 16 (IPC::encodeOptionalImage): 17 (IPC::ArgumentCoder<Cursor>::encode): 18 * WebProcess/WebPage/WebFrame.cpp: 19 (WebKit::WebFrame::createSelectionSnapshot): 20 1 21 2015-10-14 Anders Carlsson <andersca@apple.com> 2 22 -
trunk/Source/WebKit2/Shared/ContextMenuContextData.cpp
r182753 r191049 59 59 // FIXME: figure out the rounding startegy for ShareableBitmap. 60 60 m_controlledImage = ShareableBitmap::createShareable(IntSize(image->size()), ShareableBitmap::SupportsAlpha); 61 m_controlledImage->createGraphicsContext()->drawImage( image, ColorSpaceDeviceRGB, IntPoint());61 m_controlledImage->createGraphicsContext()->drawImage(*image, ColorSpaceDeviceRGB, IntPoint()); 62 62 #endif 63 63 } -
trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp
r189810 r191049 722 722 } 723 723 724 static void encodeImage(ArgumentEncoder& encoder, Image *image)725 { 726 RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(IntSize(image ->size()), ShareableBitmap::SupportsAlpha);724 static void encodeImage(ArgumentEncoder& encoder, Image& image) 725 { 726 RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(IntSize(image.size()), ShareableBitmap::SupportsAlpha); 727 727 bitmap->createGraphicsContext()->drawImage(image, ColorSpaceDeviceRGB, IntPoint()); 728 728 … … 754 754 755 755 if (hasImage) 756 encodeImage(encoder, image);756 encodeImage(encoder, *image); 757 757 } 758 758 … … 785 785 786 786 encoder << true; 787 encodeImage(encoder, cursor.image());787 encodeImage(encoder, *cursor.image()); 788 788 encoder << cursor.hotSpot(); 789 789 #if ENABLE(MOUSE_CURSOR_SCALE) … … 1254 1254 void ArgumentCoder<PasteboardImage>::encode(ArgumentEncoder& encoder, const PasteboardImage& pasteboardImage) 1255 1255 { 1256 encode Image(encoder, pasteboardImage.image.get());1256 encodeOptionalImage(encoder, pasteboardImage.image.get()); 1257 1257 encoder << pasteboardImage.url.url; 1258 1258 encoder << pasteboardImage.url.title; … … 1264 1264 bool ArgumentCoder<PasteboardImage>::decode(ArgumentDecoder& decoder, PasteboardImage& pasteboardImage) 1265 1265 { 1266 if (!decode Image(decoder, pasteboardImage.image))1266 if (!decodeOptionalImage(decoder, pasteboardImage.image)) 1267 1267 return false; 1268 1268 if (!decoder.decode(pasteboardImage.url.url)) -
trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
r189193 r191049 839 839 float deviceScaleFactor = coreFrame()->page()->deviceScaleFactor(); 840 840 graphicsContext->scale(FloatSize(deviceScaleFactor, deviceScaleFactor)); 841 graphicsContext->drawImageBuffer( snapshot.get(), ColorSpaceDeviceRGB, FloatPoint());841 graphicsContext->drawImageBuffer(*snapshot, ColorSpaceDeviceRGB, FloatPoint()); 842 842 843 843 return sharedSnapshot.release(); -
trunk/Source/WebKit2/WebProcess/WebPage/ios/FindControllerIOS.mm
r189178 r191049 84 84 context.fillPath(path); 85 85 86 context.drawImage( indicatorImage, ColorSpaceDeviceRGB, overlay.bounds());86 context.drawImage(*indicatorImage, ColorSpaceDeviceRGB, overlay.bounds()); 87 87 } 88 88 -
trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm
r190604 r191049 2219 2219 if (RefPtr<ShareableBitmap> sharedBitmap = ShareableBitmap::createShareable(IntSize(bitmapSize), ShareableBitmap::SupportsAlpha)) { 2220 2220 auto graphicsContext = sharedBitmap->createGraphicsContext(); 2221 graphicsContext->drawImage( image, ColorSpaceDeviceRGB, FloatRect(0, 0, bitmapSize.width(), bitmapSize.height()));2221 graphicsContext->drawImage(*image, ColorSpaceDeviceRGB, FloatRect(0, 0, bitmapSize.width(), bitmapSize.height())); 2222 2222 info.image = sharedBitmap; 2223 2223 }
Note:
See TracChangeset
for help on using the changeset viewer.