summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/cg
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-13 16:23:25 +0100
committerBen Murdoch <benm@google.com>2011-05-16 11:35:02 +0100
commit65f03d4f644ce73618e5f4f50dd694b26f55ae12 (patch)
treef478babb801e720de7bfaee23443ffe029f58731 /Source/WebCore/platform/graphics/cg
parent47de4a2fb7262c7ebdb9cd133ad2c54c187454d0 (diff)
downloadexternal_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.zip
external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.tar.gz
external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.tar.bz2
Merge WebKit at r75993: Initial merge by git.
Change-Id: I602bbdc3974787a3b0450456a30a7868286921c3
Diffstat (limited to 'Source/WebCore/platform/graphics/cg')
-rw-r--r--Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp47
-rw-r--r--Source/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h5
-rw-r--r--Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp11
-rw-r--r--Source/WebCore/platform/graphics/cg/PDFDocumentImage.h5
4 files changed, 54 insertions, 14 deletions
diff --git a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
index acd912f..eddf735 100644
--- a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
+++ b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
@@ -546,21 +546,46 @@ void GraphicsContext::fillPath(const Path& path)
CGContextRef context = platformContext();
- CGContextBeginPath(context);
- CGContextAddPath(context, path.platformPath());
-
if (m_state.fillGradient) {
- CGContextSaveGState(context);
- if (fillRule() == RULE_EVENODD)
- CGContextEOClip(context);
- else
- CGContextClip(context);
- CGContextConcatCTM(context, m_state.fillGradient->gradientSpaceTransform());
- m_state.fillGradient->paint(this);
- CGContextRestoreGState(context);
+ if (hasShadow()) {
+ FloatRect rect = path.boundingRect();
+ CGLayerRef layer = CGLayerCreateWithContext(context, CGSizeMake(rect.width(), rect.height()), 0);
+ CGContextRef layerContext = CGLayerGetContext(layer);
+
+ CGContextTranslateCTM(layerContext, -rect.x(), -rect.y());
+ CGContextBeginPath(layerContext);
+ CGContextAddPath(layerContext, path.platformPath());
+ CGContextConcatCTM(layerContext, m_state.fillGradient->gradientSpaceTransform());
+
+ if (fillRule() == RULE_EVENODD)
+ CGContextEOClip(layerContext);
+ else
+ CGContextClip(layerContext);
+
+ m_state.fillGradient->paint(layerContext);
+ CGContextDrawLayerAtPoint(context, CGPointMake(rect.left(), rect.top()), layer);
+ CGLayerRelease(layer);
+ } else {
+ CGContextBeginPath(context);
+ CGContextAddPath(context, path.platformPath());
+ CGContextSaveGState(context);
+ CGContextConcatCTM(context, m_state.fillGradient->gradientSpaceTransform());
+
+ if (fillRule() == RULE_EVENODD)
+ CGContextEOClip(context);
+ else
+ CGContextClip(context);
+
+ m_state.fillGradient->paint(this);
+ CGContextRestoreGState(context);
+ }
+
return;
}
+ CGContextBeginPath(context);
+ CGContextAddPath(context, path.platformPath());
+
if (m_state.fillPattern)
applyFillPattern();
fillPathWithFillRule(context, fillRule());
diff --git a/Source/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h b/Source/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h
index 1d0a99f..d4fa32e 100644
--- a/Source/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h
+++ b/Source/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h
@@ -23,6 +23,9 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef GraphicsContextPlatformPrivateCG_h
+#define GraphicsContextPlatformPrivateCG_h
+
#include <wtf/RetainPtr.h>
#include <CoreGraphics/CGContext.h>
@@ -84,3 +87,5 @@ public:
};
}
+
+#endif // GraphicsContextPlatformPrivateCG_h
diff --git a/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp b/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
index 75a36e5..023d098 100644
--- a/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
+++ b/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
@@ -54,6 +54,8 @@ using namespace std;
namespace WebCore {
#if USE(IOSURFACE_CANVAS_BACKING_STORE)
+static const int maxIOSurfaceDimension = 4096;
+
static RetainPtr<IOSurfaceRef> createIOSurface(const IntSize& size)
{
unsigned pixelFormat = 'BGRA';
@@ -110,12 +112,15 @@ ImageBuffer::ImageBuffer(const IntSize& size, ColorSpace imageColorSpace, Render
, m_size(size)
, m_accelerateRendering(renderingMode == Accelerated)
{
-#if !USE(IOSURFACE_CANVAS_BACKING_STORE)
- ASSERT(renderingMode == Unaccelerated);
-#endif
success = false; // Make early return mean failure.
if (size.width() < 0 || size.height() < 0)
return;
+#if USE(IOSURFACE_CANVAS_BACKING_STORE)
+ if (size.width() >= maxIOSurfaceDimension || size.height() >= maxIOSurfaceDimension)
+ m_accelerateRendering = false;
+#else
+ ASSERT(renderingMode == Unaccelerated);
+#endif
unsigned bytesPerRow = size.width();
if (bytesPerRow > 0x3FFFFFFF) // Protect against overflow
diff --git a/Source/WebCore/platform/graphics/cg/PDFDocumentImage.h b/Source/WebCore/platform/graphics/cg/PDFDocumentImage.h
index 790d620..ecd57be 100644
--- a/Source/WebCore/platform/graphics/cg/PDFDocumentImage.h
+++ b/Source/WebCore/platform/graphics/cg/PDFDocumentImage.h
@@ -23,6 +23,9 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef PDFDocumentImage_h
+#define PDFDocumentImage_h
+
#include "Image.h"
#include "FloatRect.h"
@@ -76,3 +79,5 @@ namespace WebCore {
}
#endif // PLATFORM(CG)
+
+#endif // PDFDocumentImage_h