diff options
Diffstat (limited to 'WebCore/platform/graphics/cg/GraphicsContextCG.cpp')
-rw-r--r-- | WebCore/platform/graphics/cg/GraphicsContextCG.cpp | 49 |
1 files changed, 1 insertions, 48 deletions
diff --git a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp index de546ac..c490dcb 100644 --- a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp +++ b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp @@ -30,14 +30,10 @@ #include "AffineTransform.h" #include "FloatConversion.h" #include "GraphicsContextPlatformPrivateCG.h" -#include "ImageBuffer.h" #include "KURL.h" #include "Path.h" -#include <CoreGraphics/CGBitmapContext.h> #include <CoreGraphics/CGPDFContext.h> #include <wtf/MathExtras.h> -#include <wtf/OwnArrayPtr.h> -#include <wtf/RetainPtr.h> using namespace std; @@ -928,49 +924,6 @@ void GraphicsContext::setCompositeOperation(CompositeOperator mode) CGContextSetBlendMode(platformContext(), target); } #endif - -void GraphicsContext::paintBuffer(ImageBuffer* buffer, const IntRect& r) -{ - CGContextRef context = buffer->context()->platformContext(); - if (!context) - return; - CGContextFlush(context); - if (CGImageRef image = CGBitmapContextCreateImage(context)) { - CGContextDrawImage(platformContext(), roundToDevicePixels(r), image); - CGImageRelease(image); - } -} - -void GraphicsContext::drawImage(ImageBuffer* buffer, const FloatRect& srcRect, const FloatRect& destRect) -{ - CGContextRef context = buffer->context()->platformContext(); - CGContextFlush(context); - RetainPtr<CGImageRef> image(AdoptCF, CGBitmapContextCreateImage(context)); - float iw = CGImageGetWidth(image.get()); - float ih = CGImageGetHeight(image.get()); - if (srcRect.x() == 0 && srcRect.y() == 0 && iw == srcRect.width() && ih == srcRect.height()) { - // Fast path, yay! - CGContextDrawImage(platformContext(), destRect, image.get()); - } else { - // Slow path, boo! - // FIXME: We can do this without creating a separate image - - size_t csw = static_cast<size_t>(ceilf(srcRect.width())); - size_t csh = static_cast<size_t>(ceilf(srcRect.height())); - - RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB()); - size_t bytesPerRow = csw * 4; - OwnArrayPtr<char> buffer(new char[csh * bytesPerRow]); - RetainPtr<CGContextRef> clippedSourceContext(AdoptCF, CGBitmapContextCreate(buffer.get(), csw, csh, - 8, bytesPerRow, colorSpace.get(), kCGImageAlphaPremultipliedLast)); - CGContextTranslateCTM(clippedSourceContext.get(), -srcRect.x(), -srcRect.y()); - CGContextDrawImage(clippedSourceContext.get(), CGRectMake(0, 0, iw, ih), image.get()); - - RetainPtr<CGImageRef> clippedSourceImage(AdoptCF, CGBitmapContextCreateImage(clippedSourceContext.get())); - - CGContextDrawImage(platformContext(), destRect, clippedSourceImage.get()); - } -} - + } |