Reviewed by Oliver.
Push SVGResourceFilter platform specific data down into m_platformData
in preparation for implementing a non-mac filter solution.
Also update a very old email address in copyright headers
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/FloatPoint3D.cpp:
(WebCore::FloatPoint3D::FloatPoint3D):
* platform/graphics/FloatPoint3D.h:
* platform/graphics/svg/SVGResourceFilter.cpp:
(WebCore::SVGResourceFilter::SVGResourceFilter):
* platform/graphics/svg/SVGResourceFilter.h:
(WebCore::SVGResourceFilter::platformData):
(WebCore::SVGResourceFilter::effects):
* platform/graphics/svg/cg/SVGResourceFilterCg.mm:
(WebCore::SVGResourceFilter::createPlatformData):l
(WebCore::SVGResourceFilter::prepareFilter):
(WebCore::SVGResourceFilter::applyFilter):
* platform/graphics/svg/filters/SVGDistantLightSource.h:
* platform/graphics/svg/filters/SVGFEBlend.cpp:
* platform/graphics/svg/filters/SVGFEBlend.h:
* platform/graphics/svg/filters/SVGFEColorMatrix.cpp:
* platform/graphics/svg/filters/SVGFEColorMatrix.h:
* platform/graphics/svg/filters/SVGFEComponentTransfer.cpp:
* platform/graphics/svg/filters/SVGFEComponentTransfer.h:
* platform/graphics/svg/filters/SVGFEComposite.cpp:
* platform/graphics/svg/filters/SVGFEComposite.h:
* platform/graphics/svg/filters/SVGFEConvolveMatrix.cpp:
* platform/graphics/svg/filters/SVGFEConvolveMatrix.h:
* platform/graphics/svg/filters/SVGFEDiffuseLighting.cpp:
* platform/graphics/svg/filters/SVGFEDiffuseLighting.h:
* platform/graphics/svg/filters/SVGFEDisplacementMap.cpp:
* platform/graphics/svg/filters/SVGFEDisplacementMap.h:
* platform/graphics/svg/filters/SVGFEFlood.cpp:
* platform/graphics/svg/filters/SVGFEFlood.h:
* platform/graphics/svg/filters/SVGFEGaussianBlur.cpp:
* platform/graphics/svg/filters/SVGFEGaussianBlur.h:
* platform/graphics/svg/filters/SVGFEImage.cpp:
* platform/graphics/svg/filters/SVGFEImage.h:
* platform/graphics/svg/filters/SVGFEMerge.cpp:
* platform/graphics/svg/filters/SVGFEMerge.h:
* platform/graphics/svg/filters/SVGFEMorphology.cpp:
* platform/graphics/svg/filters/SVGFEMorphology.h:
* platform/graphics/svg/filters/SVGFEOffset.cpp:
* platform/graphics/svg/filters/SVGFEOffset.h:
* platform/graphics/svg/filters/SVGFESpecularLighting.cpp:
* platform/graphics/svg/filters/SVGFESpecularLighting.h:
* platform/graphics/svg/filters/SVGFETile.h:
* platform/graphics/svg/filters/SVGFETurbulence.cpp:
* platform/graphics/svg/filters/SVGFETurbulence.h:
* platform/graphics/svg/filters/SVGFilterEffect.cpp:
* platform/graphics/svg/filters/SVGFilterEffect.h:
* platform/graphics/svg/filters/SVGLightSource.cpp:
* platform/graphics/svg/filters/SVGLightSource.h:
* platform/graphics/svg/filters/SVGPointLightSource.h:
* platform/graphics/svg/filters/SVGSpotLightSource.h:
* platform/graphics/svg/filters/cg/SVGFEBlendCg.mm:
(WebCore::SVGFEBlend::getCIFilter):
* platform/graphics/svg/filters/cg/SVGFEColorMatrixCg.mm:
(WebCore::SVGFEColorMatrix::getCIFilter):
* platform/graphics/svg/filters/cg/SVGFEComponentTransferCg.mm:
(WebCore::SVGFEComponentTransfer::getCIFilter):
* platform/graphics/svg/filters/cg/SVGFECompositeCg.mm:
(WebCore::SVGFEComposite::getCIFilter):
* platform/graphics/svg/filters/cg/SVGFEDiffuseLightingCg.mm:
(WebCore::SVGFEDiffuseLighting::getCIFilter):
* platform/graphics/svg/filters/cg/SVGFEDisplacementMapCg.mm:
(WebCore::SVGFEDisplacementMap::getCIFilter):
* platform/graphics/svg/filters/cg/SVGFEFloodCg.mm:
(WebCore::SVGFEFlood::getCIFilter):
* platform/graphics/svg/filters/cg/SVGFEHelpersCg.h:
* platform/graphics/svg/filters/cg/SVGFEImageCg.mm:
(WebCore::SVGFEImage::getCIFilter):
* platform/graphics/svg/filters/cg/SVGFEMergeCg.mm:
(WebCore::SVGFEMerge::getCIFilter):
* platform/graphics/svg/filters/cg/SVGFESpecularLightingCg.mm:
(WebCore::SVGFESpecularLighting::getCIFilter):
* platform/graphics/svg/mac: Added.
* platform/graphics/svg/mac/SVGResourceFilterPlatformDataMac.h: Added.
* platform/graphics/svg/mac/SVGResourceFilterPlatformDataMac.mm: Added.
(WebCore::SVGResourceFilterPlatformDataMac::SVGResourceFilterPlatformDataMac):
(WebCore::SVGResourceFilterPlatformDataMac::~SVGResourceFilterPlatformDataMac):
(WebCore::SVGResourceFilterPlatformDataMac::getCIFilterStack):
(WebCore::alphaImageForImage):
(WebCore::SVGResourceFilterPlatformDataMac::imageForName):
(WebCore::SVGResourceFilterPlatformDataMac::setImageForName):
(WebCore::SVGResourceFilterPlatformDataMac::setOutputImage):
(WebCore::SVGResourceFilterPlatformDataMac::inputImage):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27179
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-10-28 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Oliver.
+
+ Push SVGResourceFilter platform specific data down into m_platformData
+ in preparation for implementing a non-mac filter solution.
+
+ Also update a very old email address in copyright headers
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/graphics/FloatPoint3D.cpp:
+ (WebCore::FloatPoint3D::FloatPoint3D):
+ * platform/graphics/FloatPoint3D.h:
+ * platform/graphics/svg/SVGResourceFilter.cpp:
+ (WebCore::SVGResourceFilter::SVGResourceFilter):
+ * platform/graphics/svg/SVGResourceFilter.h:
+ (WebCore::SVGResourceFilter::platformData):
+ (WebCore::SVGResourceFilter::effects):
+ * platform/graphics/svg/cg/SVGResourceFilterCg.mm:
+ (WebCore::SVGResourceFilter::createPlatformData):l
+ (WebCore::SVGResourceFilter::prepareFilter):
+ (WebCore::SVGResourceFilter::applyFilter):
+ * platform/graphics/svg/filters/SVGDistantLightSource.h:
+ * platform/graphics/svg/filters/SVGFEBlend.cpp:
+ * platform/graphics/svg/filters/SVGFEBlend.h:
+ * platform/graphics/svg/filters/SVGFEColorMatrix.cpp:
+ * platform/graphics/svg/filters/SVGFEColorMatrix.h:
+ * platform/graphics/svg/filters/SVGFEComponentTransfer.cpp:
+ * platform/graphics/svg/filters/SVGFEComponentTransfer.h:
+ * platform/graphics/svg/filters/SVGFEComposite.cpp:
+ * platform/graphics/svg/filters/SVGFEComposite.h:
+ * platform/graphics/svg/filters/SVGFEConvolveMatrix.cpp:
+ * platform/graphics/svg/filters/SVGFEConvolveMatrix.h:
+ * platform/graphics/svg/filters/SVGFEDiffuseLighting.cpp:
+ * platform/graphics/svg/filters/SVGFEDiffuseLighting.h:
+ * platform/graphics/svg/filters/SVGFEDisplacementMap.cpp:
+ * platform/graphics/svg/filters/SVGFEDisplacementMap.h:
+ * platform/graphics/svg/filters/SVGFEFlood.cpp:
+ * platform/graphics/svg/filters/SVGFEFlood.h:
+ * platform/graphics/svg/filters/SVGFEGaussianBlur.cpp:
+ * platform/graphics/svg/filters/SVGFEGaussianBlur.h:
+ * platform/graphics/svg/filters/SVGFEImage.cpp:
+ * platform/graphics/svg/filters/SVGFEImage.h:
+ * platform/graphics/svg/filters/SVGFEMerge.cpp:
+ * platform/graphics/svg/filters/SVGFEMerge.h:
+ * platform/graphics/svg/filters/SVGFEMorphology.cpp:
+ * platform/graphics/svg/filters/SVGFEMorphology.h:
+ * platform/graphics/svg/filters/SVGFEOffset.cpp:
+ * platform/graphics/svg/filters/SVGFEOffset.h:
+ * platform/graphics/svg/filters/SVGFESpecularLighting.cpp:
+ * platform/graphics/svg/filters/SVGFESpecularLighting.h:
+ * platform/graphics/svg/filters/SVGFETile.h:
+ * platform/graphics/svg/filters/SVGFETurbulence.cpp:
+ * platform/graphics/svg/filters/SVGFETurbulence.h:
+ * platform/graphics/svg/filters/SVGFilterEffect.cpp:
+ * platform/graphics/svg/filters/SVGFilterEffect.h:
+ * platform/graphics/svg/filters/SVGLightSource.cpp:
+ * platform/graphics/svg/filters/SVGLightSource.h:
+ * platform/graphics/svg/filters/SVGPointLightSource.h:
+ * platform/graphics/svg/filters/SVGSpotLightSource.h:
+ * platform/graphics/svg/filters/cg/SVGFEBlendCg.mm:
+ (WebCore::SVGFEBlend::getCIFilter):
+ * platform/graphics/svg/filters/cg/SVGFEColorMatrixCg.mm:
+ (WebCore::SVGFEColorMatrix::getCIFilter):
+ * platform/graphics/svg/filters/cg/SVGFEComponentTransferCg.mm:
+ (WebCore::SVGFEComponentTransfer::getCIFilter):
+ * platform/graphics/svg/filters/cg/SVGFECompositeCg.mm:
+ (WebCore::SVGFEComposite::getCIFilter):
+ * platform/graphics/svg/filters/cg/SVGFEDiffuseLightingCg.mm:
+ (WebCore::SVGFEDiffuseLighting::getCIFilter):
+ * platform/graphics/svg/filters/cg/SVGFEDisplacementMapCg.mm:
+ (WebCore::SVGFEDisplacementMap::getCIFilter):
+ * platform/graphics/svg/filters/cg/SVGFEFloodCg.mm:
+ (WebCore::SVGFEFlood::getCIFilter):
+ * platform/graphics/svg/filters/cg/SVGFEHelpersCg.h:
+ * platform/graphics/svg/filters/cg/SVGFEImageCg.mm:
+ (WebCore::SVGFEImage::getCIFilter):
+ * platform/graphics/svg/filters/cg/SVGFEMergeCg.mm:
+ (WebCore::SVGFEMerge::getCIFilter):
+ * platform/graphics/svg/filters/cg/SVGFESpecularLightingCg.mm:
+ (WebCore::SVGFESpecularLighting::getCIFilter):
+ * platform/graphics/svg/mac: Added.
+ * platform/graphics/svg/mac/SVGResourceFilterPlatformDataMac.h: Added.
+ * platform/graphics/svg/mac/SVGResourceFilterPlatformDataMac.mm: Added.
+ (WebCore::SVGResourceFilterPlatformDataMac::SVGResourceFilterPlatformDataMac):
+ (WebCore::SVGResourceFilterPlatformDataMac::~SVGResourceFilterPlatformDataMac):
+ (WebCore::SVGResourceFilterPlatformDataMac::getCIFilterStack):
+ (WebCore::alphaImageForImage):
+ (WebCore::SVGResourceFilterPlatformDataMac::imageForName):
+ (WebCore::SVGResourceFilterPlatformDataMac::setImageForName):
+ (WebCore::SVGResourceFilterPlatformDataMac::setOutputImage):
+ (WebCore::SVGResourceFilterPlatformDataMac::inputImage):
+
2007-10-28 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Adam Roben.
A86629D209DA2B48009633A5 /* JSMouseEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A86629CC09DA2B47009633A5 /* JSMouseEvent.cpp */; };
A86629D309DA2B48009633A5 /* JSKeyboardEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A86629CD09DA2B47009633A5 /* JSKeyboardEvent.h */; };
A86629D409DA2B48009633A5 /* JSKeyboardEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A86629CE09DA2B47009633A5 /* JSKeyboardEvent.cpp */; };
+ A869385C0CD4831500B666A1 /* SVGResourceFilterPlatformDataMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A869385A0CD4831500B666A1 /* SVGResourceFilterPlatformDataMac.mm */; };
+ A86938D00CD4931300B666A1 /* SVGResourceFilterPlatformDataMac.h in Headers */ = {isa = PBXBuildFile; fileRef = A86938590CD4831500B666A1 /* SVGResourceFilterPlatformDataMac.h */; };
A871D4560A127CBC00B12A68 /* HTMLPlugInElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A871D44C0A127CBC00B12A68 /* HTMLPlugInElement.h */; };
A871D4570A127CBC00B12A68 /* HTMLPlugInElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871D44D0A127CBC00B12A68 /* HTMLPlugInElement.cpp */; };
A871D4580A127CBC00B12A68 /* HTMLParamElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A871D44E0A127CBC00B12A68 /* HTMLParamElement.h */; };
A86629CC09DA2B47009633A5 /* JSMouseEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSMouseEvent.cpp; sourceTree = "<group>"; };
A86629CD09DA2B47009633A5 /* JSKeyboardEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSKeyboardEvent.h; sourceTree = "<group>"; };
A86629CE09DA2B47009633A5 /* JSKeyboardEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSKeyboardEvent.cpp; sourceTree = "<group>"; };
+ A86938590CD4831500B666A1 /* SVGResourceFilterPlatformDataMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SVGResourceFilterPlatformDataMac.h; path = mac/SVGResourceFilterPlatformDataMac.h; sourceTree = "<group>"; };
+ A869385A0CD4831500B666A1 /* SVGResourceFilterPlatformDataMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = SVGResourceFilterPlatformDataMac.mm; path = mac/SVGResourceFilterPlatformDataMac.mm; sourceTree = "<group>"; };
A871D44C0A127CBC00B12A68 /* HTMLPlugInElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLPlugInElement.h; sourceTree = "<group>"; };
A871D44D0A127CBC00B12A68 /* HTMLPlugInElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLPlugInElement.cpp; sourceTree = "<group>"; };
A871D44E0A127CBC00B12A68 /* HTMLParamElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLParamElement.h; sourceTree = "<group>"; };
name = XML;
sourceTree = "<group>";
};
+ A86938690CD487DE00B666A1 /* mac */ = {
+ isa = PBXGroup;
+ children = (
+ A86938590CD4831500B666A1 /* SVGResourceFilterPlatformDataMac.h */,
+ A869385A0CD4831500B666A1 /* SVGResourceFilterPlatformDataMac.mm */,
+ );
+ name = mac;
+ sourceTree = "<group>";
+ };
A8C0F6E9089701F100BA5114 /* ksvg2 */ = {
isa = PBXGroup;
children = (
B2A015960AF6CD53006BCE0E /* svg */ = {
isa = PBXGroup;
children = (
+ A86938690CD487DE00B666A1 /* mac */,
B2A015970AF6CD53006BCE0E /* cg */,
B2E27BDD0B0F2AE500F17C7B /* filters */,
A8C9DD250B4374260097883A /* SVGImage.cpp */,
E15863990CD10B730066E2C9 /* TextCodecUserDefined.h in Headers */,
BC0B36A50CD3C67C00AC7EB5 /* Console.h in Headers */,
BC98543E0CD3D98C00069BC1 /* JSConsole.h in Headers */,
+ A86938D00CD4931300B666A1 /* SVGResourceFilterPlatformDataMac.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
E158639A0CD10B730066E2C9 /* TextCodecUserDefined.cpp in Sources */,
BC0B36A40CD3C67C00AC7EB5 /* Console.cpp in Sources */,
BC98543D0CD3D98B00069BC1 /* JSConsole.cpp in Sources */,
+ A869385C0CD4831500B666A1 /* SVGResourceFilterPlatformDataMac.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/*
Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
namespace WebCore {
FloatPoint3D::FloatPoint3D()
- : m_x(0)
- , m_y(0)
- , m_z(0)
+ : m_x(0.f)
+ , m_y(0.f)
+ , m_z(0.f)
{
}
/*
Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
namespace WebCore {
+SVGResourceFilter::SVGResourceFilter()
+ : m_platformData(createPlatformData())
+ , m_filterBBoxMode(false)
+ , m_effectBBoxMode(false)
+ , m_xBBoxMode(false)
+ , m_yBBoxMode(false)
+{
+}
+
void SVGResourceFilter::clearEffects()
{
m_effects.clear();
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
#ifndef SVGResourceFilter_h
#define SVGResourceFilter_h
+#include "config.h"
+
#if ENABLE(SVG) && ENABLE(SVG_EXPERIMENTAL_FEATURES)
#include "SVGResource.h"
#include "SVGFilterEffect.h"
#include "FloatRect.h"
-#if PLATFORM(CI)
-#include <ApplicationServices/ApplicationServices.h>
-
-#ifdef __OBJC__
-@class CIImage;
-@class CIFilter;
-@class CIContext;
-@class NSArray;
-@class NSMutableDictionary;
-#else
-class CIImage;
-class CIFilter;
-class CIContext;
-class NSArray;
-class NSMutableDictionary;
-#endif
-#endif
-
-#include <wtf/RetainPtr.h>
+#include <wtf/OwnPtr.h>
namespace WebCore {
class GraphicsContext;
class SVGFilterEffect;
+
+class SVGResourceFilterPlatformData {};
class SVGResourceFilter : public SVGResource {
public:
- // To be implemented in platform specific code.
SVGResourceFilter();
- virtual ~SVGResourceFilter();
virtual SVGResourceType resourceType() const { return FilterResourceType; }
// To be implemented in platform specific code.
void prepareFilter(GraphicsContext*&, const FloatRect& bbox);
void applyFilter(GraphicsContext*&, const FloatRect& bbox);
-
-#if PLATFORM(CI)
- CIImage* imageForName(const String&) const;
- void setImageForName(CIImage*, const String&);
-
- void setOutputImage(const SVGFilterEffect*, CIImage*);
- CIImage* inputImage(const SVGFilterEffect*);
-#endif
-
+
+ SVGResourceFilterPlatformData* platformData() { return m_platformData.get(); }
+ const Vector<SVGFilterEffect*>& effects() { return m_effects; }
+
private:
- // FIXME: This should be pulled out of this header and into platform-specific static methods and private data
-#if PLATFORM(CI)
- NSArray* getCIFilterStack(CIImage* inputImage, const FloatRect& bbox);
-
- CIContext* m_filterCIContext;
- CGLayerRef m_filterCGLayer;
- RetainPtr<NSMutableDictionary> m_imagesByName;
-#endif
+ SVGResourceFilterPlatformData* createPlatformData();
+
+ OwnPtr<SVGResourceFilterPlatformData> m_platformData;
bool m_filterBBoxMode : 1;
bool m_effectBBoxMode : 1;
namespace WebCore {
-SVGResourceFilter::SVGResourceFilter()
-{
-}
-
-SVGResourceFilter::~SVGResourceFilter()
+SVGResourceFilterPlatformData* SVGResourceFilter::createPlatformData()
{
+ return 0;
}
void SVGResourceFilter::prepareFilter(GraphicsContext*&, const FloatRect&)
#include "config.h"
#if ENABLE(SVG) && ENABLE(SVG_EXPERIMENTAL_FEATURES)
+#include "SVGResourceFilter.h"
+
#include "AffineTransform.h"
#include "FoundationExtras.h"
#include "GraphicsContext.h"
-#include "SVGResourceFilter.h"
#include "SVGFEBlend.h"
#include "SVGFEColorMatrix.h"
#include "SVGFEOffset.h"
#include "SVGFESpecularLighting.h"
#include "SVGFETile.h"
+#include "SVGResourceFilterPlatformDataMac.h"
#include <QuartzCore/CoreImage.h>
namespace WebCore {
-static const char* const SVGPreviousFilterOutputName = "__previousOutput__";
-
-SVGResourceFilter::SVGResourceFilter()
- : m_filterCIContext(0)
- , m_filterCGLayer(0)
- , m_imagesByName(AdoptNS, [[NSMutableDictionary alloc] init])
- , m_filterBBoxMode(false)
- , m_effectBBoxMode(false)
- , m_xBBoxMode(false)
- , m_yBBoxMode(false)
-{
-}
-
-SVGResourceFilter::~SVGResourceFilter()
+SVGResourceFilterPlatformData* SVGResourceFilter::createPlatformData()
{
- ASSERT(!m_filterCGLayer);
- ASSERT(!m_filterCIContext);
+ return new SVGResourceFilterPlatformDataMac(this);
}
void SVGResourceFilter::prepareFilter(GraphicsContext*& context, const FloatRect& bbox)
if (bbox.isEmpty() || m_effects.isEmpty())
return;
+ SVGResourceFilterPlatformDataMac* platform = static_cast<SVGResourceFilterPlatformDataMac*>(platformData());
+
CGContextRef cgContext = context->platformContext();
// Use of CGBegin/EndTransparencyLayer around this call causes over release
// <http://bugs.webkit.org/show_bug.cgi?id=6947>
// <rdar://problem/4647735>
NSAutoreleasePool* filterContextPool = [[NSAutoreleasePool alloc] init];
- m_filterCIContext = HardRetain([CIContext contextWithCGContext:cgContext options:nil]);
+ platform->m_filterCIContext = HardRetain([CIContext contextWithCGContext:cgContext options:nil]);
[filterContextPool drain];
FloatRect filterRect = filterBBoxForItemBBox(bbox);
float width = filterRect.width();
float height = filterRect.height();
- m_filterCGLayer = [m_filterCIContext createCGLayerWithSize:CGSizeMake(width, height) info:NULL];
+ platform->m_filterCGLayer = [platform->m_filterCIContext createCGLayerWithSize:CGSizeMake(width, height) info:NULL];
- context = new GraphicsContext(CGLayerGetContext(m_filterCGLayer));
+ context = new GraphicsContext(CGLayerGetContext(platform->m_filterCGLayer));
context->save();
context->translate(-filterRect.x(), -filterRect.y());
if (bbox.isEmpty() || m_effects.isEmpty())
return;
+ SVGResourceFilterPlatformDataMac* platform = static_cast<SVGResourceFilterPlatformDataMac*>(platformData());
+
// actually apply the filter effects
- CIImage* inputImage = [CIImage imageWithCGLayer:m_filterCGLayer];
- NSArray* filterStack = getCIFilterStack(inputImage, bbox);
+ CIImage* inputImage = [CIImage imageWithCGLayer:platform->m_filterCGLayer];
+ NSArray* filterStack = platform->getCIFilterStack(inputImage, bbox);
if ([filterStack count]) {
CIImage* outputImage = [[filterStack lastObject] valueForKey:@"outputImage"];
FloatPoint destOrigin = filterRect.location();
filterRect.setLocation(FloatPoint(0.0f, 0.0f));
- [m_filterCIContext drawImage:outputImage atPoint:CGPoint(destOrigin) fromRect:filterRect];
+ [platform->m_filterCIContext drawImage:outputImage atPoint:CGPoint(destOrigin) fromRect:filterRect];
}
}
- CGLayerRelease(m_filterCGLayer);
- m_filterCGLayer = 0;
+ CGLayerRelease(platform->m_filterCGLayer);
+ platform->m_filterCGLayer = 0;
- HardRelease(m_filterCIContext);
- m_filterCIContext = 0;
+ HardRelease(platform->m_filterCIContext);
+ platform->m_filterCIContext = 0;
delete context;
context = 0;
}
-NSArray* SVGResourceFilter::getCIFilterStack(CIImage* inputImage, const FloatRect& bbox)
-{
- NSMutableArray* filterEffects = [NSMutableArray array];
-
- setImageForName(inputImage, "SourceGraphic"); // input
-
- for (unsigned int i = 0; i < m_effects.size(); i++) {
- CIFilter* filter = m_effects[i]->getCIFilter(bbox);
- if (filter)
- [filterEffects addObject:filter];
- }
-
- [m_imagesByName.get() removeAllObjects]; // clean up before next time.
-
- return filterEffects;
-}
-
-CIImage* SVGResourceFilter::imageForName(const String& name) const
-{
- return [m_imagesByName.get() objectForKey:name];
-}
-
-void SVGResourceFilter::setImageForName(CIImage* image, const String& name)
-{
- [m_imagesByName.get() setValue:image forKey:name];
-}
-
-void SVGResourceFilter::setOutputImage(const SVGFilterEffect* filterEffect, CIImage* output)
-{
- if (!filterEffect->result().isEmpty())
- setImageForName(output, filterEffect->result());
-
- setImageForName(output, SVGPreviousFilterOutputName);
-}
-
-static inline CIImage* alphaImageForImage(CIImage* image)
-{
- CIFilter* onlyAlpha = [CIFilter filterWithName:@"CIColorMatrix"];
- CGFloat zero[4] = {0, 0, 0, 0};
- [onlyAlpha setDefaults];
- [onlyAlpha setValue:image forKey:@"inputImage"];
- [onlyAlpha setValue:[CIVector vectorWithValues:zero count:4] forKey:@"inputRVector"];
- [onlyAlpha setValue:[CIVector vectorWithValues:zero count:4] forKey:@"inputGVector"];
- [onlyAlpha setValue:[CIVector vectorWithValues:zero count:4] forKey:@"inputBVector"];
- return [onlyAlpha valueForKey:@"outputImage"];
-}
-
-CIImage* SVGResourceFilter::inputImage(const SVGFilterEffect* filterEffect)
-{
- if (filterEffect->in().isEmpty()) {
- CIImage* inImage = imageForName(SVGPreviousFilterOutputName);
-
- if (!inImage)
- inImage = imageForName("SourceGraphic");
-
- return inImage;
- } else if (filterEffect->in() == "SourceAlpha") {
- CIImage* sourceAlpha = imageForName(filterEffect->in());
-
- if (!sourceAlpha) {
- CIImage* sourceGraphic = imageForName("SourceGraphic");
-
- if (!sourceGraphic)
- return nil;
-
- sourceAlpha = alphaImageForImage(sourceGraphic);
- setImageForName(sourceAlpha, "SourceAlpha");
- }
-
- return sourceAlpha;
- }
-
- return imageForName(filterEffect->in());
-}
-
}
#endif // ENABLE(SVG) ENABLE(SVG_EXPERIMENTAL_FEATURES)
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
/*
Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- 2005 Eric Seidel <eric.seidel@kdemail.net>
-
- This file is part of the KDE project
+ 2005 Eric Seidel <eric@webkit.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
CIFilter* SVGFEBlend::getCIFilter(const FloatRect& bbox) const
{
SVGResourceFilter* svgFilter = filter();
+ SVGResourceFilterPlatformDataMac* filterPlatformData = static_cast<SVGResourceFilterPlatformDataMac*>(svgFilter->platformData());
CIFilter* filter = nil;
BEGIN_BLOCK_OBJC_EXCEPTIONS;
[filter setDefaults];
- CIImage* inputImage = svgFilter->inputImage(this);
+ CIImage* inputImage = filterPlatformData->inputImage(this);
FE_QUARTZ_CHECK_INPUT(inputImage);
[filter setValue:inputImage forKey:@"inputImage"];
- CIImage* backgroundImage = svgFilter->imageForName(in2());
+ CIImage* backgroundImage = filterPlatformData->imageForName(in2());
FE_QUARTZ_CHECK_INPUT(backgroundImage);
[filter setValue:backgroundImage forKey:@"inputBackgroundImage"];
CIFilter* SVGFEColorMatrix::getCIFilter(const FloatRect& bbox) const
{
SVGResourceFilter* svgFilter = filter();
+ SVGResourceFilterPlatformDataMac* filterPlatformData = static_cast<SVGResourceFilterPlatformDataMac*>(svgFilter->platformData());
CIFilter* filter = nil;
BEGIN_BLOCK_OBJC_EXCEPTIONS;
switch (type()) {
LOG_ERROR("Unhandled ColorMatrix type: %i", type());
return nil;
}
- CIImage *inputImage = svgFilter->inputImage(this);
+ CIImage *inputImage = filterPlatformData->inputImage(this);
FE_QUARTZ_CHECK_INPUT(inputImage);
[filter setValue:inputImage forKey:@"inputImage"];
[WKGammaTransferFilter class];
SVGResourceFilter* svgFilter = filter();
+ SVGResourceFilterPlatformDataMac* filterPlatformData = static_cast<SVGResourceFilterPlatformDataMac*>(svgFilter->platformData());
CIFilter* filter = nil;
BEGIN_BLOCK_OBJC_EXCEPTIONS;
filter = [CIFilter filterWithName:@"WKComponentMerge"];
if (!filter)
return nil;
[filter setDefaults];
- CIImage* inputImage = svgFilter->inputImage(this);
+ CIImage* inputImage = filterPlatformData->inputImage(this);
FE_QUARTZ_CHECK_INPUT(inputImage);
[filter setValue:getFunctionFilter(SVG_CHANNEL_R, inputImage) forKey:@"inputFuncR"];
CIFilter* SVGFEComposite::getCIFilter(const FloatRect& bbox) const
{
SVGResourceFilter* svgFilter = filter();
+ SVGResourceFilterPlatformDataMac* filterPlatformData = static_cast<SVGResourceFilterPlatformDataMac*>(svgFilter->platformData());
CIFilter* filter = nil;
BEGIN_BLOCK_OBJC_EXCEPTIONS;
}
[filter setDefaults];
- CIImage* inputImage = svgFilter->inputImage(this);
- CIImage* backgroundImage = svgFilter->imageForName(in2());
+ CIImage* inputImage = filterPlatformData->inputImage(this);
+ CIImage* backgroundImage = filterPlatformData->imageForName(in2());
FE_QUARTZ_CHECK_INPUT(inputImage);
FE_QUARTZ_CHECK_INPUT(backgroundImage);
[filter setValue:inputImage forKey:@"inputImage"];
[WKDiffuseLightingFilter class];
SVGResourceFilter* svgFilter = filter();
+ SVGResourceFilterPlatformDataMac* filterPlatformData = static_cast<SVGResourceFilterPlatformDataMac*>(svgFilter->platformData());
+
CIFilter* filter;
BEGIN_BLOCK_OBJC_EXCEPTIONS;
filter = [CIFilter filterWithName:@"WKDiffuseLighting"];
return nil;
[filter setDefaults];
- CIImage* inputImage = svgFilter->inputImage(this);
+ CIImage* inputImage = filterPlatformData->inputImage(this);
FE_QUARTZ_CHECK_INPUT(inputImage);
CIFilter* normals = getNormalMap(inputImage, surfaceScale());
if (!normals)
CIFilter* SVGFEDisplacementMap::getCIFilter(const FloatRect& bbox) const
{
SVGResourceFilter* svgFilter = filter();
+ SVGResourceFilterPlatformDataMac* filterPlatformData = static_cast<SVGResourceFilterPlatformDataMac*>(svgFilter->platformData());
+
CIFilter* filter = nil;
BEGIN_BLOCK_OBJC_EXCEPTIONS;
[WKDisplacementMapFilter class];
filter = [CIFilter filterWithName:@"WKDisplacementMapFilter"];
[filter setDefaults];
- CIImage* inputImage = svgFilter->inputImage(this);
- CIImage* displacementMap = svgFilter->imageForName(in2());
+ CIImage* inputImage = filterPlatformData->inputImage(this);
+ CIImage* displacementMap = filterPlatformData->imageForName(in2());
FE_QUARTZ_CHECK_INPUT(inputImage);
FE_QUARTZ_CHECK_INPUT(displacementMap);
[filter setValue:inputImage forKey:@"inputImage"];
CIFilter* SVGFEFlood::getCIFilter(const FloatRect& bbox) const
{
SVGResourceFilter* svgFilter = filter();
+ SVGResourceFilterPlatformDataMac* filterPlatformData = static_cast<SVGResourceFilterPlatformDataMac*>(svgFilter->platformData());
CIFilter* filter;
BEGIN_BLOCK_OBJC_EXCEPTIONS;
filter = [CIFilter filterWithName:@"CIConstantColorGenerator"];
#include "BlockExceptions.h"
#include "SVGFEDisplacementMap.h"
#include "SVGResourceFilter.h"
+#include "SVGResourceFilterPlatformDataMac.h"
#include <QuartzCore/CoreImage.h>
#include <wtf/MathExtras.h>
// Macros used by the SVGFE*Cg classes
#define FE_QUARTZ_SETUP_INPUT(name) \
- CIImage* inputImage = svgFilter->inputImage(this); \
+ SVGResourceFilterPlatformDataMac* filterPlatformData = static_cast<SVGResourceFilterPlatformDataMac*>(svgFilter->platformData()); \
+ CIImage* inputImage = filterPlatformData->inputImage(this); \
FE_QUARTZ_CHECK_INPUT(inputImage) \
CIFilter* filter; \
BEGIN_BLOCK_OBJC_EXCEPTIONS; \
return nil;
#define FE_QUARTZ_OUTPUT_RETURN \
- svgFilter->setOutputImage(this, [filter valueForKey:@"outputImage"]); \
+ filterPlatformData->setOutputImage(this, [filter valueForKey:@"outputImage"]); \
return filter; \
END_BLOCK_OBJC_EXCEPTIONS; \
return nil;
return nil;
SVGResourceFilter* svgFilter = filter();
+ SVGResourceFilterPlatformDataMac* filterPlatformData = static_cast<SVGResourceFilterPlatformDataMac*>(svgFilter->platformData());
+
CIFilter* filter;
BEGIN_BLOCK_OBJC_EXCEPTIONS;
CIImage* ciImage = [CIImage imageWithCGImage:cachedImage()->image()->getCGImageRef()];
CIFilter* SVGFEMerge::getCIFilter(const FloatRect& bbox) const
{
SVGResourceFilter* svgFilter = filter();
+ SVGResourceFilterPlatformDataMac* filterPlatformData = static_cast<SVGResourceFilterPlatformDataMac*>(svgFilter->platformData());
+
CIFilter* filter = nil;
BEGIN_BLOCK_OBJC_EXCEPTIONS;
const Vector<String>& inputs = mergeInputs();
- CIImage* previousOutput = svgFilter->inputImage(this);
+ CIImage* previousOutput = filterPlatformData->inputImage(this);
for (unsigned x = 0; x < inputs.size(); x++) {
- CIImage* inputImage = svgFilter->imageForName(inputs[x]);
+ CIImage* inputImage = filterPlatformData->imageForName(inputs[x]);
FE_QUARTZ_CHECK_INPUT(inputImage);
FE_QUARTZ_CHECK_INPUT(previousOutput);
filter = [CIFilter filterWithName:@"CISourceOverCompositing"];
[WKSpecularLightingFilter class];
SVGResourceFilter* svgFilter = filter();
+ SVGResourceFilterPlatformDataMac* filterPlatformData = static_cast<SVGResourceFilterPlatformDataMac*>(svgFilter->platformData());
CIFilter* filter;
BEGIN_BLOCK_OBJC_EXCEPTIONS;
filter = [CIFilter filterWithName:@"WKSpecularLighting"];
[filter setDefaults];
- CIImage* inputImage = svgFilter->inputImage(this);
+ CIImage* inputImage = filterPlatformData->inputImage(this);
FE_QUARTZ_CHECK_INPUT(inputImage);
CIFilter* normals = getNormalMap(inputImage, surfaceScale());
if (!normals)
--- /dev/null
+/*
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SVGResourceFilterPlatformDataMac_h
+#define SVGResourceFilterPlatformDataMac_h
+
+#include "SVGResourceFilter.h"
+
+#include <ApplicationServices/ApplicationServices.h>
+#include <wtf/RetainPtr.h>
+
+@class CIImage;
+@class CIFilter;
+@class CIContext;
+@class NSArray;
+@class NSMutableDictionary;
+
+namespace WebCore {
+ class SVGResourceFilterPlatformDataMac : public SVGResourceFilterPlatformData {
+ public:
+ SVGResourceFilterPlatformDataMac(SVGResourceFilter*);
+ ~SVGResourceFilterPlatformDataMac();
+
+ CIImage* imageForName(const String&) const;
+ void setImageForName(CIImage*, const String&);
+
+ void setOutputImage(const SVGFilterEffect*, CIImage*);
+ CIImage* inputImage(const SVGFilterEffect*);
+
+ NSArray* getCIFilterStack(CIImage* inputImage, const FloatRect& bbox);
+
+ CIContext* m_filterCIContext;
+ CGLayerRef m_filterCGLayer;
+ RetainPtr<NSMutableDictionary> m_imagesByName;
+ SVGResourceFilter* m_filter;
+ };
+}
+
+#endif // SVGResourceFilterPlatformDataMac_h
+
--- /dev/null
+/*
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "SVGResourceFilterPlatformDataMac.h"
+#include <QuartzCore/CoreImage.h>
+
+namespace WebCore {
+
+static const char* const SVGPreviousFilterOutputName = "__previousOutput__";
+
+SVGResourceFilterPlatformDataMac::SVGResourceFilterPlatformDataMac(SVGResourceFilter* filter)
+ : m_filterCIContext(0)
+ , m_filterCGLayer(0)
+ , m_imagesByName(AdoptNS, [[NSMutableDictionary alloc] init])
+ , m_filter(filter)
+{
+}
+
+SVGResourceFilterPlatformDataMac::~SVGResourceFilterPlatformDataMac()
+{
+ ASSERT(!m_filterCGLayer);
+ ASSERT(!m_filterCIContext);
+}
+
+
+NSArray* SVGResourceFilterPlatformDataMac::getCIFilterStack(CIImage* inputImage, const FloatRect& bbox)
+{
+ NSMutableArray* filterEffects = [NSMutableArray array];
+
+ setImageForName(inputImage, "SourceGraphic"); // input
+
+ for (unsigned int i = 0; i < m_filter->effects().size(); i++) {
+ CIFilter* filter = m_filter->effects()[i]->getCIFilter(bbox);
+ if (filter)
+ [filterEffects addObject:filter];
+ }
+
+ [m_imagesByName.get() removeAllObjects]; // clean up before next time.
+
+ return filterEffects;
+}
+
+static inline CIImage* alphaImageForImage(CIImage* image)
+{
+ CIFilter* onlyAlpha = [CIFilter filterWithName:@"CIColorMatrix"];
+ CGFloat zero[4] = {0, 0, 0, 0};
+ [onlyAlpha setDefaults];
+ [onlyAlpha setValue:image forKey:@"inputImage"];
+ [onlyAlpha setValue:[CIVector vectorWithValues:zero count:4] forKey:@"inputRVector"];
+ [onlyAlpha setValue:[CIVector vectorWithValues:zero count:4] forKey:@"inputGVector"];
+ [onlyAlpha setValue:[CIVector vectorWithValues:zero count:4] forKey:@"inputBVector"];
+ return [onlyAlpha valueForKey:@"outputImage"];
+}
+
+CIImage* SVGResourceFilterPlatformDataMac::imageForName(const String& name) const
+{
+ return [m_imagesByName.get() objectForKey:name];
+}
+
+void SVGResourceFilterPlatformDataMac::setImageForName(CIImage* image, const String& name)
+{
+ [m_imagesByName.get() setValue:image forKey:name];
+}
+
+void SVGResourceFilterPlatformDataMac::setOutputImage(const SVGFilterEffect* filterEffect, CIImage* output)
+{
+ if (!filterEffect->result().isEmpty())
+ setImageForName(output, filterEffect->result());
+
+ setImageForName(output, SVGPreviousFilterOutputName);
+}
+
+CIImage* SVGResourceFilterPlatformDataMac::inputImage(const SVGFilterEffect* filterEffect)
+{
+ if (filterEffect->in().isEmpty()) {
+ CIImage* inImage = imageForName(SVGPreviousFilterOutputName);
+
+ if (!inImage)
+ inImage = imageForName("SourceGraphic");
+
+ return inImage;
+ } else if (filterEffect->in() == "SourceAlpha") {
+ CIImage* sourceAlpha = imageForName(filterEffect->in());
+
+ if (!sourceAlpha) {
+ CIImage* sourceGraphic = imageForName("SourceGraphic");
+
+ if (!sourceGraphic)
+ return nil;
+
+ sourceAlpha = alphaImageForImage(sourceGraphic);
+ setImageForName(sourceAlpha, "SourceAlpha");
+ }
+
+ return sourceAlpha;
+ }
+
+ return imageForName(filterEffect->in());
+}
+
+
+}
namespace WebCore {
-SVGResourceFilter::SVGResourceFilter()
-{
-}
-
-SVGResourceFilter::~SVGResourceFilter()
+SVGResourceFilterPlatformData* SVGResourceFilter::createPlatformData()
{
+ return 0;
}
void SVGResourceFilter::prepareFilter(GraphicsContext*&, const FloatRect&)