Diff
Modified: trunk/Source/WebCore/ChangeLog (161778 => 161779)
--- trunk/Source/WebCore/ChangeLog 2014-01-11 20:59:11 UTC (rev 161778)
+++ trunk/Source/WebCore/ChangeLog 2014-01-11 20:59:14 UTC (rev 161779)
@@ -1,5 +1,31 @@
2014-01-11 Simon Fraser <[email protected]>
+ Unfork GraphicsContext::drawNativeImage for iOS
+ https://bugs.webkit.org/show_bug.cgi?id=126824
+
+ Reviewed by Dean Jackson.
+
+ GraphicsContext::drawNativeImage had a different signature for iOS,
+ which required #ifdefs at all the call sites. Unfork by passing the "scale"
+ parameter everywhere (it's only used on iOS).
+
+ * WebCore.exp.in:
+ * html/canvas/CanvasRenderingContext2D.cpp:
+ (WebCore::CanvasRenderingContext2D::drawImage):
+ * platform/graphics/GraphicsContext.h:
+ * platform/graphics/cg/BitmapImageCG.cpp:
+ (WebCore::BitmapImage::draw):
+ * platform/graphics/cg/GraphicsContext3DCG.cpp:
+ (WebCore::GraphicsContext3D::paintToCanvas):
+ * platform/graphics/cg/GraphicsContextCG.cpp:
+ (WebCore::GraphicsContext::platformInit):
+ * platform/graphics/cg/ImageBufferCG.cpp:
+ (WebCore::ImageBuffer::draw):
+ * platform/graphics/ios/IconIOS.mm:
+ (WebCore::Icon::paint):
+
+2014-01-11 Simon Fraser <[email protected]>
+
Work around USE(CFNETWORK) build failure on iOS.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
Modified: trunk/Source/WebCore/WebCore.exp.in (161778 => 161779)
--- trunk/Source/WebCore/WebCore.exp.in 2014-01-11 20:59:11 UTC (rev 161778)
+++ trunk/Source/WebCore/WebCore.exp.in 2014-01-11 20:59:14 UTC (rev 161779)
@@ -2011,7 +2011,7 @@
__ZN7WebCore12EventHandler8keyEventEP7NSEvent
__ZN7WebCore12EventHandler9mouseDownEP7NSEvent
__ZN7WebCore13toDeviceSpaceERKNS_9FloatRectEP8NSWindow
-__ZN7WebCore15GraphicsContext15drawNativeImageEP7CGImageRKNS_9FloatSizeENS_10ColorSpaceERKNS_9FloatRectES9_NS_17CompositeOperatorENS_9BlendModeENS_16ImageOrientationE
+__ZN7WebCore15GraphicsContext15drawNativeImageEP7CGImageRKNS_9FloatSizeENS_10ColorSpaceERKNS_9FloatRectES9_fNS_17CompositeOperatorENS_9BlendModeENS_16ImageOrientationE
__ZN7WebCore15GraphicsContextC1EP9CGContext
__ZN7WebCore15ResourceRequest39updateFromDelegatePreservingOldHTTPBodyERKS0_
__ZN7WebCore16FontPlatformDataC1EP6NSFontfbbbNS_15FontOrientationENS_16FontWidthVariantE
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (161778 => 161779)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp 2014-01-11 20:59:11 UTC (rev 161778)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp 2014-01-11 20:59:14 UTC (rev 161779)
@@ -1458,11 +1458,7 @@
#if USE(CG)
if (PassNativeImagePtr image = video->nativeImageForCurrentTime()) {
- c->drawNativeImage(image, FloatSize(video->videoWidth(), video->videoHeight()), ColorSpaceDeviceRGB, dstRect, srcRect
-#if PLATFORM(IOS)
- , DefaultImageOrientation
-#endif
- );
+ c->drawNativeImage(image, FloatSize(video->videoWidth(), video->videoHeight()), ColorSpaceDeviceRGB, dstRect, srcRect);
if (rectContainsCanvas(dstRect))
didDrawEntireCanvas();
else
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (161778 => 161779)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h 2014-01-11 20:59:11 UTC (rev 161778)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h 2014-01-11 20:59:14 UTC (rev 161779)
@@ -253,11 +253,7 @@
void applyFillPattern();
void drawPath(const Path&);
-#if PLATFORM(IOS)
- void drawNativeImage(PassNativeImagePtr, const FloatSize& selfSize, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, float scale, CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal, ImageOrientation = DefaultImageOrientation);
-#else
- void drawNativeImage(PassNativeImagePtr, const FloatSize& selfSize, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal, ImageOrientation = DefaultImageOrientation);
-#endif
+ void drawNativeImage(PassNativeImagePtr, const FloatSize& selfSize, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, float scale = 1, CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal, ImageOrientation = DefaultImageOrientation);
// Allow font smoothing (LCD antialiasing). Not part of the graphics state.
void setAllowsFontSmoothing(bool);
Modified: trunk/Source/WebCore/platform/graphics/cg/BitmapImageCG.cpp (161778 => 161779)
--- trunk/Source/WebCore/platform/graphics/cg/BitmapImageCG.cpp 2014-01-11 20:59:11 UTC (rev 161778)
+++ trunk/Source/WebCore/platform/graphics/cg/BitmapImageCG.cpp 2014-01-11 20:59:14 UTC (rev 161779)
@@ -212,20 +212,23 @@
void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& destRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator compositeOp, BlendMode blendMode, ImageOrientationDescription description)
{
+ CGImageRef image;
#if !PLATFORM(IOS)
startAnimation();
- CGImageRef image = frameAtIndex(m_currentFrame);
+ image = frameAtIndex(m_currentFrame);
#else
startAnimation(false);
CGRect transformedDestinationRect = CGRectApplyAffineTransform(destRect, CGContextGetCTM(ctxt->platformContext()));
- RetainPtr<CGImageRef> image;
+ RetainPtr<CGImageRef> imagePossiblyCopied;
// Never use subsampled images for drawing into PDF contexts.
if (CGContextGetType(ctxt->platformContext()) == kCGContextTypePDF)
- image = adoptCF(copyUnscaledFrameAtIndex(m_currentFrame));
+ imagePossiblyCopied = adoptCF(copyUnscaledFrameAtIndex(m_currentFrame));
else
- image = frameAtIndex(m_currentFrame, std::min<float>(1.0f, std::max(transformedDestinationRect.size.width / srcRect.width(), transformedDestinationRect.size.height / srcRect.height())));
+ imagePossiblyCopied = frameAtIndex(m_currentFrame, std::min<float>(1.0f, std::max(transformedDestinationRect.size.width / srcRect.width(), transformedDestinationRect.size.height / srcRect.height())));
+
+ image = imagePossiblyCopied.get();
#endif
if (!image) // If it's too early we won't have an image yet.
return;
@@ -235,8 +238,9 @@
return;
}
+ float scale = 1;
#if PLATFORM(IOS)
- float scale = m_frames[m_currentFrame].m_scale;
+ scale = m_frames[m_currentFrame].m_scale;
#endif
FloatSize selfSize = currentFrameSize();
ImageOrientation orientation;
@@ -244,11 +248,7 @@
if (description.respectImageOrientation() == RespectImageOrientation)
orientation = frameOrientationAtIndex(m_currentFrame);
-#if PLATFORM(IOS)
- ctxt->drawNativeImage(image.get(), selfSize, styleColorSpace, destRect, srcRect, scale, compositeOp, blendMode, orientation);
-#else
- ctxt->drawNativeImage(image, selfSize, styleColorSpace, destRect, srcRect, compositeOp, blendMode, orientation);
-#endif
+ ctxt->drawNativeImage(image, selfSize, styleColorSpace, destRect, srcRect, scale, compositeOp, blendMode, orientation);
if (imageObserver())
imageObserver()->didDraw(this);
Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp (161778 => 161779)
--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp 2014-01-11 20:59:11 UTC (rev 161778)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp 2014-01-11 20:59:14 UTC (rev 161779)
@@ -535,7 +535,7 @@
context->scale(FloatSize(1, -1));
context->translate(0, -imageHeight);
context->setImageInterpolationQuality(InterpolationNone);
- context->drawNativeImage(cgImage.get(), imageSize, ColorSpaceDeviceRGB, canvasRect, FloatRect(FloatPoint(), imageSize), CompositeCopy);
+ context->drawNativeImage(cgImage.get(), imageSize, ColorSpaceDeviceRGB, canvasRect, FloatRect(FloatPoint(), imageSize), 1, CompositeCopy);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (161778 => 161779)
--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2014-01-11 20:59:11 UTC (rev 161778)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2014-01-11 20:59:14 UTC (rev 161779)
@@ -169,11 +169,7 @@
m_data->m_userToDeviceTransformKnownToBeIdentity = false;
}
-#if PLATFORM(IOS)
void GraphicsContext::drawNativeImage(PassNativeImagePtr imagePtr, const FloatSize& imageSize, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, float scale, CompositeOperator op, BlendMode blendMode, ImageOrientation orientation)
-#else
-void GraphicsContext::drawNativeImage(PassNativeImagePtr imagePtr, const FloatSize& imageSize, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, BlendMode blendMode, ImageOrientation orientation)
-#endif
{
RetainPtr<CGImageRef> image(imagePtr);
@@ -181,6 +177,8 @@
#if PLATFORM(IOS)
// Unapply the scaling since we are getting this from a scaled bitmap.
currHeight /= scale;
+#else
+ UNUSED_PARAM(scale);
#endif
if (currHeight <= srcRect.y())
Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp (161778 => 161779)
--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp 2014-01-11 20:59:11 UTC (rev 161778)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp 2014-01-11 20:59:14 UTC (rev 161779)
@@ -304,13 +304,7 @@
FloatRect adjustedSrcRect = srcRect;
adjustedSrcRect.scale(m_resolutionScale, m_resolutionScale);
- destContext->drawNativeImage(image.get(), m_data.m_backingStoreSize, colorSpace, destRect, adjustedSrcRect,
-#if PLATFORM(IOS)
- 1.0f, // Default scale of 1.0
-#endif
- op,
- blendMode
- );
+ destContext->drawNativeImage(image.get(), m_data.m_backingStoreSize, colorSpace, destRect, adjustedSrcRect, 1, op, blendMode);
}
void ImageBuffer::drawPattern(GraphicsContext* destContext, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect)
Modified: trunk/Source/WebCore/platform/graphics/ios/IconIOS.mm (161778 => 161779)
--- trunk/Source/WebCore/platform/graphics/ios/IconIOS.mm 2014-01-11 20:59:11 UTC (rev 161778)
+++ trunk/Source/WebCore/platform/graphics/ios/IconIOS.mm 2014-01-11 20:59:14 UTC (rev 161779)
@@ -69,7 +69,7 @@
ColorSpace colorSpace = ColorSpaceDeviceRGB;
context->setImageInterpolationQuality(InterpolationHigh);
- context->drawNativeImage(m_cgImage.get(), size, colorSpace, destRect, srcRect, 1.0f, CompositeSourceOver, BlendModeNormal, DefaultImageOrientation);
+ context->drawNativeImage(m_cgImage.get(), size, colorSpace, destRect, srcRect);
}
}
Modified: trunk/Source/WebKit2/ChangeLog (161778 => 161779)
--- trunk/Source/WebKit2/ChangeLog 2014-01-11 20:59:11 UTC (rev 161778)
+++ trunk/Source/WebKit2/ChangeLog 2014-01-11 20:59:14 UTC (rev 161779)
@@ -1,3 +1,17 @@
+2014-01-11 Simon Fraser <[email protected]>
+
+ Unfork GraphicsContext::drawNativeImage for iOS
+ https://bugs.webkit.org/show_bug.cgi?id=126824
+
+ Reviewed by Dean Jackson.
+
+ GraphicsContext::drawNativeImage had a different signature for iOS,
+ which required #ifdefs at all the call sites. Unfork by passing the "scale"
+ parameter everywhere (it's only used on iOS).
+
+ * Shared/API/c/cg/WKImageCG.cpp:
+ (WKImageCreateFromCGImage):
+
2014-01-11 Sam Weinig <[email protected]>
Clean up iterator filter / iterator range code
Modified: trunk/Source/WebKit2/Shared/API/c/cg/WKImageCG.cpp (161778 => 161779)
--- trunk/Source/WebKit2/Shared/API/c/cg/WKImageCG.cpp 2014-01-11 20:59:11 UTC (rev 161778)
+++ trunk/Source/WebKit2/Shared/API/c/cg/WKImageCG.cpp 2014-01-11 20:59:14 UTC (rev 161779)
@@ -57,10 +57,6 @@
auto graphicsContext = webImage->bitmap()->createGraphicsContext();
FloatRect rect(FloatPoint(0, 0), imageSize);
graphicsContext->clearRect(rect);
-#if PLATFORM(IOS)
- graphicsContext->drawNativeImage(imageRef, imageSize, WebCore::ColorSpaceDeviceRGB, rect, rect, 1.0);
-#else
graphicsContext->drawNativeImage(imageRef, imageSize, WebCore::ColorSpaceDeviceRGB, rect, rect);
-#endif
return toAPI(webImage.release().leakRef());
}