diff options
Diffstat (limited to 'WebCore/svg/graphics')
132 files changed, 0 insertions, 10493 deletions
diff --git a/WebCore/svg/graphics/SVGImage.cpp b/WebCore/svg/graphics/SVGImage.cpp deleted file mode 100644 index 4427277..0000000 --- a/WebCore/svg/graphics/SVGImage.cpp +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright (C) 2006 Eric Seidel (eric@webkit.org) - * Copyright (C) 2008 Apple, Inc. All rights reserved. - * - * 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 "config.h" -#if ENABLE(SVG) -#include "SVGImage.h" - -#include "CachedPage.h" -#include "DocumentLoader.h" -#include "FloatRect.h" -#include "Frame.h" -#include "FrameLoader.h" -#include "FrameView.h" -#include "GraphicsContext.h" -#include "ImageObserver.h" -#include "NotImplemented.h" -#include "Page.h" -#include "RenderView.h" -#include "ResourceError.h" -#include "SVGDocument.h" -#include "SVGLength.h" -#include "SVGRenderSupport.h" -#include "SVGSVGElement.h" -#include "Settings.h" - -#include "EmptyClients.h" - -namespace WebCore { - -SVGImage::SVGImage(ImageObserver* observer) - : Image(observer) - , m_document(0) - , m_page(0) - , m_frame(0) - , m_frameView(0) -{ -} - -SVGImage::~SVGImage() -{ - if (m_frame) - m_frame->loader()->frameDetached(); // Break both the loader and view references to the frame -} - -void SVGImage::setContainerSize(const IntSize& containerSize) -{ - if (containerSize.width() <= 0 || containerSize.height() <= 0) - return; - - if (!m_frame || !m_frame->document()) - return; - SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_frame->document())->rootElement(); - if (!rootElement) - return; - - rootElement->setContainerSize(containerSize); -} - -bool SVGImage::usesContainerSize() const -{ - if (!m_frame || !m_frame->document()) - return false; - SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_frame->document())->rootElement(); - if (!rootElement) - return false; - - return rootElement->hasSetContainerSize(); -} - -IntSize SVGImage::size() const -{ - if (!m_frame || !m_frame->document()) - return IntSize(); - - SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_frame->document())->rootElement(); - if (!rootElement) - return IntSize(); - - SVGLength width = rootElement->width(); - SVGLength height = rootElement->height(); - - IntSize svgSize; - if (width.unitType() == LengthTypePercentage) - svgSize.setWidth(rootElement->relativeWidthValue()); - else - svgSize.setWidth(static_cast<int>(width.value(rootElement))); - - if (height.unitType() == LengthTypePercentage) - svgSize.setHeight(rootElement->relativeHeightValue()); - else - svgSize.setHeight(static_cast<int>(height.value(rootElement))); - - return svgSize; -} - -bool SVGImage::hasRelativeWidth() const -{ - if (!m_frame || !m_frame->document()) - return false; - SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_frame->document())->rootElement(); - if (!rootElement) - return false; - - return rootElement->width().unitType() == LengthTypePercentage; -} - -bool SVGImage::hasRelativeHeight() const -{ - if (!m_frame || !m_frame->document()) - return false; - SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_frame->document())->rootElement(); - if (!rootElement) - return false; - - return rootElement->height().unitType() == LengthTypePercentage; -} - -void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator compositeOp) -{ - if (!m_frame) - return; - - context->save(); - context->setCompositeOperation(compositeOp); - context->clip(enclosingIntRect(dstRect)); - if (compositeOp != CompositeSourceOver) - context->beginTransparencyLayer(1.0f); - context->translate(dstRect.location().x(), dstRect.location().y()); - context->scale(FloatSize(dstRect.width()/srcRect.width(), dstRect.height()/srcRect.height())); - - if (m_frame->view()->needsLayout()) - m_frame->view()->layout(); - m_frame->view()->paint(context, enclosingIntRect(srcRect)); - - if (compositeOp != CompositeSourceOver) - context->endTransparencyLayer(); - - context->restore(); - - if (imageObserver()) - imageObserver()->didDraw(this); -} - -NativeImagePtr SVGImage::nativeImageForCurrentFrame() -{ - // FIXME: In order to support dynamic SVGs we need to have a way to invalidate this - // frame cache, or better yet, not use a cache for tiled drawing at all, instead - // having a tiled drawing callback (hopefully non-virtual). - if (!m_frameCache) { - m_frameCache.set(ImageBuffer::create(size(), false).release()); - if (!m_frameCache) // failed to allocate image - return 0; - renderSubtreeToImage(m_frameCache.get(), m_frame->contentRenderer()); - } - return m_frameCache->image()->nativeImageForCurrentFrame(); -} - -bool SVGImage::dataChanged(bool allDataReceived) -{ - int length = m_data->size(); - if (!length) // if this was an empty image - return true; - - if (allDataReceived) { - static ChromeClient* dummyChromeClient = new EmptyChromeClient; - static FrameLoaderClient* dummyFrameLoaderClient = new EmptyFrameLoaderClient; - static EditorClient* dummyEditorClient = new EmptyEditorClient; - static ContextMenuClient* dummyContextMenuClient = new EmptyContextMenuClient; - static DragClient* dummyDragClient = new EmptyDragClient; - static InspectorClient* dummyInspectorClient = new EmptyInspectorClient; - - // FIXME: If this SVG ends up loading itself, we'll leak this Frame (and associated DOM & render trees). - // The Cache code does not know about CachedImages holding Frames and won't know to break the cycle. - m_page.set(new Page(dummyChromeClient, dummyContextMenuClient, dummyEditorClient, dummyDragClient, dummyInspectorClient)); - m_page->settings()->setJavaScriptEnabled(false); - m_page->settings()->setPluginsEnabled(false); - - m_frame = Frame::create(m_page.get(), 0, dummyFrameLoaderClient); - m_frameView = new FrameView(m_frame.get()); - m_frameView->deref(); // FIXME: FrameView starts with a refcount of 1 - m_frame->setView(m_frameView.get()); - m_frame->init(); - ResourceRequest fakeRequest(KURL("")); - m_frame->loader()->load(fakeRequest); // Make sure the DocumentLoader is created - m_frame->loader()->cancelContentPolicyCheck(); // cancel any policy checks - m_frame->loader()->commitProvisionalLoad(0); - m_frame->loader()->setResponseMIMEType("image/svg+xml"); - m_frame->loader()->begin(KURL()); // create the empty document - m_frame->loader()->write(m_data->data(), m_data->size()); - m_frame->loader()->end(); - m_frameView->setTransparent(true); // SVG Images are transparent. - } - return m_frameView; -} - -} - -#endif // ENABLE(SVG) diff --git a/WebCore/svg/graphics/SVGImage.h b/WebCore/svg/graphics/SVGImage.h deleted file mode 100644 index 994cf91..0000000 --- a/WebCore/svg/graphics/SVGImage.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2006 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 SVGImage_h -#define SVGImage_h - -#if ENABLE(SVG) - -#include "Image.h" -#include "ImageBuffer.h" -#include "IntSize.h" -#include <wtf/OwnPtr.h> - -namespace WebCore { - - class SVGDocument; - class Frame; - class FrameView; - class Page; - - class SVGImage : public Image { - public: - static PassRefPtr<SVGImage> create(ImageObserver* observer) - { - return adoptRef(new SVGImage(observer)); - } - ~SVGImage(); - - virtual void setContainerSize(const IntSize&); - virtual bool usesContainerSize() const; - virtual bool hasRelativeWidth() const; - virtual bool hasRelativeHeight() const; - - virtual IntSize size() const; - - virtual bool dataChanged(bool allDataReceived); - - // FIXME: SVGImages are underreporting decoded sizes and will be unable - // to prune because these functions are not implemented yet. - virtual void destroyDecodedData(bool incremental = false, bool preserveNearbyFrames = false) { } - virtual unsigned decodedSize() const { return 0; } - - virtual NativeImagePtr frameAtIndex(size_t) { return 0; } - -private: - SVGImage(ImageObserver*); - virtual void draw(GraphicsContext*, const FloatRect& fromRect, const FloatRect& toRect, CompositeOperator); - - virtual NativeImagePtr nativeImageForCurrentFrame(); - - SVGDocument* m_document; - OwnPtr<Page> m_page; - RefPtr<Frame> m_frame; - RefPtr<FrameView> m_frameView; - IntSize m_minSize; - OwnPtr<ImageBuffer> m_frameCache; - }; -} - -#endif // ENABLE(SVG) - -#endif diff --git a/WebCore/svg/graphics/SVGPaintServer.cpp b/WebCore/svg/graphics/SVGPaintServer.cpp deleted file mode 100644 index 0240532..0000000 --- a/WebCore/svg/graphics/SVGPaintServer.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> - * 2007 Rob Buis <buis@kde.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 "config.h" - -#if ENABLE(SVG) -#include "SVGPaintServer.h" - -#include "GraphicsContext.h" -#include "RenderObject.h" -#include "RenderStyle.h" -#include "SVGPaintServerSolid.h" -#include "SVGStyledElement.h" -#include "SVGURIReference.h" - -namespace WebCore { - -SVGPaintServer::SVGPaintServer() -{ -} - -SVGPaintServer::~SVGPaintServer() -{ -} - -TextStream& operator<<(TextStream& ts, const SVGPaintServer& paintServer) -{ - return paintServer.externalRepresentation(ts); -} - -SVGPaintServer* getPaintServerById(Document* document, const AtomicString& id) -{ - SVGResource* resource = getResourceById(document, id); - if (resource && resource->isPaintServer()) - return static_cast<SVGPaintServer*>(resource); - - return 0; -} - -SVGPaintServerSolid* SVGPaintServer::sharedSolidPaintServer() -{ - static SVGPaintServerSolid* _sharedSolidPaintServer = SVGPaintServerSolid::create().releaseRef(); - - return _sharedSolidPaintServer; -} - -SVGPaintServer* SVGPaintServer::fillPaintServer(const RenderStyle* style, const RenderObject* item) -{ - if (!style->svgStyle()->hasFill()) - return 0; - - SVGPaint* fill = style->svgStyle()->fillPaint(); - - SVGPaintServer* fillPaintServer = 0; - SVGPaint::SVGPaintType paintType = fill->paintType(); - if (paintType == SVGPaint::SVG_PAINTTYPE_URI || - paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR) { - AtomicString id(SVGURIReference::getTarget(fill->uri())); - fillPaintServer = getPaintServerById(item->document(), id); - - SVGElement* svgElement = static_cast<SVGElement*>(item->element()); - ASSERT(svgElement && svgElement->document() && svgElement->isStyled()); - - if (item->isRenderPath() && fillPaintServer) - fillPaintServer->addClient(static_cast<SVGStyledElement*>(svgElement)); - else if (!fillPaintServer && paintType == SVGPaint::SVG_PAINTTYPE_URI) - svgElement->document()->accessSVGExtensions()->addPendingResource(id, static_cast<SVGStyledElement*>(svgElement)); - } - if (paintType != SVGPaint::SVG_PAINTTYPE_URI && !fillPaintServer) { - fillPaintServer = sharedSolidPaintServer(); - SVGPaintServerSolid* fillPaintServerSolid = static_cast<SVGPaintServerSolid*>(fillPaintServer); - if (paintType == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR) - fillPaintServerSolid->setColor(style->color()); - else - fillPaintServerSolid->setColor(fill->color()); - // FIXME: Ideally invalid colors would never get set on the RenderStyle and this could turn into an ASSERT - if (!fillPaintServerSolid->color().isValid()) - fillPaintServer = 0; - } - if (!fillPaintServer) { - // default value (black), see bug 11017 - fillPaintServer = sharedSolidPaintServer(); - static_cast<SVGPaintServerSolid*>(fillPaintServer)->setColor(Color::black); - } - return fillPaintServer; -} - -SVGPaintServer* SVGPaintServer::strokePaintServer(const RenderStyle* style, const RenderObject* item) -{ - if (!style->svgStyle()->hasStroke()) - return 0; - - SVGPaint* stroke = style->svgStyle()->strokePaint(); - - SVGPaintServer* strokePaintServer = 0; - SVGPaint::SVGPaintType paintType = stroke->paintType(); - if (paintType == SVGPaint::SVG_PAINTTYPE_URI || - paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR) { - AtomicString id(SVGURIReference::getTarget(stroke->uri())); - strokePaintServer = getPaintServerById(item->document(), id); - - SVGElement* svgElement = static_cast<SVGElement*>(item->element()); - ASSERT(svgElement && svgElement->document() && svgElement->isStyled()); - - if (item->isRenderPath() && strokePaintServer) - strokePaintServer->addClient(static_cast<SVGStyledElement*>(svgElement)); - else if (!strokePaintServer && paintType == SVGPaint::SVG_PAINTTYPE_URI) - svgElement->document()->accessSVGExtensions()->addPendingResource(id, static_cast<SVGStyledElement*>(svgElement)); - } - if (paintType != SVGPaint::SVG_PAINTTYPE_URI && !strokePaintServer) { - strokePaintServer = sharedSolidPaintServer(); - SVGPaintServerSolid* strokePaintServerSolid = static_cast<SVGPaintServerSolid*>(strokePaintServer); - if (paintType == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR) - strokePaintServerSolid->setColor(style->color()); - else - strokePaintServerSolid->setColor(stroke->color()); - // FIXME: Ideally invalid colors would never get set on the RenderStyle and this could turn into an ASSERT - if (!strokePaintServerSolid->color().isValid()) - strokePaintServer = 0; - } - - return strokePaintServer; -} - -void applyStrokeStyleToContext(GraphicsContext* context, RenderStyle* style, const RenderObject* object) -{ - context->setStrokeThickness(SVGRenderStyle::cssPrimitiveToLength(object, style->svgStyle()->strokeWidth(), 1.0f)); - context->setLineCap(style->svgStyle()->capStyle()); - context->setLineJoin(style->svgStyle()->joinStyle()); - if (style->svgStyle()->joinStyle() == MiterJoin) - context->setMiterLimit(style->svgStyle()->strokeMiterLimit()); - - const DashArray& dashes = dashArrayFromRenderingStyle(object->style()); - float dashOffset = SVGRenderStyle::cssPrimitiveToLength(object, style->svgStyle()->strokeDashOffset(), 0.0f); - context->setLineDash(dashes, dashOffset); -} - -DashArray dashArrayFromRenderingStyle(const RenderStyle* style) -{ - DashArray array; - - CSSValueList* dashes = style->svgStyle()->strokeDashArray(); - if (dashes) { - CSSPrimitiveValue* dash = 0; - unsigned long len = dashes->length(); - for (unsigned long i = 0; i < len; i++) { - dash = static_cast<CSSPrimitiveValue*>(dashes->itemWithoutBoundsCheck(i)); - if (!dash) - continue; - - array.append((float) dash->computeLengthFloat(const_cast<RenderStyle*>(style))); - } - } - - return array; -} - -} // namespace WebCore - -#endif diff --git a/WebCore/svg/graphics/SVGPaintServer.h b/WebCore/svg/graphics/SVGPaintServer.h deleted file mode 100644 index 0d37e9f..0000000 --- a/WebCore/svg/graphics/SVGPaintServer.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.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 SVGPaintServer_h -#define SVGPaintServer_h - -#if ENABLE(SVG) - -#include "DashArray.h" -#include "SVGResource.h" - -#if PLATFORM(CG) -#include <ApplicationServices/ApplicationServices.h> -#endif - -namespace WebCore { - - enum SVGPaintServerType { - // Painting mode - SolidPaintServer = 0, - PatternPaintServer = 1, - LinearGradientPaintServer = 2, - RadialGradientPaintServer = 3 - }; - - enum SVGPaintTargetType { - // Target mode - ApplyToFillTargetType = 1, - ApplyToStrokeTargetType = 2 - }; - - class GraphicsContext; - class RenderObject; - class RenderStyle; - class SVGPaintServerSolid; - - class SVGPaintServer : public SVGResource { - public: - virtual ~SVGPaintServer(); - - virtual SVGResourceType resourceType() const { return PaintServerResourceType; } - - virtual SVGPaintServerType type() const = 0; - virtual TextStream& externalRepresentation(TextStream&) const = 0; - - // To be implemented in platform specific code. - virtual void draw(GraphicsContext*&, const RenderObject*, SVGPaintTargetType) const; - virtual void teardown(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText = false) const; - virtual void renderPath(GraphicsContext*&, const RenderObject*, SVGPaintTargetType) const; - - virtual bool setup(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText = false) const = 0; - - static SVGPaintServer* strokePaintServer(const RenderStyle*, const RenderObject*); - static SVGPaintServer* fillPaintServer(const RenderStyle*, const RenderObject*); - static SVGPaintServerSolid* sharedSolidPaintServer(); - - protected: -#if PLATFORM(CG) - void strokePath(CGContextRef, const RenderObject*) const; - void clipToStrokePath(CGContextRef, const RenderObject*) const; - void fillPath(CGContextRef, const RenderObject*) const; - void clipToFillPath(CGContextRef, const RenderObject*) const; -#endif - - protected: - SVGPaintServer(); - }; - - TextStream& operator<<(TextStream&, const SVGPaintServer&); - - SVGPaintServer* getPaintServerById(Document*, const AtomicString&); - - void applyStrokeStyleToContext(GraphicsContext*, RenderStyle*, const RenderObject*); - DashArray dashArrayFromRenderingStyle(const RenderStyle* style); -} // namespace WebCore - -#endif - -#endif // SVGPaintServer_h diff --git a/WebCore/svg/graphics/SVGPaintServerGradient.cpp b/WebCore/svg/graphics/SVGPaintServerGradient.cpp deleted file mode 100644 index 58dd6bf..0000000 --- a/WebCore/svg/graphics/SVGPaintServerGradient.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.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 "config.h" - -#if ENABLE(SVG) -#include "SVGPaintServerGradient.h" - -#include "SVGGradientElement.h" -#include "SVGRenderTreeAsText.h" - -namespace WebCore { - -TextStream& operator<<(TextStream& ts, GradientSpreadMethod m) -{ - switch (m) { - case SpreadMethodPad: - ts << "PAD"; break; - case SpreadMethodRepeat: - ts << "REPEAT"; break; - case SpreadMethodReflect: - ts << "REFLECT"; break; - } - - return ts; -} - -TextStream& operator<<(TextStream& ts, const Vector<SVGGradientStop>& l) -{ - ts << "["; - for (Vector<SVGGradientStop>::const_iterator it = l.begin(); it != l.end(); ++it) { - ts << "(" << it->first << "," << it->second << ")"; - if (it + 1 != l.end()) - ts << ", "; - } - ts << "]"; - return ts; -} - -SVGPaintServerGradient::SVGPaintServerGradient(const SVGGradientElement* owner) - : m_spreadMethod(SpreadMethodPad) - , m_boundingBoxMode(true) - , m_ownerElement(owner) - -#if PLATFORM(CG) - , m_stopsCache(0) - , m_shadingCache(0) - , m_savedContext(0) - , m_imageBuffer(0) -#endif -{ - ASSERT(owner); -} - -SVGPaintServerGradient::~SVGPaintServerGradient() -{ -#if PLATFORM(CG) - CGShadingRelease(m_shadingCache); -#endif -} - -const Vector<SVGGradientStop>& SVGPaintServerGradient::gradientStops() const -{ - return m_stops; -} - -void SVGPaintServerGradient::setGradientStops(const Vector<SVGGradientStop>& stops) -{ - m_stops = stops; -} - -GradientSpreadMethod SVGPaintServerGradient::spreadMethod() const -{ - return m_spreadMethod; -} - -void SVGPaintServerGradient::setGradientSpreadMethod(const GradientSpreadMethod& method) -{ - m_spreadMethod = method; -} - -bool SVGPaintServerGradient::boundingBoxMode() const -{ - return m_boundingBoxMode; -} - -void SVGPaintServerGradient::setBoundingBoxMode(bool mode) -{ - m_boundingBoxMode = mode; -} - -AffineTransform SVGPaintServerGradient::gradientTransform() const -{ - return m_gradientTransform; -} - -void SVGPaintServerGradient::setGradientTransform(const AffineTransform& transform) -{ - m_gradientTransform = transform; -} - -TextStream& SVGPaintServerGradient::externalRepresentation(TextStream& ts) const -{ - // Gradients/patterns aren't setup, until they are used for painting. Work around that fact. - m_ownerElement->buildGradient(); - - // abstract, don't stream type - ts << "[stops=" << gradientStops() << "]"; - if (spreadMethod() != SpreadMethodPad) - ts << "[method=" << spreadMethod() << "]"; - if (!boundingBoxMode()) - ts << " [bounding box mode=" << boundingBoxMode() << "]"; - if (!gradientTransform().isIdentity()) - ts << " [transform=" << gradientTransform() << "]"; - - return ts; -} - -} // namespace WebCore - -#endif diff --git a/WebCore/svg/graphics/SVGPaintServerGradient.h b/WebCore/svg/graphics/SVGPaintServerGradient.h deleted file mode 100644 index 99dac8e..0000000 --- a/WebCore/svg/graphics/SVGPaintServerGradient.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.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 SVGPaintServerGradient_h -#define SVGPaintServerGradient_h - -#if ENABLE(SVG) - -#include "AffineTransform.h" -#include "Color.h" -#include "GraphicsContext.h" -#include "SVGPaintServer.h" - -#include <wtf/RefCounted.h> -#include <wtf/RefPtr.h> - -#if PLATFORM(QT) -#include <qglobal.h> -QT_BEGIN_NAMESPACE -class QGradient; -QT_END_NAMESPACE -#endif - -namespace WebCore { - - class ImageBuffer; - class SVGGradientElement; - -#if PLATFORM(CG) - typedef std::pair<CGFloat, Color> SVGGradientStop; -#else - typedef std::pair<float, Color> SVGGradientStop; -#endif - - class SVGPaintServerGradient : public SVGPaintServer { - public: - virtual ~SVGPaintServerGradient(); - - const Vector<SVGGradientStop>& gradientStops() const; - void setGradientStops(const Vector<SVGGradientStop>&); - - GradientSpreadMethod spreadMethod() const; - void setGradientSpreadMethod(const GradientSpreadMethod&); - - // Gradient start and end points are percentages when used in boundingBox mode. - // For instance start point with value (0,0) is top-left and end point with - // value (100, 100) is bottom-right. BoundingBox mode is enabled by default. - bool boundingBoxMode() const; - void setBoundingBoxMode(bool mode = true); - - AffineTransform gradientTransform() const; - void setGradientTransform(const AffineTransform&); - - virtual TextStream& externalRepresentation(TextStream&) const; - - virtual bool setup(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText) const; -#if PLATFORM(CG) - virtual void teardown(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText) const; - virtual void renderPath(GraphicsContext*&, const RenderObject*, SVGPaintTargetType) const; - - virtual void invalidate(); - - // Helpers - void updateQuartzGradientStopsCache(const Vector<SVGGradientStop>&); - void updateQuartzGradientCache(const SVGPaintServerGradient*); - void handleBoundingBoxModeAndGradientTransformation(GraphicsContext*, const FloatRect& targetRect) const; -#endif - -#if PLATFORM(QT) - protected: - void fillColorArray(QGradient&, const Vector<SVGGradientStop>&, float opacity) const; - virtual QGradient setupGradient(GraphicsContext*&, const RenderObject*) const = 0; -#endif - - protected: - SVGPaintServerGradient(const SVGGradientElement* owner); - - private: - Vector<SVGGradientStop> m_stops; - GradientSpreadMethod m_spreadMethod; - bool m_boundingBoxMode; - AffineTransform m_gradientTransform; - const SVGGradientElement* m_ownerElement; - -#if PLATFORM(CG) - public: - typedef struct { - CGFloat colorArray[4]; - CGFloat offset; - CGFloat previousDeltaInverse; - } QuartzGradientStop; - - struct SharedStopCache : public RefCounted<SharedStopCache> { - public: - static PassRefPtr<SharedStopCache> create() { return adoptRef(new SharedStopCache); } - - Vector<QuartzGradientStop> m_stops; - - private: - SharedStopCache() { } - }; - - RefPtr<SharedStopCache> m_stopsCache; - - CGShadingRef m_shadingCache; - mutable GraphicsContext* m_savedContext; - mutable ImageBuffer* m_imageBuffer; -#endif - }; - - inline SVGGradientStop makeGradientStop(float offset, const Color& color) - { - return std::make_pair(offset, color); - } - -} // namespace WebCore - -#endif - -#endif // SVGPaintServerGradient_h diff --git a/WebCore/svg/graphics/SVGPaintServerLinearGradient.cpp b/WebCore/svg/graphics/SVGPaintServerLinearGradient.cpp deleted file mode 100644 index 08db2d2..0000000 --- a/WebCore/svg/graphics/SVGPaintServerLinearGradient.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.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 "config.h" - -#if ENABLE(SVG) -#include "SVGPaintServerLinearGradient.h" -#include "SVGRenderTreeAsText.h" - -namespace WebCore { - -SVGPaintServerLinearGradient::SVGPaintServerLinearGradient(const SVGGradientElement* owner) - : SVGPaintServerGradient(owner) -{ -} - -SVGPaintServerLinearGradient::~SVGPaintServerLinearGradient() -{ -} - -FloatPoint SVGPaintServerLinearGradient::gradientStart() const -{ - return m_start; -} - -void SVGPaintServerLinearGradient::setGradientStart(const FloatPoint& start) -{ - m_start = start; -} - -FloatPoint SVGPaintServerLinearGradient::gradientEnd() const -{ - return m_end; -} - -void SVGPaintServerLinearGradient::setGradientEnd(const FloatPoint& end) -{ - m_end = end; -} - -TextStream& SVGPaintServerLinearGradient::externalRepresentation(TextStream& ts) const -{ - ts << "[type=LINEAR-GRADIENT] "; - SVGPaintServerGradient::externalRepresentation(ts); - ts << " [start=" << gradientStart() << "]" - << " [end=" << gradientEnd() << "]"; - return ts; -} - -} // namespace WebCore - -#endif diff --git a/WebCore/svg/graphics/SVGPaintServerLinearGradient.h b/WebCore/svg/graphics/SVGPaintServerLinearGradient.h deleted file mode 100644 index 4b7da32..0000000 --- a/WebCore/svg/graphics/SVGPaintServerLinearGradient.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.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 SVGPaintServerLinearGradient_h -#define SVGPaintServerLinearGradient_h - -#if ENABLE(SVG) - -#include "FloatPoint.h" -#include "SVGPaintServerGradient.h" - -namespace WebCore { - - class SVGPaintServerLinearGradient : public SVGPaintServerGradient { - public: - static PassRefPtr<SVGPaintServerLinearGradient> create(const SVGGradientElement* owner) { return adoptRef(new SVGPaintServerLinearGradient(owner)); } - virtual ~SVGPaintServerLinearGradient(); - - virtual SVGPaintServerType type() const { return LinearGradientPaintServer; } - - FloatPoint gradientStart() const; - void setGradientStart(const FloatPoint&); - - FloatPoint gradientEnd() const; - void setGradientEnd(const FloatPoint&); - - virtual TextStream& externalRepresentation(TextStream&) const; - -#if PLATFORM(QT) - virtual QGradient setupGradient(GraphicsContext*&, const RenderObject*) const; -#endif - - private: - SVGPaintServerLinearGradient(const SVGGradientElement* owner); - - FloatPoint m_start; - FloatPoint m_end; - }; - -} // namespace WebCore - -#endif - -#endif // SVGPaintServerLinearGradient_h diff --git a/WebCore/svg/graphics/SVGPaintServerPattern.cpp b/WebCore/svg/graphics/SVGPaintServerPattern.cpp deleted file mode 100644 index c0e5b07..0000000 --- a/WebCore/svg/graphics/SVGPaintServerPattern.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.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 "config.h" - -#if ENABLE(SVG) -#include "SVGPaintServerPattern.h" - -#include "ImageBuffer.h" -#include "SVGPatternElement.h" -#include "SVGRenderTreeAsText.h" - -using namespace std; - -namespace WebCore { - -SVGPaintServerPattern::SVGPaintServerPattern(const SVGPatternElement* owner) - : m_ownerElement(owner) -#if PLATFORM(CG) - , m_patternSpace(0) - , m_pattern(0) -#endif -{ - ASSERT(owner); -} - -SVGPaintServerPattern::~SVGPaintServerPattern() -{ -#if PLATFORM(CG) - CGPatternRelease(m_pattern); - CGColorSpaceRelease(m_patternSpace); -#endif -} - -FloatRect SVGPaintServerPattern::patternBoundaries() const -{ - return m_patternBoundaries; -} - -void SVGPaintServerPattern::setPatternBoundaries(const FloatRect& rect) -{ - m_patternBoundaries = rect; -} - -ImageBuffer* SVGPaintServerPattern::tile() const -{ - return m_tile.get(); -} - -void SVGPaintServerPattern::setTile(auto_ptr<ImageBuffer> tile) -{ - m_tile.set(tile.release()); -} - -AffineTransform SVGPaintServerPattern::patternTransform() const -{ - return m_patternTransform; -} - -void SVGPaintServerPattern::setPatternTransform(const AffineTransform& transform) -{ - m_patternTransform = transform; -} - -TextStream& SVGPaintServerPattern::externalRepresentation(TextStream& ts) const -{ - // Gradients/patterns aren't setup, until they are used for painting. Work around that fact. - m_ownerElement->buildPattern(FloatRect(0.0f, 0.0f, 1.0f, 1.0f)); - - ts << "[type=PATTERN]" - << " [bbox=" << patternBoundaries() << "]"; - if (!patternTransform().isIdentity()) - ts << " [pattern transform=" << patternTransform() << "]"; - return ts; -} - -} // namespace WebCore - -#endif diff --git a/WebCore/svg/graphics/SVGPaintServerPattern.h b/WebCore/svg/graphics/SVGPaintServerPattern.h deleted file mode 100644 index 65b28e9..0000000 --- a/WebCore/svg/graphics/SVGPaintServerPattern.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.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 SVGPaintServerPattern_h -#define SVGPaintServerPattern_h - -#if ENABLE(SVG) - -#include "AffineTransform.h" -#include "FloatRect.h" -#include "SVGPaintServer.h" - -#include <memory> - -#include <wtf/OwnPtr.h> - -namespace WebCore { - - class GraphicsContext; - class ImageBuffer; - class SVGPatternElement; - - class SVGPaintServerPattern : public SVGPaintServer { - public: - static PassRefPtr<SVGPaintServerPattern> create(const SVGPatternElement* owner) { return adoptRef(new SVGPaintServerPattern(owner)); } - - virtual ~SVGPaintServerPattern(); - - virtual SVGPaintServerType type() const { return PatternPaintServer; } - - // Pattern boundaries - void setPatternBoundaries(const FloatRect&); - FloatRect patternBoundaries() const; - - ImageBuffer* tile() const; - void setTile(std::auto_ptr<ImageBuffer>); - - AffineTransform patternTransform() const; - void setPatternTransform(const AffineTransform&); - - virtual TextStream& externalRepresentation(TextStream&) const; - - virtual bool setup(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText) const; -#if PLATFORM(CG) || PLATFORM(QT) - virtual void teardown(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText) const; -#endif - - private: - SVGPaintServerPattern(const SVGPatternElement*); - - OwnPtr<ImageBuffer> m_tile; - const SVGPatternElement* m_ownerElement; - AffineTransform m_patternTransform; - FloatRect m_patternBoundaries; - -#if PLATFORM(CG) - mutable CGColorSpaceRef m_patternSpace; - mutable CGPatternRef m_pattern; -#endif - }; - -} // namespace WebCore - -#endif - -#endif // SVGPaintServerPattern_h diff --git a/WebCore/svg/graphics/SVGPaintServerRadialGradient.cpp b/WebCore/svg/graphics/SVGPaintServerRadialGradient.cpp deleted file mode 100644 index a795ab5..0000000 --- a/WebCore/svg/graphics/SVGPaintServerRadialGradient.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.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 "config.h" - -#if ENABLE(SVG) -#include "SVGPaintServerRadialGradient.h" -#include "SVGRenderTreeAsText.h" - -namespace WebCore { - -SVGPaintServerRadialGradient::SVGPaintServerRadialGradient(const SVGGradientElement* owner) - : SVGPaintServerGradient(owner) - , m_radius(0.0f) -{ -} - -SVGPaintServerRadialGradient::~SVGPaintServerRadialGradient() -{ -} - - -FloatPoint SVGPaintServerRadialGradient::gradientCenter() const -{ - return m_center; -} - -void SVGPaintServerRadialGradient::setGradientCenter(const FloatPoint& center) -{ - m_center = center; -} - -FloatPoint SVGPaintServerRadialGradient::gradientFocal() const -{ - return m_focal; -} - -void SVGPaintServerRadialGradient::setGradientFocal(const FloatPoint& focal) -{ - m_focal = focal; -} - -float SVGPaintServerRadialGradient::gradientRadius() const -{ - return m_radius; -} - -void SVGPaintServerRadialGradient::setGradientRadius(float radius) -{ - m_radius = radius; -} - -TextStream& SVGPaintServerRadialGradient::externalRepresentation(TextStream& ts) const -{ - ts << "[type=RADIAL-GRADIENT] "; - SVGPaintServerGradient::externalRepresentation(ts); - ts << " [center=" << gradientCenter() << "]" - << " [focal=" << gradientFocal() << "]" - << " [radius=" << gradientRadius() << "]"; - return ts; -} - -} // namespace WebCore - -#endif diff --git a/WebCore/svg/graphics/SVGPaintServerRadialGradient.h b/WebCore/svg/graphics/SVGPaintServerRadialGradient.h deleted file mode 100644 index 265f76b..0000000 --- a/WebCore/svg/graphics/SVGPaintServerRadialGradient.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.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 SVGPaintServerRadialGradient_h -#define SVGPaintServerRadialGradient_h - -#if ENABLE(SVG) - -#include "FloatPoint.h" -#include "SVGPaintServerGradient.h" - -namespace WebCore { - - class SVGPaintServerRadialGradient : public SVGPaintServerGradient { - public: - static PassRefPtr<SVGPaintServerRadialGradient> create(const SVGGradientElement* owner) { return adoptRef(new SVGPaintServerRadialGradient(owner)); } - virtual ~SVGPaintServerRadialGradient(); - - virtual SVGPaintServerType type() const { return RadialGradientPaintServer; } - - FloatPoint gradientCenter() const; - void setGradientCenter(const FloatPoint&); - - FloatPoint gradientFocal() const; - void setGradientFocal(const FloatPoint&); - - float gradientRadius() const; - void setGradientRadius(float); - - virtual TextStream& externalRepresentation(TextStream&) const; - -#if PLATFORM(QT) - virtual QGradient setupGradient(GraphicsContext*&, const RenderObject*) const; -#endif - - private: - SVGPaintServerRadialGradient(const SVGGradientElement* owner); - - float m_radius; - FloatPoint m_center; - FloatPoint m_focal; - }; - -} // namespace WebCore - -#endif - -#endif // SVGPaintServerRadialGradient_h diff --git a/WebCore/svg/graphics/SVGPaintServerSolid.cpp b/WebCore/svg/graphics/SVGPaintServerSolid.cpp deleted file mode 100644 index cb58a3a..0000000 --- a/WebCore/svg/graphics/SVGPaintServerSolid.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.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 "config.h" - -#if ENABLE(SVG) -#include "SVGPaintServerSolid.h" -#include "SVGRenderTreeAsText.h" - -namespace WebCore { - -SVGPaintServerSolid::SVGPaintServerSolid() -{ -} - -SVGPaintServerSolid::~SVGPaintServerSolid() -{ -} - -Color SVGPaintServerSolid::color() const -{ - return m_color; -} - -void SVGPaintServerSolid::setColor(const Color& color) -{ - m_color = color; -} - -TextStream& SVGPaintServerSolid::externalRepresentation(TextStream& ts) const -{ - ts << "[type=SOLID]" - << " [color="<< color() << "]"; - return ts; -} - -} // namespace WebCore - -#endif diff --git a/WebCore/svg/graphics/SVGPaintServerSolid.h b/WebCore/svg/graphics/SVGPaintServerSolid.h deleted file mode 100644 index 0166c87..0000000 --- a/WebCore/svg/graphics/SVGPaintServerSolid.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.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 SVGPaintServerSolid_h -#define SVGPaintServerSolid_h - -#if ENABLE(SVG) - -#include "Color.h" -#include "SVGPaintServer.h" - -namespace WebCore { - - class SVGPaintServerSolid : public SVGPaintServer { - public: - static PassRefPtr<SVGPaintServerSolid> create() { return adoptRef(new SVGPaintServerSolid); } - virtual ~SVGPaintServerSolid(); - - virtual SVGPaintServerType type() const { return SolidPaintServer; } - - Color color() const; - void setColor(const Color&); - - virtual TextStream& externalRepresentation(TextStream&) const; - - virtual bool setup(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText) const; - - private: - SVGPaintServerSolid(); - - Color m_color; - }; - -} // namespace WebCore - -#endif - -#endif // SVGPaintServerSolid_h diff --git a/WebCore/svg/graphics/SVGResource.cpp b/WebCore/svg/graphics/SVGResource.cpp deleted file mode 100644 index 10d6648..0000000 --- a/WebCore/svg/graphics/SVGResource.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (C) 2006, 2008 Nikolas Zimmermann <zimmermann@kde.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 "config.h" - -#if ENABLE(SVG) -#include "SVGResource.h" - -#include "RenderPath.h" -#include "SVGElement.h" -#include "SVGStyledElement.h" - -namespace WebCore { - -SVGResource::SVGResource() -{ -} - -struct ResourceSet { - ResourceSet() - { - for (int i = 0; i < _ResourceTypeCount; i++) - resources[i] = 0; - } - SVGResource* resources[_ResourceTypeCount]; -}; - -static HashMap<SVGStyledElement*, ResourceSet*>& clientMap() { - static HashMap<SVGStyledElement*, ResourceSet*> map; - return map; -} - -SVGResource::~SVGResource() -{ - int type = -1; - HashSet<SVGStyledElement*>::iterator itr = m_clients.begin(); - - for (; type < 0 && itr != m_clients.end(); ++itr) { - ResourceSet* target = clientMap().get(*itr); - if (!target) - continue; - - for (int i = 0; i < _ResourceTypeCount; i++) { - if (target->resources[i] != this) - continue; - type = i; - target->resources[i] = 0; - break; - } - } - - if (type < 0) - return; - - for (; itr != m_clients.end(); ++itr) { - ResourceSet* target = clientMap().get(*itr); - if (!target) - continue; - - if (target->resources[type] == this) - target->resources[type] = 0; - } -} - -void SVGResource::invalidate() -{ - HashSet<SVGStyledElement*>::const_iterator it = m_clients.begin(); - const HashSet<SVGStyledElement*>::const_iterator end = m_clients.end(); - - for (; it != end; ++it) { - SVGStyledElement* cur = *it; - - if (cur->renderer()) - cur->renderer()->setNeedsLayout(true); - - cur->invalidateResourcesInAncestorChain(); - } -} - -void SVGResource::invalidateClients(HashSet<SVGStyledElement*> clients) -{ - HashSet<SVGStyledElement*>::const_iterator it = clients.begin(); - const HashSet<SVGStyledElement*>::const_iterator end = clients.end(); - - for (; it != end; ++it) { - SVGStyledElement* cur = *it; - - if (cur->renderer()) - cur->renderer()->setNeedsLayout(true); - - cur->invalidateResourcesInAncestorChain(); - } -} - -void SVGResource::removeClient(SVGStyledElement* item) -{ - HashMap<SVGStyledElement*, ResourceSet*>::iterator resourcePtr = clientMap().find(item); - if (resourcePtr == clientMap().end()) - return; - - ResourceSet* set = resourcePtr->second; - ASSERT(set); - - clientMap().remove(resourcePtr); - - for (int i = 0; i < _ResourceTypeCount; i++) - if (set->resources[i]) - set->resources[i]->m_clients.remove(item); - - delete set; -} - -void SVGResource::addClient(SVGStyledElement* item) -{ - if (m_clients.contains(item)) - return; - - m_clients.add(item); - - ResourceSet* target = clientMap().get(item); - if (!target) - target = new ResourceSet; - - SVGResourceType type = resourceType(); - if (SVGResource* oldResource = target->resources[type]) - oldResource->m_clients.remove(item); - - target->resources[type] = this; - clientMap().set(item, target); -} - -TextStream& SVGResource::externalRepresentation(TextStream& ts) const -{ - return ts; -} - -SVGResource* getResourceById(Document* document, const AtomicString& id) -{ - if (id.isEmpty()) - return 0; - - Element* element = document->getElementById(id); - SVGElement* svgElement = 0; - if (element && element->isSVGElement()) - svgElement = static_cast<SVGElement*>(element); - - if (svgElement && svgElement->isStyled()) - return static_cast<SVGStyledElement*>(svgElement)->canvasResource(); - - return 0; -} - -TextStream& operator<<(TextStream& ts, const SVGResource& r) -{ - return r.externalRepresentation(ts); -} - -} - -#endif diff --git a/WebCore/svg/graphics/SVGResource.h b/WebCore/svg/graphics/SVGResource.h deleted file mode 100644 index 7ee98f6..0000000 --- a/WebCore/svg/graphics/SVGResource.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (C) 2006, 2008 Nikolas Zimmermann <zimmermann@kde.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 SVGResource_h -#define SVGResource_h - -#if ENABLE(SVG) -#include "PlatformString.h" -#include "StringHash.h" - -#include <wtf/HashMap.h> -#include <wtf/HashSet.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - - class AtomicString; - class Document; - class SVGStyledElement; - class TextStream; - - enum SVGResourceType { - // Painting mode - ClipperResourceType = 0, - MarkerResourceType, - ImageResourceType, - FilterResourceType, - MaskerResourceType, - PaintServerResourceType, - - // For resource tracking we need to know how many types of resource there are - _ResourceTypeCount - }; - - // The SVGResource file represent various graphics resources: - // - Filter resource - // - Clipper resource - // - Masker resource - // - Marker resource - // - Pattern resource - // - Linear/Radial gradient resource - // - // SVG creates/uses these resources. - - class SVGResource : public RefCounted<SVGResource> { - public: - virtual ~SVGResource(); - - virtual void invalidate(); - - void addClient(SVGStyledElement*); - virtual SVGResourceType resourceType() const = 0; - - bool isPaintServer() const { return resourceType() == PaintServerResourceType; } - bool isFilter() const { return resourceType() == FilterResourceType; } - bool isClipper() const { return resourceType() == ClipperResourceType; } - bool isMarker() const { return resourceType() == MarkerResourceType; } - bool isMasker() const { return resourceType() == MaskerResourceType; } - - virtual TextStream& externalRepresentation(TextStream&) const; - - static void invalidateClients(HashSet<SVGStyledElement*>); - static void removeClient(SVGStyledElement*); - - protected: - SVGResource(); - - private: - HashSet<SVGStyledElement*> m_clients; - }; - - SVGResource* getResourceById(Document*, const AtomicString&); - - TextStream& operator<<(TextStream&, const SVGResource&); - -} // namespace WebCore - -#endif -#endif // SVGResource_h diff --git a/WebCore/svg/graphics/SVGResourceClipper.cpp b/WebCore/svg/graphics/SVGResourceClipper.cpp deleted file mode 100644 index f03f5c2..0000000 --- a/WebCore/svg/graphics/SVGResourceClipper.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.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 "config.h" - -#if ENABLE(SVG) -#include "SVGResourceClipper.h" - -#include "SVGRenderTreeAsText.h" - -namespace WebCore { - -SVGResourceClipper::SVGResourceClipper() - : SVGResource() -{ -} - -SVGResourceClipper::~SVGResourceClipper() -{ -} - -void SVGResourceClipper::resetClipData() -{ - m_clipData.clear(); -} - -void SVGResourceClipper::addClipData(const Path& path, WindRule rule, bool bboxUnits) -{ - m_clipData.addPath(path, rule, bboxUnits); -} - -const ClipDataList& SVGResourceClipper::clipData() const -{ - return m_clipData; -} - -TextStream& SVGResourceClipper::externalRepresentation(TextStream& ts) const -{ - ts << "[type=CLIPPER]"; - ts << " [clip data=" << clipData().clipData() << "]"; - return ts; -} - -TextStream& operator<<(TextStream& ts, WindRule rule) -{ - switch (rule) { - case RULE_NONZERO: - ts << "NON-ZERO"; break; - case RULE_EVENODD: - ts << "EVEN-ODD"; break; - } - - return ts; -} - -TextStream& operator<<(TextStream& ts, const ClipData& d) -{ - ts << "[winding=" << d.windRule << "]"; - - if (d.bboxUnits) - ts << " [bounding box mode=" << d.bboxUnits << "]"; - - ts << " [path=" << d.path.debugString() << "]"; - return ts; -} - -SVGResourceClipper* getClipperById(Document* document, const AtomicString& id) -{ - SVGResource* resource = getResourceById(document, id); - if (resource && resource->isClipper()) - return static_cast<SVGResourceClipper*>(resource); - - return 0; -} - -} // namespace WebCore - -#endif diff --git a/WebCore/svg/graphics/SVGResourceClipper.h b/WebCore/svg/graphics/SVGResourceClipper.h deleted file mode 100644 index 98c295f..0000000 --- a/WebCore/svg/graphics/SVGResourceClipper.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.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 SVGResourceClipper_h -#define SVGResourceClipper_h - -#if ENABLE(SVG) - -#include "SVGResource.h" -#include "Path.h" - -namespace WebCore { - - struct ClipData { - Path path; - WindRule windRule; - bool bboxUnits : 1; - }; - - class ClipDataList { - public: - void addPath(const Path& pathData, WindRule windRule, bool bboxUnits) - { - ClipData clipData; - - clipData.path = pathData; - clipData.windRule = windRule; - clipData.bboxUnits = bboxUnits; - - m_clipData.append(clipData); - } - - void clear() { m_clipData.clear(); } - const Vector<ClipData>& clipData() const { return m_clipData; } - bool isEmpty() const { return m_clipData.isEmpty(); } - private: - Vector<ClipData> m_clipData; - }; - - class GraphicsContext; - - class SVGResourceClipper : public SVGResource { - public: - static PassRefPtr<SVGResourceClipper> create() { return adoptRef(new SVGResourceClipper); } - virtual ~SVGResourceClipper(); - - void resetClipData(); - void addClipData(const Path&, WindRule, bool bboxUnits); - - const ClipDataList& clipData() const; - - virtual SVGResourceType resourceType() const { return ClipperResourceType; } - virtual TextStream& externalRepresentation(TextStream&) const; - - // To be implemented by the specific rendering devices - void applyClip(GraphicsContext*, const FloatRect& boundingBox) const; - private: - SVGResourceClipper(); - ClipDataList m_clipData; - }; - - TextStream& operator<<(TextStream&, WindRule); - TextStream& operator<<(TextStream&, const ClipData&); - - SVGResourceClipper* getClipperById(Document*, const AtomicString&); - -} // namespace WebCore - -#endif - -#endif // SVGResourceClipper_h diff --git a/WebCore/svg/graphics/SVGResourceFilter.cpp b/WebCore/svg/graphics/SVGResourceFilter.cpp deleted file mode 100644 index 8fb2dfa..0000000 --- a/WebCore/svg/graphics/SVGResourceFilter.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "SVGResourceFilter.h" - -#include "SVGRenderTreeAsText.h" -#include "SVGFilterEffect.h" - -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(); -} - -void SVGResourceFilter::addFilterEffect(SVGFilterEffect* effect) -{ - ASSERT(effect); - - if (effect) { - ASSERT(effect->filter() == this); - m_effects.append(effect); - } -} - -FloatRect SVGResourceFilter::filterBBoxForItemBBox(const FloatRect& itemBBox) const -{ - FloatRect filterBBox = filterRect(); - - float xOffset = 0.0f; - float yOffset = 0.0f; - - if (!effectBoundingBoxMode()) { - xOffset = itemBBox.x(); - yOffset = itemBBox.y(); - } - - if (filterBoundingBoxMode()) { - filterBBox = FloatRect(xOffset + filterBBox.x() * itemBBox.width(), - yOffset + filterBBox.y() * itemBBox.height(), - filterBBox.width() * itemBBox.width(), - filterBBox.height() * itemBBox.height()); - } else { - if (xBoundingBoxMode()) - filterBBox.setX(xOffset + filterBBox.x()); - - if (yBoundingBoxMode()) - filterBBox.setY(yOffset + filterBBox.y()); - } - - return filterBBox; -} - -TextStream& SVGResourceFilter::externalRepresentation(TextStream& ts) const -{ - ts << "[type=FILTER] "; - - FloatRect bbox = filterRect(); - static FloatRect defaultFilterRect(0, 0, 1, 1); - - if (!filterBoundingBoxMode() || bbox != defaultFilterRect) { - ts << " [bounding box="; - if (filterBoundingBoxMode()) { - bbox.scale(100.f); - ts << "at (" << bbox.x() << "%," << bbox.y() << "%) size " << bbox.width() << "%x" << bbox.height() << "%"; - } else - ts << filterRect(); - ts << "]"; - } - - if (!filterBoundingBoxMode()) // default is true - ts << " [bounding box mode=" << filterBoundingBoxMode() << "]"; - if (effectBoundingBoxMode()) // default is false - ts << " [effect bounding box mode=" << effectBoundingBoxMode() << "]"; - if (m_effects.size() > 0) - ts << " [effects=" << m_effects << "]"; - - return ts; -} - -SVGResourceFilter* getFilterById(Document* document, const AtomicString& id) -{ - SVGResource* resource = getResourceById(document, id); - if (resource && resource->isFilter()) - return static_cast<SVGResourceFilter*>(resource); - - return 0; -} - - -} // namespace WebCore - -#endif // ENABLE(SVG) diff --git a/WebCore/svg/graphics/SVGResourceFilter.h b/WebCore/svg/graphics/SVGResourceFilter.h deleted file mode 100644 index 646c732..0000000 --- a/WebCore/svg/graphics/SVGResourceFilter.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef SVGResourceFilter_h -#define SVGResourceFilter_h - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "SVGResource.h" -#include "SVGFilterEffect.h" - -#include "FloatRect.h" - -#include <wtf/OwnPtr.h> - -namespace WebCore { - -class GraphicsContext; -class SVGFilterEffect; - -class SVGResourceFilterPlatformData { -public: - virtual ~SVGResourceFilterPlatformData() {} -}; - -class SVGResourceFilter : public SVGResource { -public: - SVGResourceFilter(); - - virtual SVGResourceType resourceType() const { return FilterResourceType; } - - bool filterBoundingBoxMode() const { return m_filterBBoxMode; } - void setFilterBoundingBoxMode(bool bboxMode) { m_filterBBoxMode = bboxMode; } - - bool effectBoundingBoxMode() const { return m_effectBBoxMode; } - void setEffectBoundingBoxMode(bool bboxMode) { m_effectBBoxMode = bboxMode; } - - bool xBoundingBoxMode() const { return m_xBBoxMode; } - void setXBoundingBoxMode(bool bboxMode) { m_xBBoxMode = bboxMode; } - - bool yBoundingBoxMode() const { return m_yBBoxMode; } - void setYBoundingBoxMode(bool bboxMode) { m_yBBoxMode = bboxMode; } - - FloatRect filterRect() const { return m_filterRect; } - void setFilterRect(const FloatRect& rect) { m_filterRect = rect; } - - FloatRect filterBBoxForItemBBox(const FloatRect& itemBBox) const; - - void clearEffects(); - void addFilterEffect(SVGFilterEffect*); - - virtual TextStream& externalRepresentation(TextStream&) const; - - // To be implemented in platform specific code. - void prepareFilter(GraphicsContext*&, const FloatRect& bbox); - void applyFilter(GraphicsContext*&, const FloatRect& bbox); - - SVGResourceFilterPlatformData* platformData() { return m_platformData.get(); } - const Vector<SVGFilterEffect*>& effects() { return m_effects; } - -private: - SVGResourceFilterPlatformData* createPlatformData(); - - OwnPtr<SVGResourceFilterPlatformData> m_platformData; - - bool m_filterBBoxMode : 1; - bool m_effectBBoxMode : 1; - - bool m_xBBoxMode : 1; - bool m_yBBoxMode : 1; - - FloatRect m_filterRect; - Vector<SVGFilterEffect*> m_effects; -}; - -SVGResourceFilter* getFilterById(Document*, const AtomicString&); - -} // namespace WebCore - -#endif // ENABLE(SVG) - -#endif // SVGResourceFilter_h diff --git a/WebCore/svg/graphics/SVGResourceListener.h b/WebCore/svg/graphics/SVGResourceListener.h deleted file mode 100644 index e69de29..0000000 --- a/WebCore/svg/graphics/SVGResourceListener.h +++ /dev/null diff --git a/WebCore/svg/graphics/SVGResourceMarker.cpp b/WebCore/svg/graphics/SVGResourceMarker.cpp deleted file mode 100644 index 3649321..0000000 --- a/WebCore/svg/graphics/SVGResourceMarker.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.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 "config.h" - -#if ENABLE(SVG) -#include "SVGResourceMarker.h" - -#include "AffineTransform.h" -#include "GraphicsContext.h" -#include "RenderSVGViewportContainer.h" -#include "TextStream.h" - -namespace WebCore { - -SVGResourceMarker::SVGResourceMarker() - : SVGResource() - , m_refX(0.0) - , m_refY(0.0) - , m_angle(-1) // just like using setAutoAngle() - , m_marker(0) - , m_useStrokeWidth(true) -{ -} - -SVGResourceMarker::~SVGResourceMarker() -{ -} - -void SVGResourceMarker::setMarker(RenderSVGViewportContainer* marker) -{ - m_marker = marker; -} - -void SVGResourceMarker::setRef(double refX, double refY) -{ - m_refX = refX; - m_refY = refY; -} - -void SVGResourceMarker::draw(GraphicsContext* context, const FloatRect& rect, double x, double y, double strokeWidth, double angle) -{ - if (!m_marker) - return; - - static HashSet<SVGResourceMarker*> currentlyDrawingMarkers; - - // avoid drawing circular marker references - if (currentlyDrawingMarkers.contains(this)) - return; - - currentlyDrawingMarkers.add(this); - - AffineTransform transform; - transform.translate(x, y); - transform.rotate(m_angle > -1 ? m_angle : angle); - - // refX and refY are given in coordinates relative to the viewport established by the marker, yet they affect - // the translation performed on the viewport itself. - AffineTransform viewportTransform; - if (m_useStrokeWidth) - viewportTransform.scale(strokeWidth, strokeWidth); - viewportTransform *= m_marker->viewportTransform(); - double refX, refY; - viewportTransform.map(m_refX, m_refY, &refX, &refY); - transform.translate(-refX, -refY); - - if (m_useStrokeWidth) - transform.scale(strokeWidth, strokeWidth); - - // FIXME: PaintInfo should be passed into this method instead of being created here - // FIXME: bounding box fractions are lost - RenderObject::PaintInfo info(context, enclosingIntRect(rect), PaintPhaseForeground, 0, 0, 0); - - context->save(); - context->concatCTM(transform); - m_marker->setDrawsContents(true); - m_marker->paint(info, 0, 0); - m_marker->setDrawsContents(false); - context->restore(); - - m_cachedBounds = transform.mapRect(m_marker->absoluteClippedOverflowRect()); - - currentlyDrawingMarkers.remove(this); -} - -FloatRect SVGResourceMarker::cachedBounds() const -{ - return m_cachedBounds; -} - -TextStream& SVGResourceMarker::externalRepresentation(TextStream& ts) const -{ - ts << "[type=MARKER]" - << " [angle="; - - if (angle() == -1) - ts << "auto" << "]"; - else - ts << angle() << "]"; - - ts << " [ref x=" << refX() << " y=" << refY() << "]"; - return ts; -} - -SVGResourceMarker* getMarkerById(Document* document, const AtomicString& id) -{ - SVGResource* resource = getResourceById(document, id); - if (resource && resource->isMarker()) - return static_cast<SVGResourceMarker*>(resource); - - return 0; -} - -} // namespace WebCore - -#endif diff --git a/WebCore/svg/graphics/SVGResourceMarker.h b/WebCore/svg/graphics/SVGResourceMarker.h deleted file mode 100644 index bb4039c..0000000 --- a/WebCore/svg/graphics/SVGResourceMarker.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.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 SVGResourceMarker_h -#define SVGResourceMarker_h - -#if ENABLE(SVG) - -#include "FloatRect.h" -#include "SVGResource.h" - -namespace WebCore { - - class GraphicsContext; - class RenderSVGViewportContainer; - - class SVGResourceMarker : public SVGResource { - public: - static PassRefPtr<SVGResourceMarker> create() { return adoptRef(new SVGResourceMarker); } - virtual ~SVGResourceMarker(); - - void setMarker(RenderSVGViewportContainer*); - - void setRef(double refX, double refY); - double refX() const { return m_refX; } - double refY() const { return m_refY; } - - void setAngle(float angle) { m_angle = angle; } - void setAutoAngle() { m_angle = -1; } - float angle() const { return m_angle; } - - void setUseStrokeWidth(bool useStrokeWidth = true) { m_useStrokeWidth = useStrokeWidth; } - bool useStrokeWidth() const { return m_useStrokeWidth; } - - FloatRect cachedBounds() const; - void draw(GraphicsContext*, const FloatRect&, double x, double y, double strokeWidth = 1, double angle = 0); - - virtual SVGResourceType resourceType() const { return MarkerResourceType; } - virtual TextStream& externalRepresentation(TextStream&) const; - - private: - SVGResourceMarker(); - double m_refX, m_refY; - FloatRect m_cachedBounds; - float m_angle; - RenderSVGViewportContainer* m_marker; - bool m_useStrokeWidth; - }; - - SVGResourceMarker* getMarkerById(Document*, const AtomicString&); - -} // namespace WebCore - -#endif - -#endif // SVGResourceMarker_h diff --git a/WebCore/svg/graphics/SVGResourceMasker.cpp b/WebCore/svg/graphics/SVGResourceMasker.cpp deleted file mode 100644 index 842f04f..0000000 --- a/WebCore/svg/graphics/SVGResourceMasker.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.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 "config.h" - -#if ENABLE(SVG) -#include "SVGResourceMasker.h" - -#include "ImageBuffer.h" -#include "TextStream.h" - -using namespace std; - -namespace WebCore { - -SVGResourceMasker::SVGResourceMasker(const SVGMaskElement* ownerElement) - : SVGResource() - , m_ownerElement(ownerElement) -{ -} - -SVGResourceMasker::~SVGResourceMasker() -{ -} - -void SVGResourceMasker::invalidate() -{ - SVGResource::invalidate(); - m_mask.clear(); -} - -TextStream& SVGResourceMasker::externalRepresentation(TextStream& ts) const -{ - ts << "[type=MASKER]"; - return ts; -} - -SVGResourceMasker* getMaskerById(Document* document, const AtomicString& id) -{ - SVGResource* resource = getResourceById(document, id); - if (resource && resource->isMasker()) - return static_cast<SVGResourceMasker*>(resource); - - return 0; -} - -} // namespace WebCore - -#endif diff --git a/WebCore/svg/graphics/SVGResourceMasker.h b/WebCore/svg/graphics/SVGResourceMasker.h deleted file mode 100644 index f945f56..0000000 --- a/WebCore/svg/graphics/SVGResourceMasker.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.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 SVGResourceMasker_h -#define SVGResourceMasker_h - -#if ENABLE(SVG) - -#include "GraphicsContext.h" -#include "SVGResource.h" - -#include <memory> - -#include <wtf/OwnPtr.h> -#include <wtf/PassRefPtr.h> - -namespace WebCore { - - class FloatRect; - class ImageBuffer; - class SVGMaskElement; - - class SVGResourceMasker : public SVGResource { - public: - static PassRefPtr<SVGResourceMasker> create(const SVGMaskElement* ownerElement) { return adoptRef(new SVGResourceMasker(ownerElement)); } - virtual ~SVGResourceMasker(); - - virtual void invalidate(); - - virtual SVGResourceType resourceType() const { return MaskerResourceType; } - virtual TextStream& externalRepresentation(TextStream&) const; - - // To be implemented by the specific rendering devices - void applyMask(GraphicsContext*, const FloatRect& boundingBox); - - private: - SVGResourceMasker(const SVGMaskElement*); - - const SVGMaskElement* m_ownerElement; - - OwnPtr<ImageBuffer> m_mask; - FloatRect m_maskRect; - }; - - SVGResourceMasker* getMaskerById(Document*, const AtomicString&); - -} // namespace WebCore - -#endif - -#endif // SVGResourceMasker_h diff --git a/WebCore/svg/graphics/cairo/RenderPathCairo.cpp b/WebCore/svg/graphics/cairo/RenderPathCairo.cpp deleted file mode 100644 index 72379b5..0000000 --- a/WebCore/svg/graphics/cairo/RenderPathCairo.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2007 Alp Toker <alp@atoker.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" -#include "RenderPath.h" - -#include "CairoPath.h" -#include "SVGPaintServer.h" - -namespace WebCore { - -bool RenderPath::strokeContains(const FloatPoint& point, bool requiresStroke) const -{ - if (requiresStroke && !SVGPaintServer::strokePaintServer(style(), this)) - return false; - - cairo_t* cr = path().platformPath()->m_cr; - - // TODO: set stroke properties - return cairo_in_stroke(cr, point.x(), point.y()); -} - -FloatRect RenderPath::strokeBBox() const -{ - // TODO: this implementation is naive - - cairo_t* cr = path().platformPath()->m_cr; - - double x0, x1, y0, y1; - cairo_stroke_extents(cr, &x0, &y0, &x1, &y1); - FloatRect bbox = FloatRect(x0, y0, x1 - x0, y1 - y0); - - return bbox; -} - -} diff --git a/WebCore/svg/graphics/cairo/SVGPaintServerCairo.cpp b/WebCore/svg/graphics/cairo/SVGPaintServerCairo.cpp deleted file mode 100644 index 37cab6f..0000000 --- a/WebCore/svg/graphics/cairo/SVGPaintServerCairo.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2007 Alp Toker <alp@atoker.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" - -#if ENABLE(SVG) -#include "SVGPaintServer.h" - -#include "GraphicsContext.h" -#include "SVGPaintServer.h" -#include "RenderPath.h" - -#include <cairo.h> - -namespace WebCore { - -void SVGPaintServer::draw(GraphicsContext*& context, const RenderObject* path, SVGPaintTargetType type) const -{ - if (!setup(context, path, type)) - return; - - renderPath(context, path, type); - teardown(context, path, type); -} - -void SVGPaintServer::teardown(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText) const -{ - // no-op -} - -void SVGPaintServer::renderPath(GraphicsContext*& context, const RenderObject* path, SVGPaintTargetType type) const -{ - cairo_t* cr = context->platformContext(); - const SVGRenderStyle* style = path->style()->svgStyle(); - - cairo_set_fill_rule(cr, style->fillRule() == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING); - - if ((type & ApplyToFillTargetType) && style->hasFill()) - cairo_fill_preserve(cr); - - if ((type & ApplyToStrokeTargetType) && style->hasStroke()) - cairo_stroke_preserve(cr); - - cairo_new_path(cr); -} - -} // namespace WebCore - -#endif diff --git a/WebCore/svg/graphics/cairo/SVGPaintServerGradientCairo.cpp b/WebCore/svg/graphics/cairo/SVGPaintServerGradientCairo.cpp deleted file mode 100644 index e237962..0000000 --- a/WebCore/svg/graphics/cairo/SVGPaintServerGradientCairo.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (C) 2007 Alp Toker <alp@atoker.com> - * Copyright (C) 2008 Dirk Schulze <vbs85@gmx.de> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" - -#if ENABLE(SVG) -#include "SVGPaintServerGradient.h" -#include "SVGPaintServerLinearGradient.h" -#include "SVGPaintServerRadialGradient.h" - -#include "GraphicsContext.h" -#include "RenderObject.h" -#include "RenderPath.h" -#include "RenderStyle.h" -#include "SVGGradientElement.h" - -namespace WebCore { - -bool SVGPaintServerGradient::setup(GraphicsContext*& context, const RenderObject* object, SVGPaintTargetType type, bool isPaintingText) const -{ - m_ownerElement->buildGradient(); - - cairo_t* cr = context->platformContext(); - cairo_pattern_t* pattern; - - cairo_matrix_t matrix; - cairo_matrix_init_identity (&matrix); - const cairo_matrix_t gradient_matrix = gradientTransform(); - - const SVGRenderStyle* svgStyle = object->style()->svgStyle(); - RenderStyle* style = object->style(); - - if (this->type() == LinearGradientPaintServer) { - const SVGPaintServerLinearGradient* linear = static_cast<const SVGPaintServerLinearGradient*>(this); - - if (boundingBoxMode()) { - FloatRect bbox = object->relativeBBox(false); - if (bbox.width() == 0 || bbox.height() == 0) { - applyStrokeStyleToContext(context, style, object); - cairo_set_source_rgb(cr, 0, 0, 0); - return true; - } - cairo_matrix_translate(&matrix, bbox.x(), bbox.y()); - cairo_matrix_scale(&matrix, bbox.width(), bbox.height()); - } - - double x0 = linear->gradientStart().x(); - double y0 = linear->gradientStart().y(); - double x1 = linear->gradientEnd().x(); - double y1 = linear->gradientEnd().y(); - - pattern = cairo_pattern_create_linear(x0, y0, x1, y1); - - } else if (this->type() == RadialGradientPaintServer) { - const SVGPaintServerRadialGradient* radial = static_cast<const SVGPaintServerRadialGradient*>(this); - - if (boundingBoxMode()) { - FloatRect bbox = object->relativeBBox(false); - if (bbox.width() == 0 || bbox.height() == 0) { - applyStrokeStyleToContext(context, style, object); - cairo_set_source_rgb(cr, 0, 0, 0); - return true; - } - cairo_matrix_translate(&matrix, bbox.x(), bbox.y()); - cairo_matrix_scale(&matrix, bbox.width(), bbox.height()); - } - - double cx = radial->gradientCenter().x(); - double cy = radial->gradientCenter().y(); - double radius = radial->gradientRadius(); - double fx = radial->gradientFocal().x(); - double fy = radial->gradientFocal().y(); - - fx -= cx; - fy -= cy; - - double fradius = 0.0; - - if (sqrt(fx * fx + fy * fy) >= radius) { - double angle = atan2(fy, fx); - if ((fx + cx) < cx) - fx = cos(angle) * radius + 0.002; - else - fx = cos(angle) * radius - 0.002; - if ((fy + cy) < cy) - fy = sin(angle) * radius + 0.002; - else - fy = sin(angle) * radius - 0.002; - } - - pattern = cairo_pattern_create_radial(fx + cx, fy + cy, fradius, cx, cy, radius); - - } else { - return false; - } - - cairo_pattern_set_filter(pattern, CAIRO_FILTER_BILINEAR); - - switch (spreadMethod()) { - case SpreadMethodPad: - cairo_pattern_set_extend(pattern, CAIRO_EXTEND_PAD); - break; - case SpreadMethodReflect: - cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REFLECT); - break; - case SpreadMethodRepeat: - cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT); - break; - default: - cairo_pattern_set_extend(pattern, CAIRO_EXTEND_NONE); - break; - } - - cairo_matrix_multiply(&matrix, &matrix, &gradient_matrix); - cairo_matrix_invert(&matrix); - cairo_pattern_set_matrix(pattern, &matrix); - - const Vector<SVGGradientStop>& stops = gradientStops(); - - for (unsigned i = 0; i < stops.size(); ++i) { - float offset = stops[i].first; - Color color = stops[i].second; - if (i > 0 && offset < stops[i - 1].first) - offset = stops[i - 1].first; - - cairo_pattern_add_color_stop_rgba(pattern, offset, color.red() / 255.0, color.green() / 255.0, color.blue() / 255.0, color.alpha() / 255.0); - } - - if ((type & ApplyToFillTargetType) && svgStyle->hasFill()) - context->setFillRule(svgStyle->fillRule()); - - if ((type & ApplyToStrokeTargetType) && svgStyle->hasStroke()) - applyStrokeStyleToContext(context, style, object); - - cairo_set_source(cr, pattern); - cairo_pattern_destroy(pattern); - - return true; -} - -} // namespace WebCore - -#endif diff --git a/WebCore/svg/graphics/cairo/SVGPaintServerPatternCairo.cpp b/WebCore/svg/graphics/cairo/SVGPaintServerPatternCairo.cpp deleted file mode 100644 index 86530bc..0000000 --- a/WebCore/svg/graphics/cairo/SVGPaintServerPatternCairo.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2007 Alp Toker <alp@atoker.com> - * Copyright (C) 2008 Dirk Schulze <vbs85@gmx.de> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" - -#if ENABLE(SVG) -#include "SVGPaintServerPattern.h" - -#include "GraphicsContext.h" -#include "Image.h" -#include "ImageBuffer.h" -#include "RenderObject.h" -#include "SVGPatternElement.h" - -#include <wtf/OwnArrayPtr.h> - -namespace WebCore { - -bool SVGPaintServerPattern::setup(GraphicsContext*& context, const RenderObject* object, SVGPaintTargetType type, bool isPaintingText) const -{ - FloatRect targetRect = object->relativeBBox(false); - - const SVGRenderStyle* svgStyle = object->style()->svgStyle(); - RenderStyle* style = object->style(); - - float strokeWidth = SVGRenderStyle::cssPrimitiveToLength(object, svgStyle->strokeWidth(), 1.0f); - - if (targetRect.width() == 0) - targetRect = FloatRect(targetRect.x(), targetRect.y(), strokeWidth, targetRect.height()); - if (targetRect.height() == 0) - targetRect = FloatRect(targetRect.x(), targetRect.y(), targetRect.width(), strokeWidth); - - m_ownerElement->buildPattern(targetRect); - - cairo_surface_t* image = tile()->image()->nativeImageForCurrentFrame(); - if (!image) - return false; - - cairo_t* cr = context->platformContext(); - - cairo_pattern_t* pattern = cairo_pattern_create_for_surface(image); - cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT); - - cairo_pattern_set_filter(pattern, CAIRO_FILTER_BEST); - cairo_matrix_t pattern_matrix = patternTransform(); - cairo_matrix_t matrix = {1, 0, 0, 1, patternBoundaries().x(), patternBoundaries().y()}; - cairo_matrix_multiply(&matrix, &matrix, &pattern_matrix); - cairo_matrix_invert(&matrix); - cairo_pattern_set_matrix(pattern, &matrix); - - if ((type & ApplyToFillTargetType) && svgStyle->hasFill()) - context->setFillRule(svgStyle->fillRule()); - - if ((type & ApplyToStrokeTargetType) && svgStyle->hasStroke()) - applyStrokeStyleToContext(context, style, object); - - cairo_set_source(cr, pattern); - cairo_pattern_destroy(pattern); - - return true; -} - -} // namespace WebCore - -#endif diff --git a/WebCore/svg/graphics/cairo/SVGPaintServerSolidCairo.cpp b/WebCore/svg/graphics/cairo/SVGPaintServerSolidCairo.cpp deleted file mode 100644 index 49e6f55..0000000 --- a/WebCore/svg/graphics/cairo/SVGPaintServerSolidCairo.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2007 Alp Toker <alp@atoker.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" - -#if ENABLE(SVG) -#include "SVGPaintServerSolid.h" - -#include "GraphicsContext.h" -#include "SVGPaintServer.h" -#include "RenderPath.h" - -namespace WebCore { - -bool SVGPaintServerSolid::setup(GraphicsContext*& context, const RenderObject* object, SVGPaintTargetType type, bool isPaintingText) const -{ - // TODO: share this code with other PaintServers - cairo_t* cr = context->platformContext(); - - const SVGRenderStyle* svgStyle = object->style()->svgStyle(); - RenderStyle* style = object->style(); - - float red, green, blue, alpha; - color().getRGBA(red, green, blue, alpha); - - if ((type & ApplyToFillTargetType) && svgStyle->hasFill()) { - alpha = svgStyle->fillOpacity(); - context->setFillRule(svgStyle->fillRule()); - } - - if ((type & ApplyToStrokeTargetType) && svgStyle->hasStroke()) { - alpha = svgStyle->strokeOpacity(); - applyStrokeStyleToContext(context, style, object); - } - - cairo_set_source_rgba(cr, red, green, blue, alpha); - - return true; -} - -} // namespace WebCore - -#endif diff --git a/WebCore/svg/graphics/cairo/SVGResourceClipperCairo.cpp b/WebCore/svg/graphics/cairo/SVGResourceClipperCairo.cpp deleted file mode 100644 index 6aec0ae..0000000 --- a/WebCore/svg/graphics/cairo/SVGResourceClipperCairo.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2007 Alp Toker <alp@atoker.com> - * Copyright (C) 2008 Dirk Schulze <vbs85@gmx.de> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" - -#if ENABLE(SVG) -#include "SVGResourceClipper.h" -#include "AffineTransform.h" -#include "CairoPath.h" -#include "GraphicsContext.h" - -#include <cairo.h> - -namespace WebCore { - -void SVGResourceClipper::applyClip(GraphicsContext* context, const FloatRect& boundingBox) const -{ - cairo_t* cr = context->platformContext(); - if (m_clipData.clipData().size() < 1) - return; - - cairo_reset_clip(cr); - context->beginPath(); - - for (unsigned int x = 0; x < m_clipData.clipData().size(); x++) { - ClipData data = m_clipData.clipData()[x]; - - Path path = data.path; - if (path.isEmpty()) - continue; - path.closeSubpath(); - - if (data.bboxUnits) { - // Make use of the clipping units - AffineTransform transform; - transform.translate(boundingBox.x(), boundingBox.y()); - transform.scale(boundingBox.width(), boundingBox.height()); - path.transform(transform); - } - cairo_path_t* clipPath = cairo_copy_path(path.platformPath()->m_cr); - cairo_append_path(cr, clipPath); - - cairo_set_fill_rule(cr, data.windRule == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING); - } - - cairo_clip(cr); -} - -} // namespace WebCore - -#endif diff --git a/WebCore/svg/graphics/cairo/SVGResourceFilterCairo.cpp b/WebCore/svg/graphics/cairo/SVGResourceFilterCairo.cpp deleted file mode 100644 index a27038a..0000000 --- a/WebCore/svg/graphics/cairo/SVGResourceFilterCairo.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2008 Collabora Ltd. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#include "NotImplemented.h" -#include "SVGResourceFilter.h" - -namespace WebCore { - -SVGResourceFilterPlatformData* SVGResourceFilter::createPlatformData() -{ - notImplemented(); - return 0; -} - -void SVGResourceFilter::prepareFilter(GraphicsContext*&, const FloatRect&) -{ - notImplemented(); -} - -void SVGResourceFilter::applyFilter(GraphicsContext*&, const FloatRect&) -{ - notImplemented(); -} - -} // namespace WebCore - -#endif - diff --git a/WebCore/svg/graphics/cairo/SVGResourceMaskerCairo.cpp b/WebCore/svg/graphics/cairo/SVGResourceMaskerCairo.cpp deleted file mode 100644 index 1f690b5..0000000 --- a/WebCore/svg/graphics/cairo/SVGResourceMaskerCairo.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2007 Alp Toker <alp@atoker.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" - -#if ENABLE(SVG) -#include "SVGResourceMasker.h" -#include "Image.h" -#include "ImageBuffer.h" -#include "GraphicsContext.h" - -#include <cairo.h> - -namespace WebCore { - -void SVGResourceMasker::applyMask(GraphicsContext* context, const FloatRect& boundingBox) -{ - if (!m_mask) - return; - - cairo_t* cr = context->platformContext(); - cairo_surface_t* surface = m_mask->image()->nativeImageForCurrentFrame(); - if (!surface) - return; - cairo_pattern_t* mask = cairo_pattern_create_for_surface(surface); - cairo_mask(cr, mask); - cairo_pattern_destroy(mask); -} - -} // namespace WebCore - -#endif diff --git a/WebCore/svg/graphics/cg/CgSupport.cpp b/WebCore/svg/graphics/cg/CgSupport.cpp deleted file mode 100644 index f9bfb4c..0000000 --- a/WebCore/svg/graphics/cg/CgSupport.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. - * 2006 Rob Buis <buis@kde.org> - * 2008 Nikolas Zimmermann <zimmermann@kde.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 "config.h" - -#if ENABLE(SVG) -#include "CgSupport.h" - -#include <ApplicationServices/ApplicationServices.h> -#include "FloatConversion.h" -#include "GraphicsContext.h" -#include "RenderStyle.h" -#include "SVGPaintServer.h" -#include "SVGRenderStyle.h" -#include <wtf/Assertions.h> - -namespace WebCore { - -CGContextRef scratchContext() -{ - static CGContextRef scratch = 0; - if (!scratch) { - CFMutableDataRef empty = CFDataCreateMutable(NULL, 0); - CGDataConsumerRef consumer = CGDataConsumerCreateWithCFData(empty); - scratch = CGPDFContextCreate(consumer, NULL, NULL); - CGDataConsumerRelease(consumer); - CFRelease(empty); - - CGFloat black[4] = {0, 0, 0, 1}; - CGContextSetFillColor(scratch, black); - CGContextSetStrokeColor(scratch, black); - } - return scratch; -} - -FloatRect strokeBoundingBox(const Path& path, RenderStyle* style, const RenderObject* object) - { - // the bbox might grow if the path is stroked. - // and CGPathGetBoundingBox doesn't support that, so we'll have - // to make an alternative call... - - // FIXME: since this is mainly used to decide what to repaint, - // perhaps it would be sufficient to just outset the fill bbox by - // the stroke width - that should be way cheaper and simpler than - // what we do here. - - CGPathRef cgPath = path.platformPath(); - - CGContextRef context = scratchContext(); - CGContextSaveGState(context); - - CGContextBeginPath(context); - CGContextAddPath(context, cgPath); - - GraphicsContext gc(context); - applyStrokeStyleToContext(&gc, style, object); - - CGContextReplacePathWithStrokedPath(context); - if (CGContextIsPathEmpty(context)) { - // CGContextReplacePathWithStrokedPath seems to fail to create a path sometimes, this is not well understood. - // returning here prevents CG from logging to the console from CGContextGetPathBoundingBox - CGContextRestoreGState(context); - return FloatRect(); - } - - CGRect box = CGContextGetPathBoundingBox(context); - CGContextRestoreGState(context); - - return FloatRect(box); -} - -} - -#endif // ENABLE(SVG) - diff --git a/WebCore/svg/graphics/cg/CgSupport.h b/WebCore/svg/graphics/cg/CgSupport.h deleted file mode 100644 index de6e4b3..0000000 --- a/WebCore/svg/graphics/cg/CgSupport.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. - * - * 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 CgSupport_h -#define CgSupport_h - -#if ENABLE(SVG) - -#include <ApplicationServices/ApplicationServices.h> -#include "GraphicsTypes.h" - -namespace WebCore { - -typedef struct CGPath *CGMutablePathRef; - -class Path; -class FloatRect; -class RenderStyle; -class RenderObject; -class GraphicsContext; - -CGContextRef scratchContext(); -FloatRect strokeBoundingBox(const Path& path, RenderStyle*, const RenderObject*); - -} - -#endif // ENABLE(SVG) -#endif // !CgSupport_h diff --git a/WebCore/svg/graphics/cg/RenderPathCg.cpp b/WebCore/svg/graphics/cg/RenderPathCg.cpp deleted file mode 100644 index eb8e482..0000000 --- a/WebCore/svg/graphics/cg/RenderPathCg.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. - * (C) 2006 Alexander Kellett <lypanov@kde.org> - * 2006 Rob Buis <buis@kde.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 "config.h" - -#if ENABLE(SVG) -#include "RenderPath.h" - -#include <ApplicationServices/ApplicationServices.h> -#include "CgSupport.h" -#include "GraphicsContext.h" -#include "SVGPaintServer.h" -#include "SVGRenderStyle.h" -#include "SVGStyledElement.h" -#include <wtf/Assertions.h> - -namespace WebCore { - -FloatRect RenderPath::strokeBBox() const -{ - if (style()->svgStyle()->hasStroke()) - return strokeBoundingBox(path(), style(), this); - - return path().boundingRect(); -} - - -bool RenderPath::strokeContains(const FloatPoint& point, bool requiresStroke) const -{ - if (path().isEmpty()) - return false; - - if (requiresStroke && !SVGPaintServer::strokePaintServer(style(), this)) - return false; - - CGMutablePathRef cgPath = path().platformPath(); - - CGContextRef context = scratchContext(); - CGContextSaveGState(context); - - CGContextBeginPath(context); - CGContextAddPath(context, cgPath); - - GraphicsContext gc(context); - applyStrokeStyleToContext(&gc, style(), this); - - bool hitSuccess = CGContextPathContainsPoint(context, point, kCGPathStroke); - CGContextRestoreGState(context); - - return hitSuccess; -} - -} - -#endif // ENABLE(SVG) diff --git a/WebCore/svg/graphics/cg/SVGPaintServerCg.cpp b/WebCore/svg/graphics/cg/SVGPaintServerCg.cpp deleted file mode 100644 index 35eb239..0000000 --- a/WebCore/svg/graphics/cg/SVGPaintServerCg.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - Copyright (C) 2006 Nikolas Zimmermann <wildfox@kde.org> - - This file is part of the KDE project - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) -#include "SVGPaintServer.h" - -#include "GraphicsContext.h" -#include "RenderObject.h" - -namespace WebCore { - -void SVGPaintServer::draw(GraphicsContext*& context, const RenderObject* path, SVGPaintTargetType type) const -{ - if (!setup(context, path, type)) - return; - - renderPath(context, path, type); - teardown(context, path, type); -} - -void SVGPaintServer::teardown(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText) const -{ - // no-op -} - -void SVGPaintServer::renderPath(GraphicsContext*& context, const RenderObject* path, SVGPaintTargetType type) const -{ - RenderStyle* style = path ? path->style() : 0; - CGContextRef contextRef = context->platformContext(); - - if ((type & ApplyToFillTargetType) && (!style || style->svgStyle()->hasFill())) - fillPath(contextRef, path); - - if ((type & ApplyToStrokeTargetType) && (!style || style->svgStyle()->hasStroke())) - strokePath(contextRef, path); -} - -void SVGPaintServer::strokePath(CGContextRef context, const RenderObject*) const -{ - CGContextStrokePath(context); -} - -void SVGPaintServer::clipToStrokePath(CGContextRef context, const RenderObject*) const -{ - CGContextReplacePathWithStrokedPath(context); - CGContextClip(context); -} - -void SVGPaintServer::fillPath(CGContextRef context, const RenderObject* path) const -{ - if (!path || path->style()->svgStyle()->fillRule() == RULE_EVENODD) - CGContextEOFillPath(context); - else - CGContextFillPath(context); -} - -void SVGPaintServer::clipToFillPath(CGContextRef context, const RenderObject* path) const -{ - if (!path || path->style()->svgStyle()->fillRule() == RULE_EVENODD) - CGContextEOClip(context); - else - CGContextClip(context); -} - -} // namespace WebCore - -#endif - -// vim:ts=4:noet diff --git a/WebCore/svg/graphics/cg/SVGPaintServerGradientCg.cpp b/WebCore/svg/graphics/cg/SVGPaintServerGradientCg.cpp deleted file mode 100644 index bfa5017..0000000 --- a/WebCore/svg/graphics/cg/SVGPaintServerGradientCg.cpp +++ /dev/null @@ -1,336 +0,0 @@ -/* - Copyright (C) 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> - - This file is part of the KDE project - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) -#include "SVGPaintServerGradient.h" - -#include "FloatConversion.h" -#include "GraphicsContext.h" -#include "ImageBuffer.h" -#include "RenderObject.h" -#include "SVGGradientElement.h" -#include "SVGPaintServerLinearGradient.h" -#include "SVGPaintServerRadialGradient.h" -#include "SVGRenderSupport.h" - -#include <wtf/MathExtras.h> - -using namespace std; - -namespace WebCore { - -static void releaseCachedStops(void* info) -{ - static_cast<SVGPaintServerGradient::SharedStopCache*>(info)->deref(); -} - -static void cgGradientCallback(void* info, const CGFloat* inValues, CGFloat* outColor) -{ - SVGPaintServerGradient::SharedStopCache* stopsCache = static_cast<SVGPaintServerGradient::SharedStopCache*>(info); - - SVGPaintServerGradient::QuartzGradientStop* stops = stopsCache->m_stops.data(); - - int stopsCount = stopsCache->m_stops.size(); - - CGFloat inValue = inValues[0]; - - if (!stopsCount) { - outColor[0] = 0; - outColor[1] = 0; - outColor[2] = 0; - outColor[3] = 0; - return; - } else if (stopsCount == 1) { - memcpy(outColor, stops[0].colorArray, 4 * sizeof(CGFloat)); - return; - } - - if (!(inValue > stops[0].offset)) - memcpy(outColor, stops[0].colorArray, 4 * sizeof(CGFloat)); - else if (!(inValue < stops[stopsCount - 1].offset)) - memcpy(outColor, stops[stopsCount - 1].colorArray, 4 * sizeof(CGFloat)); - else { - int nextStopIndex = 0; - while ((nextStopIndex < stopsCount) && (stops[nextStopIndex].offset < inValue)) - nextStopIndex++; - - CGFloat* nextColorArray = stops[nextStopIndex].colorArray; - CGFloat* previousColorArray = stops[nextStopIndex - 1].colorArray; - CGFloat diffFromPrevious = inValue - stops[nextStopIndex - 1].offset; - CGFloat percent = diffFromPrevious * stops[nextStopIndex].previousDeltaInverse; - - outColor[0] = ((1.0f - percent) * previousColorArray[0] + percent * nextColorArray[0]); - outColor[1] = ((1.0f - percent) * previousColorArray[1] + percent * nextColorArray[1]); - outColor[2] = ((1.0f - percent) * previousColorArray[2] + percent * nextColorArray[2]); - outColor[3] = ((1.0f - percent) * previousColorArray[3] + percent * nextColorArray[3]); - } - // FIXME: have to handle the spreadMethod()s here SPREADMETHOD_REPEAT, etc. -} - -static CGShadingRef CGShadingRefForLinearGradient(const SVGPaintServerLinearGradient* server) -{ - CGPoint start = CGPoint(server->gradientStart()); - CGPoint end = CGPoint(server->gradientEnd()); - - CGFunctionCallbacks callbacks = {0, cgGradientCallback, releaseCachedStops}; - CGFloat domainLimits[2] = {0, 1}; - CGFloat rangeLimits[8] = {0, 1, 0, 1, 0, 1, 0, 1}; - server->m_stopsCache->ref(); - CGFunctionRef shadingFunction = CGFunctionCreate(server->m_stopsCache.get(), 1, domainLimits, 4, rangeLimits, &callbacks); - - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - CGShadingRef shading = CGShadingCreateAxial(colorSpace, start, end, shadingFunction, true, true); - CGColorSpaceRelease(colorSpace); - CGFunctionRelease(shadingFunction); - return shading; -} - -static CGShadingRef CGShadingRefForRadialGradient(const SVGPaintServerRadialGradient* server) -{ - CGPoint center = CGPoint(server->gradientCenter()); - CGPoint focus = CGPoint(server->gradientFocal()); - double radius = server->gradientRadius(); - - double fdx = focus.x - center.x; - double fdy = focus.y - center.y; - - // Spec: If (fx, fy) lies outside the circle defined by (cx, cy) and r, set (fx, fy) - // to the point of intersection of the line through (fx, fy) and the circle. - if (sqrt(fdx * fdx + fdy * fdy) > radius) { - double angle = atan2(focus.y * 100.0, focus.x * 100.0); - focus.x = narrowPrecisionToCGFloat(cos(angle) * radius); - focus.y = narrowPrecisionToCGFloat(sin(angle) * radius); - } - - CGFunctionCallbacks callbacks = {0, cgGradientCallback, releaseCachedStops}; - CGFloat domainLimits[2] = {0, 1}; - CGFloat rangeLimits[8] = {0, 1, 0, 1, 0, 1, 0, 1}; - server->m_stopsCache->ref(); - CGFunctionRef shadingFunction = CGFunctionCreate(server->m_stopsCache.get(), 1, domainLimits, 4, rangeLimits, &callbacks); - - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - CGShadingRef shading = CGShadingCreateRadial(colorSpace, focus, 0, center, narrowPrecisionToCGFloat(radius), shadingFunction, true, true); - CGColorSpaceRelease(colorSpace); - CGFunctionRelease(shadingFunction); - return shading; -} - -void SVGPaintServerGradient::updateQuartzGradientStopsCache(const Vector<SVGGradientStop>& stops) -{ - m_stopsCache = SharedStopCache::create(); - Vector<QuartzGradientStop>& stopsCache = m_stopsCache->m_stops; - stopsCache.resize(stops.size()); - CGFloat previousOffset = 0.0f; - for (unsigned i = 0; i < stops.size(); ++i) { - CGFloat currOffset = min(max(stops[i].first, previousOffset), static_cast<CGFloat>(1.0)); - stopsCache[i].offset = currOffset; - stopsCache[i].previousDeltaInverse = 1.0f / (currOffset - previousOffset); - previousOffset = currOffset; - CGFloat* ca = stopsCache[i].colorArray; - stops[i].second.getRGBA(ca[0], ca[1], ca[2], ca[3]); - } -} - -void SVGPaintServerGradient::updateQuartzGradientCache(const SVGPaintServerGradient* server) -{ - // cache our own copy of the stops for faster access. - // this is legacy code, probably could be reworked. - if (!m_stopsCache) - updateQuartzGradientStopsCache(gradientStops()); - - CGShadingRelease(m_shadingCache); - - if (type() == RadialGradientPaintServer) { - const SVGPaintServerRadialGradient* radial = static_cast<const SVGPaintServerRadialGradient*>(server); - m_shadingCache = CGShadingRefForRadialGradient(radial); - } else if (type() == LinearGradientPaintServer) { - const SVGPaintServerLinearGradient* linear = static_cast<const SVGPaintServerLinearGradient*>(server); - m_shadingCache = CGShadingRefForLinearGradient(linear); - } -} - -// Helper function for text painting -static inline const RenderObject* findTextRootObject(const RenderObject* start) -{ - while (start && !start->isSVGText()) - start = start->parent(); - - ASSERT(start); - ASSERT(start->isSVGText()); - - return start; -} - -void SVGPaintServerGradient::teardown(GraphicsContext*& context, const RenderObject* object, SVGPaintTargetType type, bool isPaintingText) const -{ - CGShadingRef shading = m_shadingCache; - CGContextRef contextRef = context->platformContext(); - ASSERT(contextRef); - - // As renderPath() is not used when painting text, special logic needed here. - if (isPaintingText) { - if (m_savedContext) { - FloatRect maskBBox = const_cast<RenderObject*>(findTextRootObject(object))->relativeBBox(false); - - // Fixup transformations to be able to clip to mask - AffineTransform transform = object->absoluteTransform(); - FloatRect textBoundary = transform.mapRect(maskBBox); - - IntSize maskSize(lroundf(textBoundary.width()), lroundf(textBoundary.height())); - clampImageBufferSizeToViewport(object->document()->renderer(), maskSize); - - if (maskSize.width() < static_cast<int>(textBoundary.width())) - textBoundary.setWidth(maskSize.width()); - - if (maskSize.height() < static_cast<int>(textBoundary.height())) - textBoundary.setHeight(maskSize.height()); - - // Clip current context to mask image (gradient) - m_savedContext->concatCTM(transform.inverse()); - m_savedContext->clipToImageBuffer(textBoundary, m_imageBuffer); - m_savedContext->concatCTM(transform); - - handleBoundingBoxModeAndGradientTransformation(m_savedContext, maskBBox); - - // Restore on-screen drawing context, after we got the image of the gradient - delete m_imageBuffer; - - context = m_savedContext; - contextRef = context->platformContext(); - - m_savedContext = 0; - m_imageBuffer = 0; - } - } - - CGContextDrawShading(contextRef, shading); - context->restore(); -} - -void SVGPaintServerGradient::renderPath(GraphicsContext*& context, const RenderObject* path, SVGPaintTargetType type) const -{ - RenderStyle* style = path->style(); - CGContextRef contextRef = context->platformContext(); - ASSERT(contextRef); - - bool isFilled = (type & ApplyToFillTargetType) && style->svgStyle()->hasFill(); - - // Compute destination object bounding box - FloatRect objectBBox; - if (boundingBoxMode()) { - FloatRect bbox = path->relativeBBox(false); - if (bbox.width() > 0 && bbox.height() > 0) - objectBBox = bbox; - } - - if (isFilled) - clipToFillPath(contextRef, path); - else - clipToStrokePath(contextRef, path); - - handleBoundingBoxModeAndGradientTransformation(context, objectBBox); -} - -void SVGPaintServerGradient::handleBoundingBoxModeAndGradientTransformation(GraphicsContext* context, const FloatRect& targetRect) const -{ - if (boundingBoxMode()) { - // Choose default gradient bounding box - FloatRect gradientBBox(0.0f, 0.0f, 1.0f, 1.0f); - - // Generate a transform to map between both bounding boxes - context->concatCTM(makeMapBetweenRects(gradientBBox, targetRect)); - } - - // Apply the gradient's own transform - context->concatCTM(gradientTransform()); -} - -bool SVGPaintServerGradient::setup(GraphicsContext*& context, const RenderObject* object, SVGPaintTargetType type, bool isPaintingText) const -{ - m_ownerElement->buildGradient(); - - // We need a hook to call this when the gradient gets updated, before drawn. - if (!m_shadingCache) - const_cast<SVGPaintServerGradient*>(this)->updateQuartzGradientCache(this); - - CGContextRef contextRef = context->platformContext(); - ASSERT(contextRef); - - RenderStyle* style = object->style(); - - bool isFilled = (type & ApplyToFillTargetType) && style->svgStyle()->hasFill(); - bool isStroked = (type & ApplyToStrokeTargetType) && style->svgStyle()->hasStroke(); - - ASSERT(isFilled && !isStroked || !isFilled && isStroked); - - context->save(); - CGContextSetAlpha(contextRef, isFilled ? style->svgStyle()->fillOpacity() : style->svgStyle()->strokeOpacity()); - - if (isPaintingText) { - FloatRect maskBBox = const_cast<RenderObject*>(findTextRootObject(object))->relativeBBox(false); - IntRect maskRect = enclosingIntRect(object->absoluteTransform().mapRect(maskBBox)); - - IntSize maskSize(maskRect.width(), maskRect.height()); - clampImageBufferSizeToViewport(object->document()->renderer(), maskSize); - - auto_ptr<ImageBuffer> maskImage = ImageBuffer::create(maskSize, false); - - if (!maskImage.get()) { - context->restore(); - return false; - } - - GraphicsContext* maskImageContext = maskImage->context(); - maskImageContext->save(); - - maskImageContext->setTextDrawingMode(isFilled ? cTextFill : cTextStroke); - maskImageContext->translate(-maskRect.x(), -maskRect.y()); - maskImageContext->concatCTM(object->absoluteTransform()); - - m_imageBuffer = maskImage.release(); - m_savedContext = context; - - context = maskImageContext; - contextRef = context->platformContext(); - } - - if (isStroked) - applyStrokeStyleToContext(context, style, object); - - return true; -} - -void SVGPaintServerGradient::invalidate() -{ - SVGPaintServer::invalidate(); - - // Invalidate caches - CGShadingRelease(m_shadingCache); - - m_stopsCache = 0; - m_shadingCache = 0; -} - -} // namespace WebCore - -#endif diff --git a/WebCore/svg/graphics/cg/SVGPaintServerPatternCg.cpp b/WebCore/svg/graphics/cg/SVGPaintServerPatternCg.cpp deleted file mode 100644 index 416d5fe..0000000 --- a/WebCore/svg/graphics/cg/SVGPaintServerPatternCg.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* - Copyright (C) 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - - This file is part of the KDE project - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) -#include "SVGPaintServerPattern.h" - -#include "CgSupport.h" -#include "GraphicsContext.h" -#include "ImageBuffer.h" -#include "RenderObject.h" -#include "SVGPatternElement.h" - -namespace WebCore { - -static void patternCallback(void* info, CGContextRef context) -{ - ImageBuffer* patternImage = reinterpret_cast<ImageBuffer*>(info); - CGContextSaveGState(context); - CGContextTranslateCTM(context, 0, patternImage->size().height()); - CGContextScaleCTM(context, 1.0f, -1.0f); - CGContextDrawImage(context, CGRect(FloatRect(FloatPoint(), patternImage->size())), patternImage->image()->getCGImageRef()); - CGContextRestoreGState(context); -} - -bool SVGPaintServerPattern::setup(GraphicsContext*& context, const RenderObject* object, SVGPaintTargetType type, bool isPaintingText) const -{ - CGContextRef contextRef = context->platformContext(); - - // Build pattern tile, passing destination object bounding box - FloatRect targetRect; - if (isPaintingText) { - IntRect textBoundary = const_cast<RenderObject*>(object)->absoluteBoundingBoxRect(); - targetRect = object->absoluteTransform().inverse().mapRect(textBoundary); - } else - targetRect = object->relativeBBox(false); - - m_ownerElement->buildPattern(targetRect); - - if (!tile()) - return false; - - context->save(); - - // Respect local pattern transformation - context->concatCTM(patternTransform()); - - // Apply pattern space transformation - context->translate(patternBoundaries().x(), patternBoundaries().y()); - - // Crude hack to support overflow="visible". - // When the patternBoundaries() size is smaller than the actual tile() size, we run into a problem: - // Our tile contains content which is larger than the pattern cell size. We just draw the pattern - // "out of" cell boundaries, to draw the overflown content, instead of clipping it away. The uppermost - // cell doesn't include the overflown content of the cell right above it though -> that's why we're moving - // down the phase by a very small amount, so we're sure the "cell right above"'s overflown content gets drawn. - CGContextSetPatternPhase(contextRef, CGSizeMake(0.0f, -0.01f)); - - RenderStyle* style = object->style(); - CGContextSetAlpha(contextRef, style->opacity()); - - CGPatternCallbacks callbacks = {0, patternCallback, 0}; - - ASSERT(!m_pattern); - m_pattern = CGPatternCreate(tile(), - CGRect(FloatRect(FloatPoint(), tile()->size())), - CGContextGetCTM(contextRef), - patternBoundaries().width(), - patternBoundaries().height(), - kCGPatternTilingConstantSpacing, - true, // has color - &callbacks); - - if (!m_patternSpace) - m_patternSpace = CGColorSpaceCreatePattern(0); - - if ((type & ApplyToFillTargetType) && style->svgStyle()->hasFill()) { - CGFloat alpha = style->svgStyle()->fillOpacity(); - CGContextSetFillColorSpace(contextRef, m_patternSpace); - CGContextSetFillPattern(contextRef, m_pattern, &alpha); - - if (isPaintingText) - context->setTextDrawingMode(cTextFill); - } - - if ((type & ApplyToStrokeTargetType) && style->svgStyle()->hasStroke()) { - CGFloat alpha = style->svgStyle()->strokeOpacity(); - CGContextSetStrokeColorSpace(contextRef, m_patternSpace); - CGContextSetStrokePattern(contextRef, m_pattern, &alpha); - applyStrokeStyleToContext(context, style, object); - - if (isPaintingText) - context->setTextDrawingMode(cTextStroke); - } - - return true; -} - -void SVGPaintServerPattern::teardown(GraphicsContext*& context, const RenderObject*, SVGPaintTargetType, bool) const -{ - CGPatternRelease(m_pattern); - m_pattern = 0; - - context->restore(); -} - -} // namespace WebCore - -#endif - -// vim:ts=4:noet diff --git a/WebCore/svg/graphics/cg/SVGPaintServerSolidCg.cpp b/WebCore/svg/graphics/cg/SVGPaintServerSolidCg.cpp deleted file mode 100644 index bd2a56f..0000000 --- a/WebCore/svg/graphics/cg/SVGPaintServerSolidCg.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright (C) 2006 Nikolas Zimmermann <wildfox@kde.org> - - This file is part of the KDE project - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) -#include "SVGPaintServerSolid.h" - -#include "Color.h" -#include "CgSupport.h" -#include "GraphicsContext.h" -#include "RenderObject.h" - -namespace WebCore { - -bool SVGPaintServerSolid::setup(GraphicsContext*& context, const RenderObject* object, SVGPaintTargetType type, bool isPaintingText) const -{ - // FIXME: This function does not use any CG-specific calls, however it's not yet - // cross platform, because CG handles fill rule different from other graphics - // platforms. CG makes you use two separate fill calls, other platforms set - // the fill rule state on the context and then call a generic "fillPath" - - RenderStyle* style = object ? object->style() : 0; - - if ((type & ApplyToFillTargetType) && (!style || style->svgStyle()->hasFill())) { - RGBA32 rgba = color().rgb(); - ASSERT(!color().hasAlpha()); - if (style) - rgba = colorWithOverrideAlpha(rgba, style->svgStyle()->fillOpacity()); - - context->setFillColor(rgba); - - if (isPaintingText) - context->setTextDrawingMode(cTextFill); - } - - if ((type & ApplyToStrokeTargetType) && (!style || style->svgStyle()->hasStroke())) { - RGBA32 rgba = color().rgb(); - ASSERT(!color().hasAlpha()); - if (style) - rgba = colorWithOverrideAlpha(rgba, style->svgStyle()->strokeOpacity()); - - context->setStrokeColor(rgba); - - if (style) - applyStrokeStyleToContext(context, style, object); - - if (isPaintingText) - context->setTextDrawingMode(cTextStroke); - } - - return true; -} - -} // namespace WebCore - -#endif - -// vim:ts=4:noet diff --git a/WebCore/svg/graphics/cg/SVGResourceClipperCg.cpp b/WebCore/svg/graphics/cg/SVGResourceClipperCg.cpp deleted file mode 100644 index b04a0dc..0000000 --- a/WebCore/svg/graphics/cg/SVGResourceClipperCg.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. - * 2005 Alexander Kellett <lypanov@kde.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 "config.h" - -#if ENABLE(SVG) -#include "SVGResourceClipper.h" - -#include "AffineTransform.h" -#include "GraphicsContext.h" - -#include <ApplicationServices/ApplicationServices.h> - -namespace WebCore { - -void SVGResourceClipper::applyClip(GraphicsContext* context, const FloatRect& boundingBox) const -{ - if (m_clipData.clipData().size() < 1) - return; - - bool heterogenousClipRules = false; - WindRule clipRule = m_clipData.clipData()[0].windRule; - - context->beginPath(); - - AffineTransform bboxTransform = makeMapBetweenRects(FloatRect(0.0f, 0.0f, 1.0f, 1.0f), boundingBox); - - for (unsigned x = 0; x < m_clipData.clipData().size(); x++) { - ClipData data = m_clipData.clipData()[x]; - if (data.windRule != clipRule) - heterogenousClipRules = true; - - Path clipPath = data.path; - - if (data.bboxUnits) - clipPath.transform(bboxTransform); - - context->addPath(clipPath); - } - - CGContextRef cgContext = context->platformContext(); - if (m_clipData.clipData().size()) { - // FIXME! - // We don't currently allow for heterogenous clip rules. - // we would have to detect such, draw to a mask, and then clip - // to that mask - if (!CGContextIsPathEmpty(cgContext)) { - if (clipRule == RULE_EVENODD) - CGContextEOClip(cgContext); - else - CGContextClip(cgContext); - } - } -} - -} // namespace WebCore - -#endif // ENABLE(SVG) diff --git a/WebCore/svg/graphics/cg/SVGResourceFilterCg.cpp b/WebCore/svg/graphics/cg/SVGResourceFilterCg.cpp deleted file mode 100644 index ecfcdd8..0000000 --- a/WebCore/svg/graphics/cg/SVGResourceFilterCg.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved. - * Copyright (C) 2006 Dave MacLachlan (dmaclach@mac.com) - * 2006 Rob Buis <buis@kde.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 "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "NotImplemented.h" -#include "SVGResourceFilter.h" - -namespace WebCore { - -SVGResourceFilterPlatformData* SVGResourceFilter::createPlatformData() -{ - return 0; -} - -void SVGResourceFilter::prepareFilter(GraphicsContext*&, const FloatRect&) -{ - notImplemented(); -} - -void SVGResourceFilter::applyFilter(GraphicsContext*&, const FloatRect&) -{ - notImplemented(); -} - -} - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/cg/SVGResourceFilterCg.mm b/WebCore/svg/graphics/cg/SVGResourceFilterCg.mm deleted file mode 100644 index f3dc819..0000000 --- a/WebCore/svg/graphics/cg/SVGResourceFilterCg.mm +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. - * (C) 2007 Nikolas Zimmermann <zimmermann@kde.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 "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "SVGResourceFilter.h" - -#include "AffineTransform.h" -#include "FoundationExtras.h" -#include "GraphicsContext.h" - -#include "SVGResourceFilterPlatformDataMac.h" - -#include <QuartzCore/CoreImage.h> - -// Setting to a value > 0 allows to dump the output image as JPEG. -#define DEBUG_OUTPUT_IMAGE 0 - -namespace WebCore { - -SVGResourceFilterPlatformData* SVGResourceFilter::createPlatformData() -{ - 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 - // of cgContext due to it being created on an autorelease pool, and released - // after CGEndTransparencyLayer. Create local pool to fix. - // <http://bugs.webkit.org/show_bug.cgi?id=8425> - // <http://bugs.webkit.org/show_bug.cgi?id=6947> - // <rdar://problem/4647735> - NSAutoreleasePool* filterContextPool = [[NSAutoreleasePool alloc] init]; - platform->m_filterCIContext = HardRetain([CIContext contextWithCGContext:cgContext options:nil]); - [filterContextPool drain]; - - FloatRect filterRect = filterBBoxForItemBBox(bbox); - - // TODO: Ensure the size is not greater than the nearest <svg> size and/or the window size. - // This is also needed for masking & gradients-on-stroke-of-text. File a bug on this. - float width = filterRect.width(); - float height = filterRect.height(); - - platform->m_filterCGLayer = [platform->m_filterCIContext createCGLayerWithSize:CGSizeMake(width, height) info:NULL]; - - context = new GraphicsContext(CGLayerGetContext(platform->m_filterCGLayer)); - context->save(); - - context->translate(-filterRect.x(), -filterRect.y()); -} - -#ifndef NDEBUG -// Extremly helpful debugging utilities for any paint server / resource that creates -// internal image buffers (ie. gradients on text, masks, filters...) -void dumpCIOutputImage(CIImage* outputImage, NSString* fileName) -{ - CGSize extentSize = [outputImage extent].size; - NSImage* image = [[[NSImage alloc] initWithSize:NSMakeSize(extentSize.width, extentSize.height)] autorelease]; - [image addRepresentation:[NSCIImageRep imageRepWithCIImage:outputImage]]; - - NSData* imageData = [image TIFFRepresentation]; - NSBitmapImageRep* imageRep = [NSBitmapImageRep imageRepWithData:imageData]; - imageData = [imageRep representationUsingType:NSJPEGFileType properties:nil]; - - [imageData writeToFile:fileName atomically:YES]; -} - -void dumpCGOutputImage(CGImage* outputImage, NSString* fileName) -{ - if (CIImage* ciOutputImage = [CIImage imageWithCGImage:outputImage]) - dumpCIOutputImage(ciOutputImage, fileName); -} -#endif - -void SVGResourceFilter::applyFilter(GraphicsContext*& context, const FloatRect& bbox) -{ - if (bbox.isEmpty() || m_effects.isEmpty()) - return; - - SVGResourceFilterPlatformDataMac* platform = static_cast<SVGResourceFilterPlatformDataMac*>(platformData()); - - // actually apply the filter effects - CIImage* inputImage = [CIImage imageWithCGLayer:platform->m_filterCGLayer]; - NSArray* filterStack = platform->getCIFilterStack(inputImage, bbox); - if ([filterStack count]) { - CIImage* outputImage = [[filterStack lastObject] valueForKey:@"outputImage"]; - - if (outputImage) { -#if DEBUG_OUTPUT_IMAGE > 0 - dumpOutputImage(outputImage); -#endif - - FloatRect filterRect = filterBBoxForItemBBox(bbox); - FloatPoint destOrigin = filterRect.location(); - filterRect.setLocation(FloatPoint(0.0f, 0.0f)); - - [platform->m_filterCIContext drawImage:outputImage atPoint:CGPoint(destOrigin) fromRect:filterRect]; - } - } - - CGLayerRelease(platform->m_filterCGLayer); - platform->m_filterCGLayer = 0; - - HardRelease(platform->m_filterCIContext); - platform->m_filterCIContext = 0; - - delete context; - context = 0; -} - -} - -#endif // ENABLE(SVG) ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/cg/SVGResourceMaskerCg.cpp b/WebCore/svg/graphics/cg/SVGResourceMaskerCg.cpp deleted file mode 100644 index 4d2100b..0000000 --- a/WebCore/svg/graphics/cg/SVGResourceMaskerCg.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. - * - * 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 "config.h" - -#if ENABLE(SVG) -#include "SVGResourceMasker.h" -#include "NotImplemented.h" - -namespace WebCore { - -void SVGResourceMasker::applyMask(GraphicsContext*, const FloatRect&) -{ - notImplemented(); -} - -} // namespace WebCore - -#endif // ENABLE(SVG) diff --git a/WebCore/svg/graphics/cg/SVGResourceMaskerCg.mm b/WebCore/svg/graphics/cg/SVGResourceMaskerCg.mm deleted file mode 100644 index f867f9c..0000000 --- a/WebCore/svg/graphics/cg/SVGResourceMaskerCg.mm +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (C) 2005, 2006 Alexander Kellett <lypanov@kde.org> - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.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 "config.h" - -#if ENABLE(SVG) -#import "SVGResourceMasker.h" - -#import "BlockExceptions.h" -#import "CgSupport.h" -#import "GraphicsContext.h" -#import "ImageBuffer.h" -#import "SVGMaskElement.h" -#import "SVGRenderSupport.h" -#import "SVGRenderStyle.h" -#import "SVGResourceFilter.h" -#import <QuartzCore/CIFilter.h> -#import <QuartzCore/CoreImage.h> - -using namespace std; - -namespace WebCore { - -static CIImage* applyLuminanceToAlphaFilter(CIImage* inputImage) -{ - CIFilter* luminanceToAlpha = [CIFilter filterWithName:@"CIColorMatrix"]; - [luminanceToAlpha setDefaults]; - CGFloat alpha[4] = {0.2125f, 0.7154f, 0.0721f, 0.0f}; - CGFloat zero[4] = {0.0f, 0.0f, 0.0f, 0.0f}; - [luminanceToAlpha setValue:inputImage forKey:@"inputImage"]; - [luminanceToAlpha setValue:[CIVector vectorWithValues:zero count:4] forKey:@"inputRVector"]; - [luminanceToAlpha setValue:[CIVector vectorWithValues:zero count:4] forKey:@"inputGVector"]; - [luminanceToAlpha setValue:[CIVector vectorWithValues:zero count:4] forKey:@"inputBVector"]; - [luminanceToAlpha setValue:[CIVector vectorWithValues:alpha count:4] forKey:@"inputAVector"]; - [luminanceToAlpha setValue:[CIVector vectorWithValues:zero count:4] forKey:@"inputBiasVector"]; - return [luminanceToAlpha valueForKey:@"outputImage"]; -} - -static CIImage* applyExpandAlphatoGrayscaleFilter(CIImage* inputImage) -{ - CIFilter* alphaToGrayscale = [CIFilter filterWithName:@"CIColorMatrix"]; - CGFloat zero[4] = {0, 0, 0, 0}; - [alphaToGrayscale setDefaults]; - [alphaToGrayscale setValue:inputImage forKey:@"inputImage"]; - [alphaToGrayscale setValue:[CIVector vectorWithValues:zero count:4] forKey:@"inputRVector"]; - [alphaToGrayscale setValue:[CIVector vectorWithValues:zero count:4] forKey:@"inputGVector"]; - [alphaToGrayscale setValue:[CIVector vectorWithValues:zero count:4] forKey:@"inputBVector"]; - [alphaToGrayscale setValue:[CIVector vectorWithX:0.0f Y:0.0f Z:0.0f W:1.0f] forKey:@"inputAVector"]; - [alphaToGrayscale setValue:[CIVector vectorWithX:1.0f Y:1.0f Z:1.0f W:0.0f] forKey:@"inputBiasVector"]; - return [alphaToGrayscale valueForKey:@"outputImage"]; -} - -static CIImage* transformImageIntoGrayscaleMask(CIImage* inputImage) -{ - CIFilter* blackBackground = [CIFilter filterWithName:@"CIConstantColorGenerator"]; - [blackBackground setValue:[CIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:1.0f] forKey:@"inputColor"]; - - CIFilter* layerOverBlack = [CIFilter filterWithName:@"CISourceOverCompositing"]; - [layerOverBlack setValue:[blackBackground valueForKey:@"outputImage"] forKey:@"inputBackgroundImage"]; - [layerOverBlack setValue:inputImage forKey:@"inputImage"]; - - CIImage* luminanceAlpha = applyLuminanceToAlphaFilter([layerOverBlack valueForKey:@"outputImage"]); - CIImage* luminanceAsGrayscale = applyExpandAlphatoGrayscaleFilter(luminanceAlpha); - CIImage* alphaAsGrayscale = applyExpandAlphatoGrayscaleFilter(inputImage); - - CIFilter* multipliedGrayscale = [CIFilter filterWithName:@"CIMultiplyCompositing"]; - [multipliedGrayscale setValue:luminanceAsGrayscale forKey:@"inputBackgroundImage"]; - [multipliedGrayscale setValue:alphaAsGrayscale forKey:@"inputImage"]; - return [multipliedGrayscale valueForKey:@"outputImage"]; -} - -void SVGResourceMasker::applyMask(GraphicsContext* context, const FloatRect& boundingBox) -{ - if (!m_mask) - m_mask.set(m_ownerElement->drawMaskerContent(boundingBox, m_maskRect).release()); - - if (!m_mask) - return; - - IntSize maskSize(static_cast<int>(m_maskRect.width()), static_cast<int>(m_maskRect.height())); - clampImageBufferSizeToViewport(m_ownerElement->document()->renderer(), maskSize); - - // Create new graphics context in gray scale mode for image rendering - auto_ptr<ImageBuffer> grayScaleImage(ImageBuffer::create(maskSize, true)); - if (!grayScaleImage.get()) - return; - - BEGIN_BLOCK_OBJC_EXCEPTIONS - CGContextRef grayScaleContext = grayScaleImage->context()->platformContext(); - CIContext* ciGrayscaleContext = [CIContext contextWithCGContext:grayScaleContext options:nil]; - - // Transform colorized mask to gray scale - CIImage* colorMask = [CIImage imageWithCGImage:m_mask->image()->getCGImageRef()]; - if (!colorMask) - return; - - CIImage* grayScaleMask = transformImageIntoGrayscaleMask(colorMask); - [ciGrayscaleContext drawImage:grayScaleMask atPoint:CGPointZero fromRect:CGRectMake(0, 0, maskSize.width(), maskSize.height())]; - - CGContextClipToMask(context->platformContext(), m_maskRect, grayScaleImage->image()->getCGImageRef()); - END_BLOCK_OBJC_EXCEPTIONS -} - -} // namespace WebCore - -#endif // ENABLE(SVG) diff --git a/WebCore/svg/graphics/filters/SVGDistantLightSource.h b/WebCore/svg/graphics/filters/SVGDistantLightSource.h deleted file mode 100644 index 25c2045..0000000 --- a/WebCore/svg/graphics/filters/SVGDistantLightSource.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com> - 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef SVGDistantLightSource_h -#define SVGDistantLightSource_h - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "SVGLightSource.h" - -namespace WebCore { - - class DistantLightSource : public LightSource { - public: - DistantLightSource(float azimuth, float elevation) - : LightSource(LS_DISTANT) - , m_azimuth(azimuth) - , m_elevation(elevation) - { } - - float azimuth() const { return m_azimuth; } - float elevation() const { return m_elevation; } - - virtual TextStream& externalRepresentation(TextStream&) const; - - private: - float m_azimuth; - float m_elevation; - }; - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#endif // SVGDistantLightSource_h diff --git a/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp b/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp deleted file mode 100644 index 4b82e5a..0000000 --- a/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "SVGFEConvolveMatrix.h" -#include "SVGRenderTreeAsText.h" - -namespace WebCore { - -FEConvolveMatrix::FEConvolveMatrix(FilterEffect* in, FilterEffect* in2, const FloatSize& kernelSize, - const float& divisor, const float& bias, const FloatSize& targetOffset, EdgeModeType edgeMode, - const FloatPoint& kernelUnitLength, bool preserveAlpha, const Vector<float>& kernelMatrix) - : FilterEffect() - , m_in(in) - , m_in2(in2) - , m_kernelSize(kernelSize) - , m_divisor(divisor) - , m_bias(bias) - , m_targetOffset(targetOffset) - , m_edgeMode(edgeMode) - , m_kernelUnitLength(kernelUnitLength) - , m_preserveAlpha(preserveAlpha) - , m_kernelMatrix(kernelMatrix) -{ -} - -PassRefPtr<FEConvolveMatrix> FEConvolveMatrix::create(FilterEffect* in, FilterEffect* in2, const FloatSize& kernelSize, - const float& divisor, const float& bias, const FloatSize& targetOffset, EdgeModeType edgeMode, - const FloatPoint& kernelUnitLength, bool preserveAlpha, const Vector<float>& kernelMatrix) -{ - return adoptRef(new FEConvolveMatrix(in, in2, kernelSize, divisor, bias, targetOffset, edgeMode, kernelUnitLength, - preserveAlpha, kernelMatrix)); -} - - -FloatSize FEConvolveMatrix::kernelSize() const -{ - return m_kernelSize; -} - -void FEConvolveMatrix::setKernelSize(FloatSize kernelSize) -{ - m_kernelSize = kernelSize; -} - -const Vector<float>& FEConvolveMatrix::kernel() const -{ - return m_kernelMatrix; -} - -void FEConvolveMatrix::setKernel(const Vector<float>& kernel) -{ - m_kernelMatrix = kernel; -} - -float FEConvolveMatrix::divisor() const -{ - return m_divisor; -} - -void FEConvolveMatrix::setDivisor(float divisor) -{ - m_divisor = divisor; -} - -float FEConvolveMatrix::bias() const -{ - return m_bias; -} - -void FEConvolveMatrix::setBias(float bias) -{ - m_bias = bias; -} - -FloatSize FEConvolveMatrix::targetOffset() const -{ - return m_targetOffset; -} - -void FEConvolveMatrix::setTargetOffset(FloatSize targetOffset) -{ - m_targetOffset = targetOffset; -} - -EdgeModeType FEConvolveMatrix::edgeMode() const -{ - return m_edgeMode; -} - -void FEConvolveMatrix::setEdgeMode(EdgeModeType edgeMode) -{ - m_edgeMode = edgeMode; -} - -FloatPoint FEConvolveMatrix::kernelUnitLength() const -{ - return m_kernelUnitLength; -} - -void FEConvolveMatrix::setKernelUnitLength(FloatPoint kernelUnitLength) -{ - m_kernelUnitLength = kernelUnitLength; -} - -bool FEConvolveMatrix::preserveAlpha() const -{ - return m_preserveAlpha; -} - -void FEConvolveMatrix::setPreserveAlpha(bool preserveAlpha) -{ - m_preserveAlpha = preserveAlpha; -} - -void FEConvolveMatrix::apply() -{ -} - -void FEConvolveMatrix::dump() -{ -} - -static TextStream& operator<<(TextStream& ts, EdgeModeType t) -{ - switch (t) - { - case EDGEMODE_UNKNOWN: - ts << "UNKNOWN";break; - case EDGEMODE_DUPLICATE: - ts << "DUPLICATE";break; - case EDGEMODE_WRAP: - ts << "WRAP"; break; - case EDGEMODE_NONE: - ts << "NONE"; break; - } - return ts; -} - -TextStream& FEConvolveMatrix::externalRepresentation(TextStream& ts) const -{ - ts << "[type=CONVOLVE-MATRIX] "; - FilterEffect::externalRepresentation(ts); - ts << " [order " << m_kernelSize << "]" - << " [kernel matrix=" << m_kernelMatrix << "]" - << " [divisor=" << m_divisor << "]" - << " [bias=" << m_bias << "]" - << " [target " << m_targetOffset << "]" - << " [edge mode=" << m_edgeMode << "]" - << " [kernel unit length " << m_kernelUnitLength << "]" - << " [preserve alpha=" << m_preserveAlpha << "]"; - return ts; -} - -}; // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h b/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h deleted file mode 100644 index c3eea2b..0000000 --- a/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef SVGFEConvolveMatrix_h -#define SVGFEConvolveMatrix_h - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "FilterEffect.h" -#include "FloatPoint.h" -#include "FloatSize.h" - -#include <wtf/Vector.h> - -namespace WebCore { - - enum EdgeModeType { - EDGEMODE_UNKNOWN = 0, - EDGEMODE_DUPLICATE = 1, - EDGEMODE_WRAP = 2, - EDGEMODE_NONE = 3 - }; - - class FEConvolveMatrix : public FilterEffect { - public: - static PassRefPtr<FEConvolveMatrix> create(FilterEffect*, FilterEffect*, const FloatSize&, - const float&, const float&, const FloatSize&, EdgeModeType, const FloatPoint&, - bool, const Vector<float>&); - - FloatSize kernelSize() const; - void setKernelSize(FloatSize); - - const Vector<float>& kernel() const; - void setKernel(const Vector<float>&); - - float divisor() const; - void setDivisor(float); - - float bias() const; - void setBias(float); - - FloatSize targetOffset() const; - void setTargetOffset(FloatSize); - - EdgeModeType edgeMode() const; - void setEdgeMode(EdgeModeType); - - FloatPoint kernelUnitLength() const; - void setKernelUnitLength(FloatPoint); - - bool preserveAlpha() const; - void setPreserveAlpha(bool); - - virtual void apply(); - virtual void dump(); - TextStream& externalRepresentation(TextStream& ts) const; - - private: - FEConvolveMatrix(FilterEffect*, FilterEffect*, const FloatSize&, const float&, const float&, - const FloatSize&, EdgeModeType, const FloatPoint&, bool, const Vector<float>&); - - RefPtr<FilterEffect> m_in; - RefPtr<FilterEffect> m_in2; - FloatSize m_kernelSize; - float m_divisor; - float m_bias; - FloatSize m_targetOffset; - EdgeModeType m_edgeMode; - FloatPoint m_kernelUnitLength; - bool m_preserveAlpha; - Vector<float> m_kernelMatrix; - }; - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#endif // SVGFEConvolveMatrix_h diff --git a/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp b/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp deleted file mode 100644 index 6399c5e..0000000 --- a/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "SVGLightSource.h" -#include "SVGFEDiffuseLighting.h" -#include "SVGRenderTreeAsText.h" - -namespace WebCore { - -FEDiffuseLighting::FEDiffuseLighting(FilterEffect* in , const Color& lightingColor, const float& surfaceScale, - const float& diffuseConstant, const float& kernelUnitLengthX, const float& kernelUnitLengthY, LightSource* lightSource) - : FilterEffect() - , m_in(in) - , m_lightingColor(lightingColor) - , m_surfaceScale(surfaceScale) - , m_diffuseConstant(diffuseConstant) - , m_kernelUnitLengthX(kernelUnitLengthX) - , m_kernelUnitLengthY(kernelUnitLengthY) - , m_lightSource(lightSource) -{ -} - -PassRefPtr<FEDiffuseLighting> FEDiffuseLighting::create(FilterEffect* in , const Color& lightingColor, - const float& surfaceScale, const float& diffuseConstant, const float& kernelUnitLengthX, - const float& kernelUnitLengthY, LightSource* lightSource) -{ - return adoptRef(new FEDiffuseLighting(in, lightingColor, surfaceScale, diffuseConstant, kernelUnitLengthX, kernelUnitLengthY, lightSource)); -} - -FEDiffuseLighting::~FEDiffuseLighting() -{ -} - -Color FEDiffuseLighting::lightingColor() const -{ - return m_lightingColor; -} - -void FEDiffuseLighting::setLightingColor(const Color& lightingColor) -{ - m_lightingColor = lightingColor; -} - -float FEDiffuseLighting::surfaceScale() const -{ - return m_surfaceScale; -} - -void FEDiffuseLighting::setSurfaceScale(float surfaceScale) -{ - m_surfaceScale = surfaceScale; -} - -float FEDiffuseLighting::diffuseConstant() const -{ - return m_diffuseConstant; -} - -void FEDiffuseLighting::setDiffuseConstant(float diffuseConstant) -{ - m_diffuseConstant = diffuseConstant; -} - -float FEDiffuseLighting::kernelUnitLengthX() const -{ - return m_kernelUnitLengthX; -} - -void FEDiffuseLighting::setKernelUnitLengthX(float kernelUnitLengthX) -{ - m_kernelUnitLengthX = kernelUnitLengthX; -} - -float FEDiffuseLighting::kernelUnitLengthY() const -{ - return m_kernelUnitLengthY; -} - -void FEDiffuseLighting::setKernelUnitLengthY(float kernelUnitLengthY) -{ - m_kernelUnitLengthY = kernelUnitLengthY; -} - -const LightSource* FEDiffuseLighting::lightSource() const -{ - return m_lightSource.get(); -} - -void FEDiffuseLighting::setLightSource(LightSource* lightSource) -{ - m_lightSource = lightSource; -} - -void FEDiffuseLighting::apply() -{ -} - -void FEDiffuseLighting::dump() -{ -} - -TextStream& FEDiffuseLighting::externalRepresentation(TextStream& ts) const -{ - ts << "[type=DIFFUSE-LIGHTING] "; - FilterEffect::externalRepresentation(ts); - ts << " [surface scale=" << m_surfaceScale << "]" - << " [diffuse constant=" << m_diffuseConstant << "]" - << " [kernel unit length " << m_kernelUnitLengthX << ", " << m_kernelUnitLengthY << "]"; - return ts; -} - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h b/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h deleted file mode 100644 index a817ce2..0000000 --- a/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef SVGFEDiffuseLighting_h -#define SVGFEDiffuseLighting_h - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "Color.h" -#include "FilterEffect.h" - -namespace WebCore { - - class LightSource; - - class FEDiffuseLighting : public FilterEffect { - public: - static PassRefPtr<FEDiffuseLighting> create(FilterEffect*, const Color&, const float&, const float&, - const float&, const float&, LightSource*); - virtual ~FEDiffuseLighting(); - - Color lightingColor() const; - void setLightingColor(const Color&); - - float surfaceScale() const; - void setSurfaceScale(float); - - float diffuseConstant() const; - void setDiffuseConstant(float); - - float kernelUnitLengthX() const; - void setKernelUnitLengthX(float); - - float kernelUnitLengthY() const; - void setKernelUnitLengthY(float); - - const LightSource* lightSource() const; - void setLightSource(LightSource*); - - virtual void apply(); - virtual void dump(); - TextStream& externalRepresentation(TextStream& ts) const; - - private: - FEDiffuseLighting(FilterEffect*, const Color&, const float&, const float&, - const float&, const float&, LightSource*); - - RefPtr<FilterEffect> m_in; - Color m_lightingColor; - float m_surfaceScale; - float m_diffuseConstant; - float m_kernelUnitLengthX; - float m_kernelUnitLengthY; - RefPtr<LightSource> m_lightSource; - }; - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#endif // SVGFEDiffuseLighting_h diff --git a/WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp b/WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp deleted file mode 100644 index f7996e3..0000000 --- a/WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "SVGFEDisplacementMap.h" -#include "SVGRenderTreeAsText.h" - -namespace WebCore { - -FEDisplacementMap::FEDisplacementMap(FilterEffect* in, FilterEffect* in2, ChannelSelectorType xChannelSelector, - ChannelSelectorType yChannelSelector, const float& scale) - : FilterEffect() - , m_in(in) - , m_in2(in2) - , m_xChannelSelector(xChannelSelector) - , m_yChannelSelector(yChannelSelector) - , m_scale(scale) -{ -} - -PassRefPtr<FEDisplacementMap> FEDisplacementMap::create(FilterEffect* in, FilterEffect* in2, - ChannelSelectorType xChannelSelector, ChannelSelectorType yChannelSelector, const float& scale) -{ - return adoptRef(new FEDisplacementMap(in, in2, xChannelSelector, yChannelSelector, scale)); -} - -ChannelSelectorType FEDisplacementMap::xChannelSelector() const -{ - return m_xChannelSelector; -} - -void FEDisplacementMap::setXChannelSelector(const ChannelSelectorType xChannelSelector) -{ - m_xChannelSelector = xChannelSelector; -} - -ChannelSelectorType FEDisplacementMap::yChannelSelector() const -{ - return m_yChannelSelector; -} - -void FEDisplacementMap::setYChannelSelector(const ChannelSelectorType yChannelSelector) -{ - m_yChannelSelector = yChannelSelector; -} - -float FEDisplacementMap::scale() const -{ - return m_scale; -} - -void FEDisplacementMap::setScale(float scale) -{ - m_scale = scale; -} - -void FEDisplacementMap::apply() -{ -} - -void FEDisplacementMap::dump() -{ -} - -static TextStream& operator<<(TextStream& ts, ChannelSelectorType t) -{ - switch (t) - { - case CHANNEL_UNKNOWN: - ts << "UNKNOWN"; break; - case CHANNEL_R: - ts << "RED"; break; - case CHANNEL_G: - ts << "GREEN"; break; - case CHANNEL_B: - ts << "BLUE"; break; - case CHANNEL_A: - ts << "ALPHA"; break; - } - return ts; -} - -TextStream& FEDisplacementMap::externalRepresentation(TextStream& ts) const -{ - ts << "[type=DISPLACEMENT-MAP] "; - FilterEffect::externalRepresentation(ts); - ts << " [in2=" << m_in2.get() << "]" - << " [scale=" << m_scale << "]" - << " [x channel selector=" << m_xChannelSelector << "]" - << " [y channel selector=" << m_yChannelSelector << "]"; - return ts; -} - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFEDisplacementMap.h b/WebCore/svg/graphics/filters/SVGFEDisplacementMap.h deleted file mode 100644 index 0218d57..0000000 --- a/WebCore/svg/graphics/filters/SVGFEDisplacementMap.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef SVGFEDisplacementMap_h -#define SVGFEDisplacementMap_h - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "PlatformString.h" -#include "FilterEffect.h" - -namespace WebCore { - - enum ChannelSelectorType { - CHANNEL_UNKNOWN = 0, - CHANNEL_R = 1, - CHANNEL_G = 2, - CHANNEL_B = 3, - CHANNEL_A = 4 - }; - - class FEDisplacementMap : public FilterEffect { - public: - static PassRefPtr<FEDisplacementMap> create(FilterEffect*, FilterEffect*, ChannelSelectorType, - ChannelSelectorType, const float&); - - ChannelSelectorType xChannelSelector() const; - void setXChannelSelector(const ChannelSelectorType); - - ChannelSelectorType yChannelSelector() const; - void setYChannelSelector(const ChannelSelectorType); - - float scale() const; - void setScale(float scale); - - virtual void apply(); - virtual void dump(); - TextStream& externalRepresentation(TextStream& ts) const; - - private: - FEDisplacementMap(FilterEffect*, FilterEffect*, ChannelSelectorType, - ChannelSelectorType, const float&); - - RefPtr<FilterEffect> m_in; - RefPtr<FilterEffect> m_in2; - ChannelSelectorType m_xChannelSelector; - ChannelSelectorType m_yChannelSelector; - float m_scale; - }; - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#endif // SVGFEDisplacementMap_h diff --git a/WebCore/svg/graphics/filters/SVGFEFlood.cpp b/WebCore/svg/graphics/filters/SVGFEFlood.cpp deleted file mode 100644 index 3d52f63..0000000 --- a/WebCore/svg/graphics/filters/SVGFEFlood.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "SVGFEFlood.h" -#include "SVGRenderTreeAsText.h" - -namespace WebCore { - -FEFlood::FEFlood(const Color& floodColor, const float& floodOpacity) - : FilterEffect() - , m_floodColor(floodColor) - , m_floodOpacity(floodOpacity) -{ -} - -PassRefPtr<FEFlood> FEFlood::create(const Color& floodColor, const float& floodOpacity) -{ - return adoptRef(new FEFlood(floodColor, floodOpacity)); -} - -Color FEFlood::floodColor() const -{ - return m_floodColor; -} - -void FEFlood::setFloodColor(const Color& color) -{ - m_floodColor = color; -} - -float FEFlood::floodOpacity() const -{ - return m_floodOpacity; -} - -void FEFlood::setFloodOpacity(float floodOpacity) -{ - m_floodOpacity = floodOpacity; -} - -void FEFlood::apply() -{ -} - -void FEFlood::dump() -{ -} - -TextStream& FEFlood::externalRepresentation(TextStream& ts) const -{ - ts << "[type=FLOOD] "; - FilterEffect::externalRepresentation(ts); - ts << " [color=" << floodColor() << "]" - << " [opacity=" << floodOpacity() << "]"; - return ts; -} - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFEFlood.h b/WebCore/svg/graphics/filters/SVGFEFlood.h deleted file mode 100644 index 0558774..0000000 --- a/WebCore/svg/graphics/filters/SVGFEFlood.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef SVGFEFlood_h -#define SVGFEFlood_h - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "Color.h" -#include "FilterEffect.h" - -namespace WebCore { - - class FEFlood : public FilterEffect { - public: - static PassRefPtr<FEFlood> create(const Color&, const float&); - - Color floodColor() const; - void setFloodColor(const Color &); - - float floodOpacity() const; - void setFloodOpacity(float); - - virtual void apply(); - virtual void dump(); - TextStream& externalRepresentation(TextStream& ts) const; - - private: - FEFlood(const Color&, const float&); - - Color m_floodColor; - float m_floodOpacity; - }; - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#endif // SVGFEFlood_h diff --git a/WebCore/svg/graphics/filters/SVGFEGaussianBlur.cpp b/WebCore/svg/graphics/filters/SVGFEGaussianBlur.cpp deleted file mode 100644 index 4e64c58..0000000 --- a/WebCore/svg/graphics/filters/SVGFEGaussianBlur.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "SVGFEGaussianBlur.h" -#include "SVGRenderTreeAsText.h" - -namespace WebCore { - -FEGaussianBlur::FEGaussianBlur(FilterEffect* in, const float& x, const float& y) - : FilterEffect() - , m_in(in) - , m_x(x) - , m_y(y) -{ -} - -PassRefPtr<FEGaussianBlur> FEGaussianBlur::create(FilterEffect* in, const float& x, const float& y) -{ - return adoptRef(new FEGaussianBlur(in, x, y)); -} - -float FEGaussianBlur::stdDeviationX() const -{ - return m_x; -} - -void FEGaussianBlur::setStdDeviationX(float x) -{ - m_x = x; -} - -float FEGaussianBlur::stdDeviationY() const -{ - return m_y; -} - -void FEGaussianBlur::setStdDeviationY(float y) -{ - m_y = y; -} - -void FEGaussianBlur::apply() -{ -} - -void FEGaussianBlur::dump() -{ -} - -TextStream& FEGaussianBlur::externalRepresentation(TextStream& ts) const -{ - ts << "[type=GAUSSIAN-BLUR] "; - FilterEffect::externalRepresentation(ts); - ts << " [std dev. x=" << stdDeviationX() << " y=" << stdDeviationY() << "]"; - return ts; -} - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFEGaussianBlur.h b/WebCore/svg/graphics/filters/SVGFEGaussianBlur.h deleted file mode 100644 index 33ad0c7..0000000 --- a/WebCore/svg/graphics/filters/SVGFEGaussianBlur.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef SVGFEGaussianBlur_h -#define SVGFEGaussianBlur_h - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "FilterEffect.h" - -namespace WebCore { - - class FEGaussianBlur : public FilterEffect { - public: - static PassRefPtr<FEGaussianBlur> create(FilterEffect*, const float&, const float&); - - float stdDeviationX() const; - void setStdDeviationX(float); - - float stdDeviationY() const; - void setStdDeviationY(float); - - virtual void apply(); - virtual void dump(); - TextStream& externalRepresentation(TextStream& ts) const; - - private: - FEGaussianBlur(FilterEffect*, const float&, const float&); - - RefPtr<FilterEffect> m_in; - float m_x; - float m_y; - }; - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#endif // SVGFEGaussianBlur_h diff --git a/WebCore/svg/graphics/filters/SVGFEImage.cpp b/WebCore/svg/graphics/filters/SVGFEImage.cpp deleted file mode 100644 index 2bf83be..0000000 --- a/WebCore/svg/graphics/filters/SVGFEImage.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "SVGFEImage.h" -#include "SVGRenderTreeAsText.h" - -namespace WebCore { - -FEImage::FEImage(CachedImage* cachedImage) - : FilterEffect() - , m_cachedImage(cachedImage) -{ -} - -PassRefPtr<FEImage> FEImage::create(CachedImage* cachedImage) -{ - return adoptRef(new FEImage(cachedImage)); -} - -FEImage::~FEImage() -{ - if (m_cachedImage) - m_cachedImage->removeClient(this); -} - -CachedImage* FEImage::cachedImage() const -{ - return m_cachedImage.get(); -} - -void FEImage::setCachedImage(CachedImage* image) -{ - if (m_cachedImage == image) - return; - - if (m_cachedImage) - m_cachedImage->removeClient(this); - - m_cachedImage = image; - - if (m_cachedImage) - m_cachedImage->addClient(this); -} - -void FEImage::apply() -{ -} - -void FEImage::dump() -{ -} - -TextStream& FEImage::externalRepresentation(TextStream& ts) const -{ - ts << "[type=IMAGE] "; - FilterEffect::externalRepresentation(ts); - // FIXME: should this dump also object returned by SVGFEImage::image() ? - return ts; -} - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFEImage.h b/WebCore/svg/graphics/filters/SVGFEImage.h deleted file mode 100644 index fcf413f..0000000 --- a/WebCore/svg/graphics/filters/SVGFEImage.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef SVGFEImage_h -#define SVGFEImage_h - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "CachedImage.h" -#include "CachedResourceClient.h" -#include "CachedResourceHandle.h" -#include "FilterEffect.h" - -namespace WebCore { - - class FEImage : public FilterEffect - , public CachedResourceClient { - public: - static PassRefPtr<FEImage> create(CachedImage*); - virtual ~FEImage(); - - // FIXME: We need to support <svg> (RenderObject*) as well as image data. - - CachedImage* cachedImage() const; - void setCachedImage(CachedImage*); - - virtual void apply(); - virtual void dump(); - TextStream& externalRepresentation(TextStream& ts) const; - - private: - FEImage(CachedImage*); - - CachedResourceHandle<CachedImage> m_cachedImage; - }; - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#endif // SVGFEImage_h diff --git a/WebCore/svg/graphics/filters/SVGFEMerge.cpp b/WebCore/svg/graphics/filters/SVGFEMerge.cpp deleted file mode 100644 index 8ce15a7..0000000 --- a/WebCore/svg/graphics/filters/SVGFEMerge.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "SVGFEMerge.h" -#include "SVGRenderTreeAsText.h" - -namespace WebCore { - -FEMerge::FEMerge(const Vector<FilterEffect*>& mergeInputs) - : FilterEffect() - , m_mergeInputs(mergeInputs) -{ -} - -PassRefPtr<FEMerge> FEMerge::create(const Vector<FilterEffect*>& mergeInputs) -{ - return adoptRef(new FEMerge(mergeInputs)); -} - -const Vector<FilterEffect*>& FEMerge::mergeInputs() const -{ - return m_mergeInputs; -} - -void FEMerge::setMergeInputs(const Vector<FilterEffect*>& mergeInputs) -{ - m_mergeInputs = mergeInputs; -} - -void FEMerge::apply() -{ -} - -void FEMerge::dump() -{ -} - -TextStream& FEMerge::externalRepresentation(TextStream& ts) const -{ - ts << "[type=MERGE] "; - FilterEffect::externalRepresentation(ts); - ts << "[merge inputs=["; - unsigned x = 0; - unsigned size = m_mergeInputs.size(); - while (x < size) { - ts << m_mergeInputs[x]; - x++; - if (x < m_mergeInputs.size()) - ts << ", "; - } - ts << "]]"; - return ts; -} - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFEMerge.h b/WebCore/svg/graphics/filters/SVGFEMerge.h deleted file mode 100644 index 6415c9f..0000000 --- a/WebCore/svg/graphics/filters/SVGFEMerge.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef SVGFEMerge_h -#define SVGFEMerge_h - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "FilterEffect.h" - -#include <wtf/Vector.h> - -namespace WebCore { - - class FEMerge : public FilterEffect { - public: - static PassRefPtr<FEMerge> create(const Vector<FilterEffect*>&); - - const Vector<FilterEffect*>& mergeInputs() const; - void setMergeInputs(const Vector<FilterEffect*>& mergeInputs); - - virtual void apply(); - virtual void dump(); - TextStream& externalRepresentation(TextStream& ts) const; - - private: - FEMerge(const Vector<FilterEffect*>&); - - Vector<FilterEffect*> m_mergeInputs; - }; - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#endif // SVGFEMerge_h diff --git a/WebCore/svg/graphics/filters/SVGFEMorphology.cpp b/WebCore/svg/graphics/filters/SVGFEMorphology.cpp deleted file mode 100644 index 7838a8c..0000000 --- a/WebCore/svg/graphics/filters/SVGFEMorphology.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "SVGFEMorphology.h" -#include "SVGRenderTreeAsText.h" - -namespace WebCore { - -FEMorphology::FEMorphology(FilterEffect* in, MorphologyOperatorType type, const float& radiusX, const float& radiusY) - : FilterEffect() - , m_in(in) - , m_type(type) - , m_radiusX(radiusX) - , m_radiusY(radiusY) -{ -} - -PassRefPtr<FEMorphology> FEMorphology::create(FilterEffect* in, MorphologyOperatorType type, const float& radiusX, const float& radiusY) -{ - return adoptRef(new FEMorphology(in, type, radiusX, radiusY)); -} - -MorphologyOperatorType FEMorphology::morphologyOperator() const -{ - return m_type; -} - -void FEMorphology::setMorphologyOperator(MorphologyOperatorType type) -{ - m_type = type; -} - -float FEMorphology::radiusX() const -{ - return m_radiusX; -} - -void FEMorphology::setRadiusX(float radiusX) -{ - m_radiusX = radiusX; -} - -float FEMorphology::radiusY() const -{ - return m_radiusY; -} - -void FEMorphology::setRadiusY(float radiusY) -{ - m_radiusY = radiusY; -} - -void FEMorphology::apply() -{ -} - -void FEMorphology::dump() -{ -} - -static TextStream& operator<<(TextStream& ts, MorphologyOperatorType t) -{ - switch (t) - { - case FEMORPHOLOGY_OPERATOR_UNKNOWN: - ts << "UNKNOWN"; break; - case FEMORPHOLOGY_OPERATOR_ERODE: - ts << "ERODE"; break; - case FEMORPHOLOGY_OPERATOR_DIALATE: - ts << "DIALATE"; break; - } - return ts; -} - -TextStream& FEMorphology::externalRepresentation(TextStream& ts) const -{ - ts << "[type=MORPHOLOGY] "; - FilterEffect::externalRepresentation(ts); - ts << " [operator type=" << morphologyOperator() << "]" - << " [radius x=" << radiusX() << " y=" << radiusY() << "]"; - return ts; -} - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFEMorphology.h b/WebCore/svg/graphics/filters/SVGFEMorphology.h deleted file mode 100644 index 98ab633..0000000 --- a/WebCore/svg/graphics/filters/SVGFEMorphology.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef SVGFEMorphology_h -#define SVGFEMorphology_h - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "FilterEffect.h" - -namespace WebCore { - - enum MorphologyOperatorType { - FEMORPHOLOGY_OPERATOR_UNKNOWN = 0, - FEMORPHOLOGY_OPERATOR_ERODE = 1, - FEMORPHOLOGY_OPERATOR_DIALATE = 2 - }; - - class FEMorphology : public FilterEffect { - public: - PassRefPtr<FEMorphology> create(FilterEffect*, MorphologyOperatorType, const float&, const float&); - MorphologyOperatorType morphologyOperator() const; - void setMorphologyOperator(MorphologyOperatorType); - - float radiusX() const; - void setRadiusX(float); - - float radiusY() const; - void setRadiusY(float); - - virtual void apply(); - virtual void dump(); - TextStream& externalRepresentation(TextStream& ts) const; - - private: - FEMorphology(FilterEffect*, MorphologyOperatorType, const float&, const float&); - - RefPtr<FilterEffect> m_in; - MorphologyOperatorType m_type; - float m_radiusX; - float m_radiusY; - }; - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#endif // SVGFEMorphology_h diff --git a/WebCore/svg/graphics/filters/SVGFEOffset.cpp b/WebCore/svg/graphics/filters/SVGFEOffset.cpp deleted file mode 100644 index c2a0fc9..0000000 --- a/WebCore/svg/graphics/filters/SVGFEOffset.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "SVGFEOffset.h" -#include "SVGRenderTreeAsText.h" - -namespace WebCore { - -FEOffset::FEOffset(FilterEffect* in, const float& dx, const float& dy) - : FilterEffect() - , m_in(in) - , m_dx(dx) - , m_dy(dy) -{ -} - -PassRefPtr<FEOffset> FEOffset::create(FilterEffect* in, const float& dx, const float& dy) -{ - return adoptRef(new FEOffset(in, dx, dy)); -} - -float FEOffset::dx() const -{ - return m_dx; -} - -void FEOffset::setDx(float dx) -{ - m_dx = dx; -} - -float FEOffset::dy() const -{ - return m_dy; -} - -void FEOffset::setDy(float dy) -{ - m_dy = dy; -} - -void FEOffset::apply() -{ -} - -void FEOffset::dump() -{ -} - -TextStream& FEOffset::externalRepresentation(TextStream& ts) const -{ - ts << "[type=OFFSET] "; - FilterEffect::externalRepresentation(ts); - ts << " [dx=" << dx() << " dy=" << dy() << "]"; - return ts; -} - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFEOffset.h b/WebCore/svg/graphics/filters/SVGFEOffset.h deleted file mode 100644 index 86128da..0000000 --- a/WebCore/svg/graphics/filters/SVGFEOffset.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef SVGFEOffset_h -#define SVGFEOffset_h - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "FilterEffect.h" - -namespace WebCore { - - class FEOffset : public FilterEffect { - public: - static PassRefPtr<FEOffset> create(FilterEffect*, const float&, const float&); - - float dx() const; - void setDx(float); - - float dy() const; - void setDy(float); - - virtual void apply(); - virtual void dump(); - TextStream& externalRepresentation(TextStream& ts) const; - - private: - FEOffset(FilterEffect*, const float&, const float&); - - RefPtr<FilterEffect> m_in; - float m_dx; - float m_dy; - }; - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#endif // SVGFEOffset_h diff --git a/WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp b/WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp deleted file mode 100644 index e3446ed..0000000 --- a/WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "SVGFESpecularLighting.h" -#include "SVGRenderTreeAsText.h" - -namespace WebCore { - -FESpecularLighting::FESpecularLighting(FilterEffect* in, const Color& lightingColor, const float& surfaceScale, - const float& specularConstant, const float& specularExponent, const float& kernelUnitLengthX, - const float& kernelUnitLengthY, LightSource* lightSource) - : FilterEffect() - , m_in(in) - , m_lightingColor(lightingColor) - , m_surfaceScale(surfaceScale) - , m_specularConstant(specularConstant) - , m_specularExponent(specularExponent) - , m_kernelUnitLengthX(kernelUnitLengthX) - , m_kernelUnitLengthY(kernelUnitLengthY) - , m_lightSource(lightSource) -{ -} - -PassRefPtr<FESpecularLighting> FESpecularLighting::create(FilterEffect* in, const Color& lightingColor, - const float& surfaceScale, const float& specularConstant, const float& specularExponent, - const float& kernelUnitLengthX, const float& kernelUnitLengthY, LightSource* lightSource) -{ - return adoptRef(new FESpecularLighting(in, lightingColor, surfaceScale, specularConstant, specularExponent, - kernelUnitLengthX, kernelUnitLengthY, lightSource)); -} - -FESpecularLighting::~FESpecularLighting() -{ -} - -Color FESpecularLighting::lightingColor() const -{ - return m_lightingColor; -} - -void FESpecularLighting::setLightingColor(const Color& lightingColor) -{ - m_lightingColor = lightingColor; -} - -float FESpecularLighting::surfaceScale() const -{ - return m_surfaceScale; -} - -void FESpecularLighting::setSurfaceScale(float surfaceScale) -{ - m_surfaceScale = surfaceScale; -} - -float FESpecularLighting::specularConstant() const -{ - return m_specularConstant; -} - -void FESpecularLighting::setSpecularConstant(float specularConstant) -{ - m_specularConstant = specularConstant; -} - -float FESpecularLighting::specularExponent() const -{ - return m_specularExponent; -} - -void FESpecularLighting::setSpecularExponent(float specularExponent) -{ - m_specularExponent = specularExponent; -} - -float FESpecularLighting::kernelUnitLengthX() const -{ - return m_kernelUnitLengthX; -} - -void FESpecularLighting::setKernelUnitLengthX(float kernelUnitLengthX) -{ - m_kernelUnitLengthX = kernelUnitLengthX; -} - -float FESpecularLighting::kernelUnitLengthY() const -{ - return m_kernelUnitLengthY; -} - -void FESpecularLighting::setKernelUnitLengthY(float kernelUnitLengthY) -{ - m_kernelUnitLengthY = kernelUnitLengthY; -} - -const LightSource* FESpecularLighting::lightSource() const -{ - return m_lightSource.get(); -} - -void FESpecularLighting::setLightSource(LightSource* lightSource) -{ - m_lightSource = lightSource; -} - -void FESpecularLighting::apply() -{ -} - -void FESpecularLighting::dump() -{ -} - -TextStream& FESpecularLighting::externalRepresentation(TextStream& ts) const -{ - ts << "[type=SPECULAR-LIGHTING] "; - FilterEffect::externalRepresentation(ts); - ts << " [surface scale=" << m_surfaceScale << "]" - << " [specual constant=" << m_specularConstant << "]" - << " [specular exponent=" << m_specularExponent << "]"; - return ts; -} - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFESpecularLighting.h b/WebCore/svg/graphics/filters/SVGFESpecularLighting.h deleted file mode 100644 index e1c1930..0000000 --- a/WebCore/svg/graphics/filters/SVGFESpecularLighting.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef SVGFESpecularLighting_h -#define SVGFESpecularLighting_h - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "Color.h" -#include "SVGLightSource.h" -#include "FilterEffect.h" - -namespace WebCore { - - class FESpecularLighting : public FilterEffect { - public: - static PassRefPtr<FESpecularLighting> create(FilterEffect*, const Color&, const float&, const float&, - const float&, const float&, const float&, LightSource*); - virtual ~FESpecularLighting(); - - Color lightingColor() const; - void setLightingColor(const Color&); - - float surfaceScale() const; - void setSurfaceScale(float); - - float specularConstant() const; - void setSpecularConstant(float); - - float specularExponent() const; - void setSpecularExponent(float); - - float kernelUnitLengthX() const; - void setKernelUnitLengthX(float); - - float kernelUnitLengthY() const; - void setKernelUnitLengthY(float); - - const LightSource* lightSource() const; - void setLightSource(LightSource*); - - virtual void apply(); - virtual void dump(); - TextStream& externalRepresentation(TextStream& ts) const; - - private: - FESpecularLighting(FilterEffect*, const Color&, const float&, const float&, const float&, - const float&, const float&, LightSource*); - - RefPtr<FilterEffect> m_in; - Color m_lightingColor; - float m_surfaceScale; - float m_specularConstant; - float m_specularExponent; - float m_kernelUnitLengthX; - float m_kernelUnitLengthY; - RefPtr<LightSource> m_lightSource; - }; - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#endif // SVGFESpecularLighting_h diff --git a/WebCore/svg/graphics/filters/SVGFETile.cpp b/WebCore/svg/graphics/filters/SVGFETile.cpp deleted file mode 100644 index 773a5cd..0000000 --- a/WebCore/svg/graphics/filters/SVGFETile.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "SVGFETile.h" -#include "SVGRenderTreeAsText.h" - -namespace WebCore { - -FETile::FETile(FilterEffect* in) - : FilterEffect() - , m_in(in) -{ -} - -PassRefPtr<FETile> FETile::create(FilterEffect* in) -{ - return adoptRef(new FETile(in)); -} - -void FETile::apply() -{ -} - -void FETile::dump() -{ -} - -TextStream& FETile::externalRepresentation(TextStream& ts) const -{ - ts << "[type=TILE]"; - FilterEffect::externalRepresentation(ts); - return ts; -} - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) - diff --git a/WebCore/svg/graphics/filters/SVGFETile.h b/WebCore/svg/graphics/filters/SVGFETile.h deleted file mode 100644 index 986f6fd..0000000 --- a/WebCore/svg/graphics/filters/SVGFETile.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef SVGFETile_h -#define SVGFETile_h - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "FilterEffect.h" - -namespace WebCore { - - class FETile : public FilterEffect { - public: - static PassRefPtr<FETile> create(FilterEffect*); - - virtual void apply(); - virtual void dump(); - TextStream& externalRepresentation(TextStream& ts) const; - - private: - FETile(FilterEffect*); - - RefPtr<FilterEffect> m_in; - }; - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#endif // SVGFETile_h diff --git a/WebCore/svg/graphics/filters/SVGFETurbulence.cpp b/WebCore/svg/graphics/filters/SVGFETurbulence.cpp deleted file mode 100644 index 9731c49..0000000 --- a/WebCore/svg/graphics/filters/SVGFETurbulence.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "SVGFETurbulence.h" -#include "SVGRenderTreeAsText.h" - -namespace WebCore { - -FETurbulence::FETurbulence(TurbulanceType type, const float& baseFrequencyX, const float& baseFrequencyY, - const int& numOctaves, const float& seed, bool stitchTiles) - : FilterEffect() - , m_type(type) - , m_baseFrequencyX(baseFrequencyX) - , m_baseFrequencyY(baseFrequencyY) - , m_numOctaves(numOctaves) - , m_seed(seed) - , m_stitchTiles(stitchTiles) -{ -} - -PassRefPtr<FETurbulence> FETurbulence::create(TurbulanceType type, const float& baseFrequencyX, const float& baseFrequencyY, - const int& numOctaves, const float& seed, bool stitchTiles) -{ - return adoptRef(new FETurbulence(type, baseFrequencyX, baseFrequencyY, numOctaves, seed, stitchTiles)); -} - -TurbulanceType FETurbulence::type() const -{ - return m_type; -} - -void FETurbulence::setType(TurbulanceType type) -{ - m_type = type; -} - -float FETurbulence::baseFrequencyY() const -{ - return m_baseFrequencyY; -} - -void FETurbulence::setBaseFrequencyY(float baseFrequencyY) -{ - m_baseFrequencyY = baseFrequencyY; -} - -float FETurbulence::baseFrequencyX() const -{ - return m_baseFrequencyX; -} - -void FETurbulence::setBaseFrequencyX(float baseFrequencyX) -{ - m_baseFrequencyX = baseFrequencyX; -} - -float FETurbulence::seed() const -{ - return m_seed; -} - -void FETurbulence::setSeed(float seed) -{ - m_seed = seed; -} - -int FETurbulence::numOctaves() const -{ - return m_numOctaves; -} - -void FETurbulence::setNumOctaves(bool numOctaves) -{ - m_numOctaves = numOctaves; -} - -bool FETurbulence::stitchTiles() const -{ - return m_stitchTiles; -} - -void FETurbulence::setStitchTiles(bool stitch) -{ - m_stitchTiles = stitch; -} - -void FETurbulence::apply() -{ -} - -void FETurbulence::dump() -{ -} - -static TextStream& operator<<(TextStream& ts, TurbulanceType t) -{ - switch (t) - { - case FETURBULENCE_TYPE_UNKNOWN: - ts << "UNKNOWN"; break; - case FETURBULENCE_TYPE_TURBULENCE: - ts << "TURBULANCE"; break; - case FETURBULENCE_TYPE_FRACTALNOISE: - ts << "NOISE"; break; - } - return ts; -} - -TextStream& FETurbulence::externalRepresentation(TextStream& ts) const -{ - ts << "[type=TURBULENCE] "; - FilterEffect::externalRepresentation(ts); - ts << " [turbulence type=" << type() << "]" - << " [base frequency x=" << baseFrequencyX() << " y=" << baseFrequencyY() << "]" - << " [seed=" << seed() << "]" - << " [num octaves=" << numOctaves() << "]" - << " [stitch tiles=" << stitchTiles() << "]"; - - return ts; -} - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFETurbulence.h b/WebCore/svg/graphics/filters/SVGFETurbulence.h deleted file mode 100644 index 6977460..0000000 --- a/WebCore/svg/graphics/filters/SVGFETurbulence.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef SVGFETurbulence_h -#define SVGFETurbulence_h - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "FilterEffect.h" - -namespace WebCore { - - enum TurbulanceType { - FETURBULENCE_TYPE_UNKNOWN = 0, - FETURBULENCE_TYPE_FRACTALNOISE = 1, - FETURBULENCE_TYPE_TURBULENCE = 2 - }; - - class FETurbulence : public FilterEffect { - public: - static PassRefPtr<FETurbulence> create(TurbulanceType, const float&, const float&, const int&, const float&, - bool); - - TurbulanceType type() const; - void setType(TurbulanceType); - - float baseFrequencyY() const; - void setBaseFrequencyY(float); - - float baseFrequencyX() const; - void setBaseFrequencyX(float); - - float seed() const; - void setSeed(float); - - int numOctaves() const; - void setNumOctaves(bool); - - bool stitchTiles() const; - void setStitchTiles(bool); - - virtual void apply(); - virtual void dump(); - TextStream& externalRepresentation(TextStream& ts) const; - - private: - FETurbulence(TurbulanceType, const float&, const float&, const int&, const float&, - bool); - - TurbulanceType m_type; - float m_baseFrequencyX; - float m_baseFrequencyY; - int m_numOctaves; - float m_seed; - bool m_stitchTiles; - }; - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#endif // SVGFETurbulence_h diff --git a/WebCore/svg/graphics/filters/SVGFilterEffect.cpp b/WebCore/svg/graphics/filters/SVGFilterEffect.cpp deleted file mode 100644 index f8e246f..0000000 --- a/WebCore/svg/graphics/filters/SVGFilterEffect.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "SVGFilterEffect.h" - -#include "SVGRenderTreeAsText.h" -#include "SVGResourceFilter.h" - -namespace WebCore { - -SVGFilterEffect::SVGFilterEffect(SVGResourceFilter* filter) - : m_filter(filter) - , m_xBBoxMode(false) - , m_yBBoxMode(false) - , m_widthBBoxMode(false) - , m_heightBBoxMode(false) -{ -} - -FloatRect SVGFilterEffect::primitiveBBoxForFilterBBox(const FloatRect& filterBBox, const FloatRect& itemBBox) const -{ - FloatRect subRegionBBox = subRegion(); - FloatRect useBBox = filterBBox; - - ASSERT(m_filter); - if (!m_filter) - return FloatRect(); - - if (m_filter->effectBoundingBoxMode()) { - if (!m_filter->filterBoundingBoxMode()) - useBBox = itemBBox; - - subRegionBBox = FloatRect(useBBox.x() + subRegionBBox.x() * useBBox.width(), - useBBox.y() + subRegionBBox.y() * useBBox.height(), - subRegionBBox.width() * useBBox.width(), - subRegionBBox.height() * useBBox.height()); - } else { - if (xBoundingBoxMode()) - subRegionBBox.setX(useBBox.x() + subRegionBBox.x() * useBBox.width()); - - if (yBoundingBoxMode()) - subRegionBBox.setY(useBBox.y() + subRegionBBox.y() * useBBox.height()); - - if (widthBoundingBoxMode()) - subRegionBBox.setWidth(subRegionBBox.width() * useBBox.width()); - - if (heightBoundingBoxMode()) - subRegionBBox.setHeight(subRegionBBox.height() * useBBox.height()); - } - - return subRegionBBox; -} - -FloatRect SVGFilterEffect::subRegion() const -{ - return m_subRegion; -} - -void SVGFilterEffect::setSubRegion(const FloatRect& subRegion) -{ - m_subRegion = subRegion; -} - -String SVGFilterEffect::in() const -{ - return m_in; -} - -void SVGFilterEffect::setIn(const String& in) -{ - m_in = in; -} - -String SVGFilterEffect::result() const -{ - return m_result; -} - -void SVGFilterEffect::setResult(const String& result) -{ - m_result = result; -} - -SVGResourceFilter* SVGFilterEffect::filter() const -{ - return m_filter; -} - -void SVGFilterEffect::setFilter(SVGResourceFilter* filter) -{ - m_filter = filter; -} - -TextStream& SVGFilterEffect::externalRepresentation(TextStream& ts) const -{ - if (!in().isEmpty()) - ts << "[in=\"" << in() << "\"]"; - if (!result().isEmpty()) - ts << " [result=\"" << result() << "\"]"; - if (!subRegion().isEmpty()) - ts << " [subregion=\"" << subRegion() << "\"]"; - return ts; -} - -TextStream& operator<<(TextStream& ts, const SVGFilterEffect& e) -{ - return e.externalRepresentation(ts); -} - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGFilterEffect.h b/WebCore/svg/graphics/filters/SVGFilterEffect.h deleted file mode 100644 index d497f8b..0000000 --- a/WebCore/svg/graphics/filters/SVGFilterEffect.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef SVGFilterEffect_h -#define SVGFilterEffect_h - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "FloatRect.h" -#include "PlatformString.h" - -#if PLATFORM(CI) -#ifdef __OBJC__ -@class CIFilter; -#else -class CIFilter; -#endif -#endif - -namespace WebCore { - -class SVGResourceFilter; -class TextStream; - -class SVGFilterEffect : public RefCounted<SVGFilterEffect> { -public: - SVGFilterEffect(SVGResourceFilter*); - virtual ~SVGFilterEffect() { } - - bool xBoundingBoxMode() const { return m_xBBoxMode; } - void setXBoundingBoxMode(bool bboxMode) { m_xBBoxMode = bboxMode; } - - bool yBoundingBoxMode() const { return m_yBBoxMode; } - void setYBoundingBoxMode(bool bboxMode) { m_yBBoxMode = bboxMode; } - - bool widthBoundingBoxMode() const { return m_widthBBoxMode; } - void setWidthBoundingBoxMode(bool bboxMode) { m_widthBBoxMode = bboxMode; } - - bool heightBoundingBoxMode() const { return m_heightBBoxMode; } - void setHeightBoundingBoxMode(bool bboxMode) { m_heightBBoxMode = bboxMode; } - - FloatRect primitiveBBoxForFilterBBox(const FloatRect& filterBBox, const FloatRect& itemBBox) const; - - FloatRect subRegion() const; - void setSubRegion(const FloatRect&); - - String in() const; - void setIn(const String&); - - String result() const; - void setResult(const String&); - - SVGResourceFilter* filter() const; - void setFilter(SVGResourceFilter*); - - virtual TextStream& externalRepresentation(TextStream&) const; - -#if PLATFORM(CI) - virtual CIFilter* getCIFilter(const FloatRect& bbox) const; -#endif - -private: - SVGResourceFilter* m_filter; - - bool m_xBBoxMode : 1; - bool m_yBBoxMode : 1; - bool m_widthBBoxMode : 1; - bool m_heightBBoxMode : 1; - - FloatRect m_subRegion; - - String m_in; - String m_result; -}; - -TextStream& operator<<(TextStream&, const SVGFilterEffect&); - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#endif // SVGFilterEffect_h diff --git a/WebCore/svg/graphics/filters/SVGLightSource.cpp b/WebCore/svg/graphics/filters/SVGLightSource.cpp deleted file mode 100644 index 77611ca..0000000 --- a/WebCore/svg/graphics/filters/SVGLightSource.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "SVGPointLightSource.h" -#include "SVGRenderTreeAsText.h" -#include "SVGSpotLightSource.h" -#include "SVGDistantLightSource.h" - -namespace WebCore { - -static TextStream& operator<<(TextStream& ts, const FloatPoint3D& p) -{ - ts << "x=" << p.x() << " y=" << p.y() << " z=" << p.z(); - return ts; -} - -TextStream& PointLightSource::externalRepresentation(TextStream& ts) const -{ - ts << "[type=POINT-LIGHT] "; - ts << "[position=\"" << position() << "\"]"; - return ts; -} - -TextStream& SpotLightSource::externalRepresentation(TextStream& ts) const -{ - ts << "[type=SPOT-LIGHT] "; - ts << "[position=\"" << position() << "\"]"; - ts << "[direction=\"" << direction() << "\"]"; - ts << "[specularExponent=\"" << specularExponent() << "\"]"; - ts << "[limitingConeAngle=\"" << limitingConeAngle() << "\"]"; - return ts; -} - -TextStream& DistantLightSource::externalRepresentation(TextStream& ts) const -{ - ts << "[type=DISTANT-LIGHT] "; - ts << "[azimuth=\"" << azimuth() << "\"]"; - ts << "[elevation=\"" << elevation() << "\"]"; - return ts; -} - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/SVGLightSource.h b/WebCore/svg/graphics/filters/SVGLightSource.h deleted file mode 100644 index 779e147..0000000 --- a/WebCore/svg/graphics/filters/SVGLightSource.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com> - 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef SVGLightSource_h -#define SVGLightSource_h - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include <wtf/RefCounted.h> - -namespace WebCore { - - enum LightType { - LS_DISTANT, - LS_POINT, - LS_SPOT - }; - - class TextStream; - - class LightSource : public RefCounted<LightSource> { - public: - LightSource(LightType type) - : m_type(type) - { } - - virtual ~LightSource() { } - - LightType type() const { return m_type; } - virtual TextStream& externalRepresentation(TextStream&) const = 0; - - private: - LightType m_type; - }; - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#endif // SVGLightSource_h diff --git a/WebCore/svg/graphics/filters/SVGPointLightSource.h b/WebCore/svg/graphics/filters/SVGPointLightSource.h deleted file mode 100644 index 099a165..0000000 --- a/WebCore/svg/graphics/filters/SVGPointLightSource.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com> - 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef SVGPointLightSource_h -#define SVGPointLightSource_h - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "FloatPoint3D.h" -#include "SVGLightSource.h" - -namespace WebCore { - - class PointLightSource : public LightSource { - public: - PointLightSource(const FloatPoint3D& position) - : LightSource(LS_POINT) - , m_position(position) - { } - - const FloatPoint3D& position() const { return m_position; } - - virtual TextStream& externalRepresentation(TextStream&) const; - - private: - FloatPoint3D m_position; - }; - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#endif // SVGPointLightSource_h diff --git a/WebCore/svg/graphics/filters/SVGSpotLightSource.h b/WebCore/svg/graphics/filters/SVGSpotLightSource.h deleted file mode 100644 index a4aa1fb..0000000 --- a/WebCore/svg/graphics/filters/SVGSpotLightSource.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com> - 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005 Rob Buis <buis@kde.org> - 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 - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef SVGSpotLightSource_h -#define SVGSpotLightSource_h - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "FloatPoint3D.h" -#include "SVGLightSource.h" - -namespace WebCore { - - class SpotLightSource : public LightSource { - public: - SpotLightSource(const FloatPoint3D& position, const FloatPoint3D& direction, float specularExponent, float limitingConeAngle) - : LightSource(LS_SPOT) - , m_position(position) - , m_direction(direction) - , m_specularExponent(specularExponent) - , m_limitingConeAngle(limitingConeAngle) - { } - - const FloatPoint3D& position() const { return m_position; } - const FloatPoint3D& direction() const { return m_direction; } - - float specularExponent() const { return m_specularExponent; } - float limitingConeAngle() const { return m_limitingConeAngle; } - - virtual TextStream& externalRepresentation(TextStream&) const; - - private: - FloatPoint3D m_position; - FloatPoint3D m_direction; - - float m_specularExponent; - float m_limitingConeAngle; - }; - -} // namespace WebCore - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#endif // SVGSpotLightSource_h diff --git a/WebCore/svg/graphics/filters/cg/SVGFEHelpersCg.h b/WebCore/svg/graphics/filters/cg/SVGFEHelpersCg.h deleted file mode 100644 index f35e028..0000000 --- a/WebCore/svg/graphics/filters/cg/SVGFEHelpersCg.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - Copyright (C) 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - - This file is part of the KDE project - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#include "BlockExceptions.h" -#include "SVGFEDisplacementMap.h" -#include "SVGResourceFilter.h" -#include "SVGResourceFilterPlatformDataMac.h" -#include <QuartzCore/CoreImage.h> -#include <wtf/MathExtras.h> - -class Color; -class LightSource; - -namespace WebCore { - -CIVector* getVectorForChannel(ChannelSelectorType channel); -CIColor* ciColor(const Color& c); - -// Lighting -CIFilter* getPointLightVectors(CIFilter* normals, CIVector* lightPosition, float surfaceScale); -CIFilter* getLightVectors(CIFilter* normals, const LightSource* light, float surfaceScale); -CIFilter* getNormalMap(CIImage* bumpMap, float scale); - -}; - -// Macros used by the SVGFE*Cg classes -#define FE_QUARTZ_SETUP_INPUT(name) \ - SVGResourceFilterPlatformDataMac* filterPlatformData = static_cast<SVGResourceFilterPlatformDataMac*>(svgFilter->platformData()); \ - CIImage* inputImage = filterPlatformData->inputImage(this); \ - FE_QUARTZ_CHECK_INPUT(inputImage) \ - CIFilter* filter; \ - BEGIN_BLOCK_OBJC_EXCEPTIONS; \ - filter = [CIFilter filterWithName:name]; \ - [filter setDefaults]; \ - [filter setValue:inputImage forKey:@"inputImage"]; - -#define FE_QUARTZ_CHECK_INPUT(input) \ - if (!input) \ - return nil; - -#define FE_QUARTZ_OUTPUT_RETURN \ - filterPlatformData->setOutputImage(this, [filter valueForKey:@"outputImage"]); \ - return filter; \ - END_BLOCK_OBJC_EXCEPTIONS; \ - return nil; - -#define FE_QUARTZ_MAP_TO_SUBREGION_PREPARE(bbox) \ - FloatRect filterRect = svgFilter->filterBBoxForItemBBox(bbox); \ - FloatRect cropRect = primitiveBBoxForFilterBBox(filterRect, bbox); \ - cropRect.intersect(filterRect); \ - cropRect.move(-filterRect.x(), -filterRect.y()); - -#define FE_QUARTZ_MAP_TO_SUBREGION_APPLY(cropRect) \ - { \ - CIFilter* crop = [CIFilter filterWithName:@"CICrop"]; \ - [crop setDefaults]; \ - if (CIImage* currentFilterOutputImage = [filter valueForKey:@"outputImage"]) { \ - [crop setValue:currentFilterOutputImage forKey:@"inputImage"]; \ - [crop setValue:[CIVector vectorWithX:cropRect.x() Y:cropRect.y() Z:cropRect.width() W:cropRect.height()] forKey:@"inputRectangle"]; \ - filter = crop; \ - } \ - } - -#define FE_QUARTZ_MAP_TO_SUBREGION(bbox) \ - FE_QUARTZ_MAP_TO_SUBREGION_PREPARE(bbox); \ - FE_QUARTZ_MAP_TO_SUBREGION_APPLY(cropRect); - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/SVGFEHelpersCg.mm b/WebCore/svg/graphics/filters/cg/SVGFEHelpersCg.mm deleted file mode 100644 index 0f2eb75..0000000 --- a/WebCore/svg/graphics/filters/cg/SVGFEHelpersCg.mm +++ /dev/null @@ -1,162 +0,0 @@ -/* - Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> - - This file is part of the KDE project - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "SVGFEHelpersCg.h" - -#include "Color.h" -#include "SVGDistantLightSource.h" -#include "SVGLightSource.h" -#include "SVGPointLightSource.h" -#include "SVGSpotLightSource.h" - -#import "WKDistantLightFilter.h" -#import "WKNormalMapFilter.h" -#import "WKPointLightFilter.h" -#import "WKSpotLightFilter.h" - -#include <wtf/MathExtras.h> - -namespace WebCore { - -CIVector* getVectorForChannel(ChannelSelectorType channel) -{ - switch (channel) { - case CHANNEL_UNKNOWN: - return nil; - case CHANNEL_R: - return [CIVector vectorWithX:1.0f Y:0.0f Z:0.0f W:0.0f]; - case CHANNEL_G: - return [CIVector vectorWithX:0.0f Y:1.0f Z:0.0f W:0.0f]; - case CHANNEL_B: - return [CIVector vectorWithX:0.0f Y:0.0f Z:1.0f W:0.0f]; - case CHANNEL_A: - return [CIVector vectorWithX:0.0f Y:0.0f Z:0.0f W:1.0f]; - default: - return [CIVector vectorWithX:0.0f Y:0.0f Z:0.0f W:0.0f]; - } -} - -CIColor* ciColor(const Color& c) -{ - CGColorRef colorCG = cgColor(c); - CIColor* colorCI = [CIColor colorWithCGColor:colorCG]; - CGColorRelease(colorCG); - return colorCI; -} - -// Lighting -CIFilter* getPointLightVectors(CIFilter* normals, CIVector* lightPosition, float surfaceScale) -{ - CIFilter* filter; - BEGIN_BLOCK_OBJC_EXCEPTIONS; - filter = [CIFilter filterWithName:@"WKPointLight"]; - if (!filter) - return nil; - [filter setDefaults]; - [filter setValue:[normals valueForKey:@"outputImage"] forKey:@"inputNormalMap"]; - [filter setValue:lightPosition forKey:@"inputLightPosition"]; - [filter setValue:[NSNumber numberWithFloat:surfaceScale] forKey:@"inputSurfaceScale"]; - return filter; - END_BLOCK_OBJC_EXCEPTIONS; - return nil; -} - -CIFilter* getLightVectors(CIFilter* normals, const LightSource* light, float surfaceScale) -{ - [WKDistantLightFilter class]; - [WKPointLightFilter class]; - [WKSpotLightFilter class]; - - CIFilter* filter = nil; - BEGIN_BLOCK_OBJC_EXCEPTIONS; - - switch (light->type()) { - case LS_DISTANT: - { - const DistantLightSource* dlight = static_cast<const DistantLightSource*>(light); - - filter = [CIFilter filterWithName:@"WKDistantLight"]; - if (!filter) - return nil; - [filter setDefaults]; - - float azimuth = dlight->azimuth(); - float elevation = dlight->elevation(); - azimuth = deg2rad(azimuth); - elevation = deg2rad(elevation); - float Lx = cosf(azimuth)*cosf(elevation); - float Ly = sinf(azimuth)*cosf(elevation); - float Lz = sinf(elevation); - - [filter setValue:[normals valueForKey:@"outputImage"] forKey:@"inputNormalMap"]; - [filter setValue:[CIVector vectorWithX:Lx Y:Ly Z:Lz] forKey:@"inputLightDirection"]; - return filter; - } - case LS_POINT: - { - const PointLightSource* plight = static_cast<const PointLightSource*>(light); - return getPointLightVectors(normals, [CIVector vectorWithX:plight->position().x() Y:plight->position().y() Z:plight->position().z()], surfaceScale); - } - case LS_SPOT: - { - const SpotLightSource* slight = static_cast<const SpotLightSource*>(light); - filter = [CIFilter filterWithName:@"WKSpotLight"]; - if (!filter) - return nil; - - CIFilter* pointLightFilter = getPointLightVectors(normals, [CIVector vectorWithX:slight->position().x() Y:slight->position().y() Z:slight->position().z()], surfaceScale); - if (!pointLightFilter) - return nil; - [filter setDefaults]; - - [filter setValue:[pointLightFilter valueForKey:@"outputImage"] forKey:@"inputLightVectors"]; - [filter setValue:[CIVector vectorWithX:slight->direction().x() Y:slight->direction().y() Z:slight->direction().z()] forKey:@"inputLightDirection"]; - [filter setValue:[NSNumber numberWithFloat:slight->specularExponent()] forKey:@"inputSpecularExponent"]; - [filter setValue:[NSNumber numberWithFloat:deg2rad(slight->limitingConeAngle())] forKey:@"inputLimitingConeAngle"]; - return filter; - } - } - - END_BLOCK_OBJC_EXCEPTIONS; - return nil; -} - -CIFilter* getNormalMap(CIImage* bumpMap, float scale) -{ - [WKNormalMapFilter class]; - CIFilter* filter; - BEGIN_BLOCK_OBJC_EXCEPTIONS; - filter = [CIFilter filterWithName:@"WKNormalMap"]; - [filter setDefaults]; - - [filter setValue:bumpMap forKey:@"inputImage"]; - [filter setValue:[NSNumber numberWithFloat:scale] forKey:@"inputSurfaceScale"]; - return filter; - END_BLOCK_OBJC_EXCEPTIONS; - return nil; -} - -} - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/SVGFilterEffectCg.mm b/WebCore/svg/graphics/filters/cg/SVGFilterEffectCg.mm deleted file mode 100644 index 4b0a233..0000000 --- a/WebCore/svg/graphics/filters/cg/SVGFilterEffectCg.mm +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> - - This file is part of the KDE project - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#include "SVGFilterEffect.h" - -namespace WebCore { - -CIFilter* SVGFilterEffect::getCIFilter(const FloatRect& bbox) const -{ - return nil; -} - -} - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKArithmeticFilter.cikernel b/WebCore/svg/graphics/filters/cg/WKArithmeticFilter.cikernel deleted file mode 100644 index 3c32c3a..0000000 --- a/WebCore/svg/graphics/filters/cg/WKArithmeticFilter.cikernel +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -kernel vec4 arithmeticComposite(sampler in1, sampler in2, float k1, float k2, float k3, float k4) -{ - vec4 vin1 = sample(in1, samplerCoord(in1)); - vec4 vin2 = sample(in2, samplerCoord(in2)); - vec4 res = k1*vin1*vin2 + k2*vin1 + k3*vin2 + vec4(k4); - return res; -} diff --git a/WebCore/svg/graphics/filters/cg/WKArithmeticFilter.h b/WebCore/svg/graphics/filters/cg/WKArithmeticFilter.h deleted file mode 100644 index 4693853..0000000 --- a/WebCore/svg/graphics/filters/cg/WKArithmeticFilter.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -#import <QuartzCore/CoreImage.h> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKArithmeticFilter : CIFilter { - CIImage *inputImage; - CIImage *inputBackgroundImage; - NSNumber *inputK1; - NSNumber *inputK2; - NSNumber *inputK3; - NSNumber *inputK4; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKArithmeticFilter.m b/WebCore/svg/graphics/filters/cg/WKArithmeticFilter.m deleted file mode 100644 index 389f25d..0000000 --- a/WebCore/svg/graphics/filters/cg/WKArithmeticFilter.m +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -#import "config.h" -#import "WKArithmeticFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -static CIKernel *arithmeticFilter = nil; - -@implementation WKArithmeticFilter -+ (void)initialize -{ - [CIFilter registerFilterName:@"WKArithmeticFilter" - constructor:self - classAttributes:[NSDictionary dictionaryWithObjectsAndKeys: - @"WebKit Arithmetic Filter", kCIAttributeFilterDisplayName, - [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo, - kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories, - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeMin, - [NSNumber numberWithDouble:0.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputK1", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeMin, - [NSNumber numberWithDouble:0.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputK2", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeMin, - [NSNumber numberWithDouble:0.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputK3", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeMin, - [NSNumber numberWithDouble:0.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputK4", - nil]]; -} - -+ (CIFilter *)filterWithName:(NSString *)name -{ - return [[[self alloc] init] autorelease]; -} - -- (id)init -{ - if (!arithmeticFilter) { - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; - NSString *kernelFile = [bundle pathForResource:@"WKArithmeticFilter" ofType:@"cikernel"]; - NSString *code = [NSString stringWithContentsOfFile:kernelFile encoding:NSUTF8StringEncoding error:0]; - NSArray *kernels = [CIKernel kernelsWithString:code]; - arithmeticFilter = [[kernels objectAtIndex:0] retain]; - } - return [super init]; -} - -- (CIImage *)outputImage -{ - return [self apply:arithmeticFilter, inputImage, inputBackgroundImage, inputK1, inputK2, inputK3, - inputK4, nil]; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKComponentMergeFilter.cikernel b/WebCore/svg/graphics/filters/cg/WKComponentMergeFilter.cikernel deleted file mode 100644 index f33f20c..0000000 --- a/WebCore/svg/graphics/filters/cg/WKComponentMergeFilter.cikernel +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -kernel vec4 mergeComponents(sampler funcR, sampler funcG, sampler funcB, sampler funcA) -{ - float r = sample(funcR, samplerCoord(funcR)).r; - float g = sample(funcG, samplerCoord(funcG)).g; - float b = sample(funcB, samplerCoord(funcB)).b; - float a = sample(funcA, samplerCoord(funcA)).a; - return vec4(r, g, b, a); -} diff --git a/WebCore/svg/graphics/filters/cg/WKComponentMergeFilter.h b/WebCore/svg/graphics/filters/cg/WKComponentMergeFilter.h deleted file mode 100644 index 778e326..0000000 --- a/WebCore/svg/graphics/filters/cg/WKComponentMergeFilter.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -#import <QuartzCore/CoreImage.h> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKComponentMergeFilter : CIFilter { - CIImage *inputFuncR; - CIImage *inputFuncG; - CIImage *inputFuncB; - CIImage *inputFuncA; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKComponentMergeFilter.m b/WebCore/svg/graphics/filters/cg/WKComponentMergeFilter.m deleted file mode 100644 index 4f2045a..0000000 --- a/WebCore/svg/graphics/filters/cg/WKComponentMergeFilter.m +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -#import "config.h" -#import "WKComponentMergeFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -static CIKernel *componentMergeFilter = nil; - -@implementation WKComponentMergeFilter -+ (void)initialize -{ - [CIFilter registerFilterName:@"WKComponentMerge" - constructor:self - classAttributes:[NSDictionary dictionaryWithObjectsAndKeys: - @"WebKit Component Merge", kCIAttributeFilterDisplayName, - [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo, - kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories, - nil]]; -} - -+ (CIFilter *)filterWithName:(NSString *)name -{ - return [[[self alloc] init] autorelease]; -} - -- (id)init -{ - if (!componentMergeFilter) { - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; - NSString *kernelFile = [bundle pathForResource:@"WKComponentMergeFilter" ofType:@"cikernel"]; - NSString *code = [NSString stringWithContentsOfFile:kernelFile encoding:NSUTF8StringEncoding error:0]; - NSArray *kernels = [CIKernel kernelsWithString:code]; - componentMergeFilter = [[kernels objectAtIndex:0] retain]; - } - return [super init]; -} - -- (CIImage *)outputImage -{ - return [self apply:componentMergeFilter, [CISampler samplerWithImage: inputFuncR], - [CISampler samplerWithImage: inputFuncG], [CISampler samplerWithImage: inputFuncB], [CISampler samplerWithImage: inputFuncA], @"definition", [inputFuncR definition], nil]; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKDiffuseLightingFilter.cikernel b/WebCore/svg/graphics/filters/cg/WKDiffuseLightingFilter.cikernel deleted file mode 100644 index 870956a..0000000 --- a/WebCore/svg/graphics/filters/cg/WKDiffuseLightingFilter.cikernel +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -kernel vec4 diffuseLighting(sampler normalVectors, sampler lightVectors, __color lightingColor, - float surfaceScale, float diffuseConstant, float kernelLengthX, float kernelLengthY) -{ - vec2 pos = samplerCoord(lightVectors); - vec2 posn = samplerCoord(normalVectors); - vec4 l4 = sample(lightVectors, pos); - vec3 l = l4.xyz; - l = normalize(l); - vec3 n = sample(normalVectors, posn).xyz; - float nl = dot(l, n) * diffuseConstant; - vec4 res = vec4(lightingColor.r * nl, lightingColor.g * nl, lightingColor.b * nl, 1.0); - res.xyz *= l4.w; - return res; -} diff --git a/WebCore/svg/graphics/filters/cg/WKDiffuseLightingFilter.h b/WebCore/svg/graphics/filters/cg/WKDiffuseLightingFilter.h deleted file mode 100644 index 2731986..0000000 --- a/WebCore/svg/graphics/filters/cg/WKDiffuseLightingFilter.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. - * - * 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. - */ - -#import <QuartzCore/CoreImage.h> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKDiffuseLightingFilter : CIFilter { - CISampler *inputNormalMap; - CISampler *inputLightVectors; - CIColor *inputLightingColor; - NSNumber *inputSurfaceScale; - NSNumber *inputDiffuseConstant; - NSNumber *inputKernelUnitLengthX; - NSNumber *inputKernelUnitLengthY; -} -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKDiffuseLightingFilter.m b/WebCore/svg/graphics/filters/cg/WKDiffuseLightingFilter.m deleted file mode 100644 index 3675af8..0000000 --- a/WebCore/svg/graphics/filters/cg/WKDiffuseLightingFilter.m +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. - * - * 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. - */ - -#import "config.h" -#import "WKDiffuseLightingFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -static CIKernel *diffuseLightingFilter = nil; -@implementation WKDiffuseLightingFilter - -+ (void)initialize -{ - [CIFilter registerFilterName:@"WKDiffuseLighting" - constructor:self - classAttributes:[NSDictionary dictionaryWithObjectsAndKeys: - @"WebKit Diffuse Lighting", kCIAttributeFilterDisplayName, - [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo, - kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories, - [NSDictionary dictionaryWithObjectsAndKeys: - [CIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f], - kCIAttributeDefault, nil], @"inputLightingColor", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeMin, - [NSNumber numberWithDouble:1.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputSurfaceScale", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeMin, - [NSNumber numberWithDouble:1.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputDiffuseConstant", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeMin, - [NSNumber numberWithDouble:1.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputKernelUnitLengthX", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeMin, - [NSNumber numberWithDouble:1.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputKernelUnitLengthY", - nil]]; -} - -+ (CIFilter *)filterWithName:(NSString *)name -{ - return [[[self alloc] init] autorelease]; -} - -- (id)init -{ - if (!diffuseLightingFilter) { - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; - NSString *kernelFile = [bundle pathForResource:@"WKDiffuseLightingFilter" ofType:@"cikernel"]; - NSString *code = [NSString stringWithContentsOfFile:kernelFile encoding:NSUTF8StringEncoding error:0]; - NSArray *kernels = [CIKernel kernelsWithString:code]; - diffuseLightingFilter = [[kernels objectAtIndex:0] retain]; - } - return [super init]; -} - -- (CIImage *)outputImage -{ - return [self apply:diffuseLightingFilter, inputNormalMap, inputLightVectors, inputLightingColor, inputSurfaceScale, inputDiffuseConstant, - inputKernelUnitLengthX, inputKernelUnitLengthY, nil]; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKDiscreteTransferFilter.cikernel b/WebCore/svg/graphics/filters/cg/WKDiscreteTransferFilter.cikernel deleted file mode 100644 index db3cefd..0000000 --- a/WebCore/svg/graphics/filters/cg/WKDiscreteTransferFilter.cikernel +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -kernel vec4 discreteTransfer(sampler image, sampler table, vec4 rgbaSelector, float maxIndex) -{ - vec4 C = sample(image, samplerCoord(image)); - float k = floor(dot(rgbaSelector, C) * maxIndex); - vec4 res = sample(table, vec2(k+0.0, 0.0)); - return res; -} diff --git a/WebCore/svg/graphics/filters/cg/WKDiscreteTransferFilter.h b/WebCore/svg/graphics/filters/cg/WKDiscreteTransferFilter.h deleted file mode 100644 index d444c75..0000000 --- a/WebCore/svg/graphics/filters/cg/WKDiscreteTransferFilter.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -#import <QuartzCore/CoreImage.h> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKDiscreteTransferFilter : CIFilter { - CIImage *inputImage; - CIImage *inputTable; - CIVector *inputSelector; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKDiscreteTransferFilter.m b/WebCore/svg/graphics/filters/cg/WKDiscreteTransferFilter.m deleted file mode 100644 index dc6ca76..0000000 --- a/WebCore/svg/graphics/filters/cg/WKDiscreteTransferFilter.m +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -#import "config.h" -#import "WKDiscreteTransferFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -static CIKernel *discreteTransferFilter = nil; - -@implementation WKDiscreteTransferFilter -+ (void)initialize -{ - [CIFilter registerFilterName:@"WKDiscreteTransfer" - constructor:self - classAttributes:[NSDictionary dictionaryWithObjectsAndKeys: - @"WebKit Discrete Transfer", kCIAttributeFilterDisplayName, - [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo, - kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories, - nil]]; -} - -+ (CIFilter *)filterWithName:(NSString *)name -{ - return [[[self alloc] init] autorelease]; -} - -- (id)init -{ - if (!discreteTransferFilter) { - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; - NSString *kernelFile = [bundle pathForResource:@"WKDiscreteTransferFilter" ofType:@"cikernel"]; - NSString *code = [NSString stringWithContentsOfFile:kernelFile encoding:NSUTF8StringEncoding error:0]; - NSArray *kernels = [CIKernel kernelsWithString:code]; - discreteTransferFilter = [[kernels objectAtIndex:0] retain]; - } - return [super init]; -} - -- (CIImage *)outputImage -{ - CISampler *inputSampler = [CISampler samplerWithImage: inputImage]; - CISampler *tableSampler = [CISampler samplerWithImage: inputTable keysAndValues:kCISamplerFilterMode, kCISamplerFilterNearest, kCISamplerWrapMode, kCISamplerWrapClamp, nil]; - NSArray *args = [NSArray arrayWithObjects:inputSampler, tableSampler, inputSelector, - [NSNumber numberWithDouble:[inputTable extent].size.width - 1.0f], @"definition", [inputSampler definition], nil]; - return [self apply:discreteTransferFilter arguments:args options:nil]; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKDisplacementMapFilter.cikernel b/WebCore/svg/graphics/filters/cg/WKDisplacementMapFilter.cikernel deleted file mode 100644 index 95b19c6..0000000 --- a/WebCore/svg/graphics/filters/cg/WKDisplacementMapFilter.cikernel +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -/* - * Performs the transformation: - * P'(x,y) <- P( x + scale * (XC(x,y) - .5), y + scale * (YC(x,y) - .5)) - * - * x/ychannel arguments are used to select the appropriate channel for x and - * y displacement. Hence each vector should have only one non-zero element, - * which should have the value 1.0. - * - */ - -kernel vec4 displacementMap(sampler image, sampler map, vec4 xchannel, vec4 ychannel, float scale) -{ - vec2 samplePos = samplerCoord(image); - vec4 XCYC = sample(map, samplerCoord(map)); - float xc = dot(XCYC, xchannel); - float yc = dot(XCYC, ychannel); - samplePos.x += scale*(xc-0.5); - samplePos.y += scale*(yc-0.5); - return sample(image, samplePos); -} diff --git a/WebCore/svg/graphics/filters/cg/WKDisplacementMapFilter.h b/WebCore/svg/graphics/filters/cg/WKDisplacementMapFilter.h deleted file mode 100644 index e594495..0000000 --- a/WebCore/svg/graphics/filters/cg/WKDisplacementMapFilter.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -#import <QuartzCore/CoreImage.h> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKDisplacementMapFilter : CIFilter { - CIImage *inputImage; - CIImage *inputDisplacementMap; - CIVector *inputXChannelSelector; - CIVector *inputYChannelSelector; - NSNumber *inputScale; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKDisplacementMapFilter.m b/WebCore/svg/graphics/filters/cg/WKDisplacementMapFilter.m deleted file mode 100644 index 8ccd52c..0000000 --- a/WebCore/svg/graphics/filters/cg/WKDisplacementMapFilter.m +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -#import "config.h" -#import "WKDisplacementMapFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -static CIKernel *displacementMapFilter = nil; - -@implementation WKDisplacementMapFilter - -+ (void)initialize -{ - [CIFilter registerFilterName:@"WKDisplacementMapFilter" - constructor:self - classAttributes:[NSDictionary dictionaryWithObjectsAndKeys: - @"WebKit Displacement Map Filter", kCIAttributeFilterDisplayName, - [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo, - kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories, - [NSDictionary dictionaryWithObjectsAndKeys: - [CIVector vectorWithX:1.0f Y:0.0f Z:0.0f W:0.0f], - kCIAttributeDefault, nil], @"inputXChannelSelector", - [NSDictionary dictionaryWithObjectsAndKeys: - [CIVector vectorWithX:0.0f Y:1.0f Z:0.0f W:0.0f], - kCIAttributeDefault, nil], @"inputYChannelSelector", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeDefault, - [NSNumber numberWithDouble:0.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputScale", - nil]]; -} - -+ (CIFilter *)filterWithName:(NSString *)name -{ - return [[[self alloc] init] autorelease]; -} - -- (id)init -{ - if (!displacementMapFilter) { - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; - NSString *kernelFile = [bundle pathForResource:@"WKDisplacementMapFilter" ofType:@"cikernel"]; - NSString *code = [NSString stringWithContentsOfFile:kernelFile encoding:NSUTF8StringEncoding error:0]; - NSArray *kernels = [CIKernel kernelsWithString:code]; - displacementMapFilter = [[kernels objectAtIndex:0] retain]; - } - return [super init]; -} - -- (CIImage *)outputImage -{ - return [self apply:displacementMapFilter, inputImage, inputDisplacementMap, inputXChannelSelector, inputYChannelSelector, inputScale, nil]; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKDistantLightFilter.cikernel b/WebCore/svg/graphics/filters/cg/WKDistantLightFilter.cikernel deleted file mode 100644 index c14677c..0000000 --- a/WebCore/svg/graphics/filters/cg/WKDistantLightFilter.cikernel +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -kernel vec4 distantLightGenerator(sampler image, vec3 direction) -{ - return vec4(direction.x, direction.y, direction.z, 1.0); -} diff --git a/WebCore/svg/graphics/filters/cg/WKDistantLightFilter.h b/WebCore/svg/graphics/filters/cg/WKDistantLightFilter.h deleted file mode 100644 index e5fe15a..0000000 --- a/WebCore/svg/graphics/filters/cg/WKDistantLightFilter.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. - * - * 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. - */ - -#import <QuartzCore/CoreImage.h> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKDistantLightFilter : CIFilter { - CIImage * inputNormalMap; - CIVector * inputLightDirection; -} -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKDistantLightFilter.m b/WebCore/svg/graphics/filters/cg/WKDistantLightFilter.m deleted file mode 100644 index 29e3caf..0000000 --- a/WebCore/svg/graphics/filters/cg/WKDistantLightFilter.m +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. - * - * 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. - */ - -#import "config.h" -#import "WKDistantLightFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -static CIKernel *distantLightFilter = nil; - -@implementation WKDistantLightFilter - -+ (void)initialize -{ - [CIFilter registerFilterName:@"WKDistantLight" - constructor:self - classAttributes:[NSDictionary dictionaryWithObjectsAndKeys: - @"WebKit Distant Light", kCIAttributeFilterDisplayName, - [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo, - kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories, - [NSDictionary dictionaryWithObjectsAndKeys: - kCIAttributeTypePosition3, kCIAttributeType, - nil], @"inputLightDirection", - nil]]; -} - -+ (CIFilter *)filterWithName:(NSString *)name -{ - return [[[self alloc] init] autorelease]; -} - -- (id)init -{ - if (!distantLightFilter) { - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; - NSString *kernelFile = [bundle pathForResource:@"WKDistantLightFilter" ofType:@"cikernel"]; - NSString *code = [NSString stringWithContentsOfFile:kernelFile encoding:NSUTF8StringEncoding error:0]; - NSArray *kernels = [CIKernel kernelsWithString:code]; - distantLightFilter = [[kernels objectAtIndex:0] retain]; - } - return [super init]; -} - -- (CIImage *)outputImage -{ - return [self apply:distantLightFilter, [CISampler samplerWithImage:inputNormalMap], inputLightDirection, nil]; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKGammaTransferFilter.cikernel b/WebCore/svg/graphics/filters/cg/WKGammaTransferFilter.cikernel deleted file mode 100644 index 810edb6..0000000 --- a/WebCore/svg/graphics/filters/cg/WKGammaTransferFilter.cikernel +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -kernel vec4 gammaTransfer(sampler image, float amplitude, float exponent, float offset) -{ - vec4 C = sample(image, samplerCoord(image)); - return amplitude * pow(C, vec4(exponent)) + offset; -} diff --git a/WebCore/svg/graphics/filters/cg/WKGammaTransferFilter.h b/WebCore/svg/graphics/filters/cg/WKGammaTransferFilter.h deleted file mode 100644 index 7e0c1e4..0000000 --- a/WebCore/svg/graphics/filters/cg/WKGammaTransferFilter.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -#import <QuartzCore/CoreImage.h> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKGammaTransferFilter : CIFilter { - CIImage *inputImage; - NSNumber *inputAmplitude; - NSNumber *inputExponent; - NSNumber *inputOffset; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKGammaTransferFilter.m b/WebCore/svg/graphics/filters/cg/WKGammaTransferFilter.m deleted file mode 100644 index 8642931..0000000 --- a/WebCore/svg/graphics/filters/cg/WKGammaTransferFilter.m +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -#import "config.h" -#import "WKGammaTransferFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -static CIKernel *gammaTransferFilter = nil; - -@implementation WKGammaTransferFilter -+ (void)initialize -{ - [CIFilter registerFilterName:@"WKGammaTransfer" - constructor:self - classAttributes:[NSDictionary dictionaryWithObjectsAndKeys: - @"WebKit Gamma Transfer", kCIAttributeFilterDisplayName, - [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo, - kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories, - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:1.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputAmplitude", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:1.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputExponent", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeDefault, - [NSNumber numberWithDouble:0.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputOffset", - nil]]; -} - -+ (CIFilter *)filterWithName:(NSString *)name -{ - return [[[self alloc] init] autorelease]; -} - -- (id)init -{ - if (!gammaTransferFilter) { - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; - NSString *kernelFile = [bundle pathForResource:@"WKGammaTransferFilter" ofType:@"cikernel"]; - NSString *code = [NSString stringWithContentsOfFile:kernelFile encoding:NSUTF8StringEncoding error:0]; - NSArray *kernels = [CIKernel kernelsWithString:code]; - gammaTransferFilter = [[kernels objectAtIndex:0] retain]; - } - return [super init]; -} - -- (CIImage *)outputImage -{ - CISampler *inputSampler = [CISampler samplerWithImage: inputImage]; - return [self apply:gammaTransferFilter, inputSampler, inputAmplitude, inputExponent, inputOffset, @"definition", [inputSampler definition], nil]; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKIdentityTransferFilter.h b/WebCore/svg/graphics/filters/cg/WKIdentityTransferFilter.h deleted file mode 100644 index 0c36daa..0000000 --- a/WebCore/svg/graphics/filters/cg/WKIdentityTransferFilter.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -#import <QuartzCore/CoreImage.h> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKIdentityTransferFilter : CIFilter { - CIImage *inputImage; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKIdentityTransferFilter.m b/WebCore/svg/graphics/filters/cg/WKIdentityTransferFilter.m deleted file mode 100644 index 935c305..0000000 --- a/WebCore/svg/graphics/filters/cg/WKIdentityTransferFilter.m +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -#import "config.h" -#import "WKIdentityTransferFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@implementation WKIdentityTransferFilter -+ (void)initialize -{ - [CIFilter registerFilterName:@"WKIdentityTransfer" - constructor:self - classAttributes:[NSDictionary dictionaryWithObjectsAndKeys: - @"WebKit Identity Transfer", kCIAttributeFilterDisplayName, - [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo, - kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories, - nil]]; -} - -+ (CIFilter *)filterWithName:(NSString *)name -{ - return [[[self alloc] init] autorelease]; -} - -- (id)init -{ - return [super init]; -} - -- (CIImage *)outputImage -{ - return inputImage; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKLinearTransferFilter.cikernel b/WebCore/svg/graphics/filters/cg/WKLinearTransferFilter.cikernel deleted file mode 100644 index 17d57e4..0000000 --- a/WebCore/svg/graphics/filters/cg/WKLinearTransferFilter.cikernel +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -kernel vec4 linearTransfer(sampler image, float slope, float intercept) -{ - vec4 C = sample(image, samplerCoord(image)); - return slope * C + intercept; -} diff --git a/WebCore/svg/graphics/filters/cg/WKLinearTransferFilter.h b/WebCore/svg/graphics/filters/cg/WKLinearTransferFilter.h deleted file mode 100644 index 91a99f5..0000000 --- a/WebCore/svg/graphics/filters/cg/WKLinearTransferFilter.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -#import <QuartzCore/CoreImage.h> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKLinearTransferFilter : CIFilter { - CIImage *inputImage; - NSNumber *inputSlope; - NSNumber *inputIntercept; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKLinearTransferFilter.m b/WebCore/svg/graphics/filters/cg/WKLinearTransferFilter.m deleted file mode 100644 index ecfed53..0000000 --- a/WebCore/svg/graphics/filters/cg/WKLinearTransferFilter.m +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -#import "config.h" -#import "WKLinearTransferFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -static CIKernel *linearTransferFilter = nil; - -@implementation WKLinearTransferFilter -+ (void)initialize -{ - [CIFilter registerFilterName:@"WKLinearTransfer" - constructor:self - classAttributes:[NSDictionary dictionaryWithObjectsAndKeys: - @"WebKit Linear Transfer", kCIAttributeFilterDisplayName, - [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo, - kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories, - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:1.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputSlope", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeDefault, - [NSNumber numberWithDouble:0.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputIntersection", - nil]]; -} - -+ (CIFilter *)filterWithName:(NSString *)name -{ - return [[[self alloc] init] autorelease]; -} - -- (id)init -{ - if (!linearTransferFilter) { - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; - NSString *kernelFile = [bundle pathForResource:@"WKLinearTransferFilter" ofType:@"cikernel"]; - NSString *code = [NSString stringWithContentsOfFile:kernelFile encoding:NSUTF8StringEncoding error:0]; - NSArray *kernels = [CIKernel kernelsWithString:code]; - linearTransferFilter = [[kernels objectAtIndex:0] retain]; - } - return [super init]; -} - -- (CIImage *)outputImage -{ - CISampler *inputSampler = [CISampler samplerWithImage: inputImage]; - return [self apply:linearTransferFilter, inputSampler, inputSlope, inputIntercept, @"definition", [inputSampler definition], nil]; -} - -@end - -#endif ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKNormalMapFilter.cikernel b/WebCore/svg/graphics/filters/cg/WKNormalMapFilter.cikernel deleted file mode 100644 index 589f475..0000000 --- a/WebCore/svg/graphics/filters/cg/WKNormalMapFilter.cikernel +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -//TODO: We currently ignore the input kernel lengths -kernel vec4 convolve3x3(sampler image, float divisor, float bias, - vec3 m0, vec3 m1, vec3 m2) -{ - vec4 colour = vec4(0.0, 0.0, 0.0, 0.0); - vec2 pos= samplerCoord(image); - colour = sample(image, pos + vec2(-1.0, -1.0)) *m0.x; - colour += sample(image, pos + vec2(-1.0, 0.0)) *m0.y; - colour += sample(image, pos + vec2(-1.0, 1.0)) *m0.z; - colour += sample(image, pos + vec2( 0.0, -1.0)) *m1.x; - colour += sample(image, pos) * m1.y; - colour += sample(image, pos + vec2( 0.0, 1.0))*m1.z; - colour += sample(image, pos + vec2( 1.0, -1.0))*m2.x; - colour += sample(image, pos + vec2( 1.0, 0.0))*m2.y; - colour += sample(image, pos + vec2( 1.0, 1.0))*m2.z; - return colour / divisor + bias; -} - -kernel vec4 mergeNormals(sampler Nx, sampler Ny, sampler src, float surfaceScale) -{ - vec3 N = vec3(surfaceScale * sample(Nx, samplerCoord(Nx)).a, -surfaceScale * sample(Ny, samplerCoord(Ny)).a, 1.0); - N = normalize(N); - return vec4(N.x, N.y, N.z, sample(src, samplerCoord(src)).a); -} diff --git a/WebCore/svg/graphics/filters/cg/WKNormalMapFilter.h b/WebCore/svg/graphics/filters/cg/WKNormalMapFilter.h deleted file mode 100644 index fb27447..0000000 --- a/WebCore/svg/graphics/filters/cg/WKNormalMapFilter.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. - * - * 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. - */ - -#import <QuartzCore/CoreImage.h> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKNormalMapFilter : CIFilter { - CIImage *inputImage; - NSNumber *inputSurfaceScale; -} -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKNormalMapFilter.m b/WebCore/svg/graphics/filters/cg/WKNormalMapFilter.m deleted file mode 100644 index b462008..0000000 --- a/WebCore/svg/graphics/filters/cg/WKNormalMapFilter.m +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. - * - * 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. - */ - -#import "config.h" -#import "WKNormalMapFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -static CIKernel *convolveKernel = nil; -static CIKernel *normalMapKernel = nil; - -@implementation WKNormalMapFilter - -+ (void)initialize -{ - [CIFilter registerFilterName:@"WKNormalMap" - constructor:self - classAttributes:[NSDictionary dictionaryWithObjectsAndKeys: - @"WebKit Normal Map", kCIAttributeFilterDisplayName, - [NSArray arrayWithObjects: kCICategoryBlur, kCICategoryVideo, - kCICategoryStillImage, kCICategoryNonSquarePixels, nil], kCIAttributeFilterCategories, - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeMin, - [NSNumber numberWithDouble:1.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputSurfaceScale", - nil]]; -} - -+ (CIFilter *)filterWithName:(NSString *)name -{ - return [[[self alloc] init] autorelease]; -} - -- (id)init -{ - if (!normalMapKernel) { - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; - NSString *kernelFile = [bundle pathForResource:@"WKNormalMapFilter" ofType:@"cikernel"]; - NSString *code = [NSString stringWithContentsOfFile:kernelFile encoding:NSUTF8StringEncoding error:0]; - NSArray *kernels = [CIKernel kernelsWithString:code]; - convolveKernel = [[kernels objectAtIndex:0] retain]; - normalMapKernel = [[kernels objectAtIndex:1] retain]; - } - return [super init]; -} - -- (NSArray *)xConvolveArgsWithBumpMap:(CISampler *)bumpMap { - return [NSArray arrayWithObjects: - bumpMap, - [NSNumber numberWithFloat:4], - [NSNumber numberWithFloat:0], - [CIVector vectorWithX:1 Y:2 Z:1], - [CIVector vectorWithX:0 Y:0 Z:0], - [CIVector vectorWithX:-1 Y:-2 Z:-1], - nil]; -} - -- (NSArray *)yConvolveArgsWithBumpMap:(CISampler *)bumpMap { - return [NSArray arrayWithObjects: - bumpMap, - [NSNumber numberWithFloat:4], - [NSNumber numberWithFloat:0], - [CIVector vectorWithX:1 Y:0 Z:-1], - [CIVector vectorWithX:2 Y:0 Z:-2], - [CIVector vectorWithX:1 Y:0 Z:-1], - nil]; -} - -- (CIImage *)outputImage -{ - CISampler *image = [CISampler samplerWithImage:inputImage]; - NSDictionary *applyOptions = [NSDictionary dictionaryWithObjectsAndKeys:[image definition], kCIApplyOptionDefinition, nil]; - - CIImage *convolveX = [self apply:convolveKernel arguments:[self xConvolveArgsWithBumpMap:image] options:applyOptions]; - CIImage *convolveY = [self apply:convolveKernel arguments:[self yConvolveArgsWithBumpMap:image] options:applyOptions]; - CISampler *samplerX = [CISampler samplerWithImage:convolveX]; - CISampler *samplerY = [CISampler samplerWithImage:convolveY]; - - NSArray *normalMapArgs = [NSArray arrayWithObjects:samplerX, samplerY, image, inputSurfaceScale, nil]; - return [self apply:normalMapKernel arguments:normalMapArgs options:applyOptions]; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKPointLightFilter.cikernel b/WebCore/svg/graphics/filters/cg/WKPointLightFilter.cikernel deleted file mode 100644 index fd0a851..0000000 --- a/WebCore/svg/graphics/filters/cg/WKPointLightFilter.cikernel +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -kernel vec4 genPointLight(sampler normalMap, vec3 lightPos, float surfaceScale) -{ - vec2 pos = samplerCoord(normalMap); - vec3 P = vec3(pos.x, pos.y, surfaceScale * sample(normalMap, pos).a); - vec3 L = lightPos - P; - L = normalize(L); - return vec4(L.x, L.y, L.z, 1.0); -} diff --git a/WebCore/svg/graphics/filters/cg/WKPointLightFilter.h b/WebCore/svg/graphics/filters/cg/WKPointLightFilter.h deleted file mode 100644 index 58ec689..0000000 --- a/WebCore/svg/graphics/filters/cg/WKPointLightFilter.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. - * - * 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. - */ - -#import <QuartzCore/CoreImage.h> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKPointLightFilter : CIFilter { - CIImage *inputNormalMap; - CIVector *inputLightPosition; - NSNumber *inputSurfaceScale; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKPointLightFilter.m b/WebCore/svg/graphics/filters/cg/WKPointLightFilter.m deleted file mode 100644 index 331207e..0000000 --- a/WebCore/svg/graphics/filters/cg/WKPointLightFilter.m +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. - * - * 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. - */ - -#import "config.h" -#import "WKPointLightFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -static CIKernel *pointLightFilter = nil; - -@implementation WKPointLightFilter - -+ (void)initialize -{ - [CIFilter registerFilterName:@"WKPointLight" - constructor:self - classAttributes:[NSDictionary dictionaryWithObjectsAndKeys: - @"WebKit Point Light", kCIAttributeFilterDisplayName, - [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo, - kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories, - [NSDictionary dictionaryWithObjectsAndKeys: - kCIAttributeTypePosition3, kCIAttributeType, - nil], @"inputLightPosition", - nil]]; -} - -+ (CIFilter *)filterWithName:(NSString *)name -{ - return [[[self alloc] init] autorelease]; -} - -- (id)init -{ - if (!pointLightFilter) { - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; - NSString *kernelFile = [bundle pathForResource:@"WKPointLightFilter" ofType:@"cikernel"]; - NSString *code = [NSString stringWithContentsOfFile:kernelFile encoding:NSUTF8StringEncoding error:0]; - NSArray *kernels = [CIKernel kernelsWithString:code]; - pointLightFilter = [[kernels objectAtIndex:0] retain]; - } - return [super init]; -} - -- (CIImage *)outputImage -{ - return [self apply:pointLightFilter, inputNormalMap, inputLightPosition, inputSurfaceScale, nil]; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKSpecularLightingFilter.cikernel b/WebCore/svg/graphics/filters/cg/WKSpecularLightingFilter.cikernel deleted file mode 100644 index 64228f0..0000000 --- a/WebCore/svg/graphics/filters/cg/WKSpecularLightingFilter.cikernel +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -kernel vec4 basic(sampler inputNormalVectors, sampler inputLightVectors, __color inputLightingColor, float inputSurfaceScale, float inputSpecularConstant, - float inputSpecularExponent, float inputKernelUnitLengthX, float inputKernelUnitLengthY) -{ - vec2 pos = samplerCoord(inputLightVectors); - vec2 posn = samplerCoord(inputNormalVectors); - vec3 l = sample(inputLightVectors, pos).xyz; - vec3 n = sample(inputNormalVectors, posn).xyz; - vec3 h = l+vec3(0.0, 0.0, 1.0); - h = normalize(h); - float nh = inputSpecularConstant*pow((dot(n, h)), inputSpecularExponent); - vec4 res = inputLightingColor * nh; - res.a = max(res.r, res.g); - res.a = max(res.a, res.b); - return res; -} diff --git a/WebCore/svg/graphics/filters/cg/WKSpecularLightingFilter.h b/WebCore/svg/graphics/filters/cg/WKSpecularLightingFilter.h deleted file mode 100644 index 1b76f2b..0000000 --- a/WebCore/svg/graphics/filters/cg/WKSpecularLightingFilter.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. - * - * 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. - */ - -#import <QuartzCore/CoreImage.h> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKSpecularLightingFilter : CIFilter { - CISampler *inputNormalMap; - CISampler *inputLightVectors; - CIColor *inputLightingColor; - NSNumber *inputSurfaceScale; - NSNumber *inputSpecularConstant; - NSNumber *inputSpecularExponent; - NSNumber *inputKernelUnitLengthX; - NSNumber *inputKernelUnitLengthY; -} -@end - -#endif ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKSpecularLightingFilter.m b/WebCore/svg/graphics/filters/cg/WKSpecularLightingFilter.m deleted file mode 100644 index 22495ae..0000000 --- a/WebCore/svg/graphics/filters/cg/WKSpecularLightingFilter.m +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. - * - * 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. - */ - -#import "config.h" -#import "WKSpecularLightingFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -static CIKernel *specularLightingFilter = nil; - -@implementation WKSpecularLightingFilter - -+ (void)initialize -{ - [CIFilter registerFilterName:@"WKSpecularLighting" - constructor:self - classAttributes:[NSDictionary dictionaryWithObjectsAndKeys: - @"WebKit Specular Lighting", kCIAttributeFilterDisplayName, - [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo, - kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories, - [NSDictionary dictionaryWithObjectsAndKeys: - [CIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f], - kCIAttributeDefault, nil], @"inputLightingColor", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeMin, - [NSNumber numberWithDouble:1.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputSurfaceScale", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeMin, - [NSNumber numberWithDouble:1.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputSpecularConstant", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeMin, - [NSNumber numberWithDouble:128.0], kCIAttributeMin, - [NSNumber numberWithDouble:1.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputSpecularExponent", - [NSDictionary dictionaryWithObjectsAndKeys: - kCIAttributeTypeOffset, kCIAttributeType, - nil], @"inputKernelUnitLength", - nil]]; -} - -+ (CIFilter *)filterWithName:(NSString *)name -{ - return [[[self alloc] init] autorelease]; -} - -- (id)init -{ - if (!specularLightingFilter) { - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; - NSString *kernelFile = [bundle pathForResource:@"WKSpecularLightingFilter" ofType:@"cikernel"]; - NSString *code = [NSString stringWithContentsOfFile:kernelFile encoding:NSUTF8StringEncoding error:0]; - NSArray *kernels = [CIKernel kernelsWithString:code]; - specularLightingFilter = [[kernels objectAtIndex:0] retain]; - } - return [super init]; -} - -- (CIImage *)outputImage -{ - return [self apply:specularLightingFilter, inputNormalMap, inputLightVectors, inputLightingColor, inputSurfaceScale, inputSpecularConstant, - inputSpecularExponent, inputKernelUnitLengthX, inputKernelUnitLengthY, nil]; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKSpotLightFilter.cikernel b/WebCore/svg/graphics/filters/cg/WKSpotLightFilter.cikernel deleted file mode 100644 index 0fa83a8..0000000 --- a/WebCore/svg/graphics/filters/cg/WKSpotLightFilter.cikernel +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -kernel vec4 spotLightFilter(sampler lightVectors, vec3 lightDirection, float specularExponent, float cosCutoffAngle) -{ - vec2 pos = samplerCoord(lightVectors); - vec3 l = sample(lightVectors, pos).xyz; - float sl = -dot(lightDirection, l); - sl = max(sl, 0.0); - sl = pow(sl, specularExponent) * sign(sl - cosCutoffAngle); - return vec4(l.x, l.y, l.z, sl); -} diff --git a/WebCore/svg/graphics/filters/cg/WKSpotLightFilter.h b/WebCore/svg/graphics/filters/cg/WKSpotLightFilter.h deleted file mode 100644 index d87beca..0000000 --- a/WebCore/svg/graphics/filters/cg/WKSpotLightFilter.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. - * - * 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. - */ - -#import <QuartzCore/CoreImage.h> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKSpotLightFilter : CIFilter { - CIImage *inputLightVectors; - CIVector *inputLightDirection; - NSNumber *inputSpecularExponent; - NSNumber *inputLimitingConeAngle; -} -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKSpotLightFilter.m b/WebCore/svg/graphics/filters/cg/WKSpotLightFilter.m deleted file mode 100644 index 62973ef..0000000 --- a/WebCore/svg/graphics/filters/cg/WKSpotLightFilter.m +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. - * - * 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. - */ - -#import "config.h" -#import "WKSpotLightFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -static CIKernel *spotLightFilter = nil; - -@implementation WKSpotLightFilter - -+ (void)initialize -{ - [CIFilter registerFilterName:@"WKSpotLight" - constructor:self - classAttributes:[NSDictionary dictionaryWithObjectsAndKeys: - @"WebKit Spot Light", kCIAttributeFilterDisplayName, - [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo, - kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories, - [NSDictionary dictionaryWithObjectsAndKeys: - kCIAttributeTypePosition3, kCIAttributeType, - nil], @"inputLightDirection", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:1.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputSpecularExponent", - [NSDictionary dictionaryWithObjectsAndKeys: - kCIAttributeTypeAngle, kCIAttributeType, - nil], @"inputLimitingConeAngle", - nil]]; -} - -+ (CIFilter *)filterWithName:(NSString *)name -{ - return [[[self alloc] init] autorelease]; -} - -- (id)init -{ - if (!spotLightFilter) { - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; - NSString *kernelFile = [bundle pathForResource:@"WKSpotLightFilter" ofType:@"cikernel"]; - NSString *code = [NSString stringWithContentsOfFile:kernelFile encoding:NSUTF8StringEncoding error:0]; - NSArray *kernels = [CIKernel kernelsWithString:code]; - spotLightFilter = [[kernels objectAtIndex:0] retain]; - } - return [super init]; -} - -- (CIImage *)outputImage -{ - float coscutoff = cosf([inputLimitingConeAngle floatValue]); - if (coscutoff < 0) - coscutoff = -coscutoff; - return [self apply:spotLightFilter, inputLightVectors, inputLightDirection, inputSpecularExponent, [NSNumber numberWithFloat:coscutoff], nil]; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKTableTransferFilter.cikernel b/WebCore/svg/graphics/filters/cg/WKTableTransferFilter.cikernel deleted file mode 100644 index 19dfcdf..0000000 --- a/WebCore/svg/graphics/filters/cg/WKTableTransferFilter.cikernel +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -/* For some reason CI is ignoring the request to interpolate the colour returned - * when we sample the lookup table. Therefore it is necessary to implement the - * blend operation ourselves. - */ -kernel vec4 tableTransfer(sampler image, sampler table, vec4 rgbaSelector, float maxIndex) -{ - vec4 C = sample(image, samplerCoord(image)); - float k = dot(rgbaSelector, C) * maxIndex; - float t = fract(k); - k = floor(k); - vec4 res = sample(table, vec2(k, 0.0))*(1.0-t)+sample(table, vec2(k+1.0, 0.0))*(t); - return res; -} diff --git a/WebCore/svg/graphics/filters/cg/WKTableTransferFilter.h b/WebCore/svg/graphics/filters/cg/WKTableTransferFilter.h deleted file mode 100644 index 34adf00..0000000 --- a/WebCore/svg/graphics/filters/cg/WKTableTransferFilter.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -#import <QuartzCore/CoreImage.h> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKTableTransferFilter : CIFilter { - CIImage *inputImage; - CIImage *inputTable; - CIVector *inputSelector; -} - -@end - -#endif diff --git a/WebCore/svg/graphics/filters/cg/WKTableTransferFilter.m b/WebCore/svg/graphics/filters/cg/WKTableTransferFilter.m deleted file mode 100644 index 55d7c9d..0000000 --- a/WebCore/svg/graphics/filters/cg/WKTableTransferFilter.m +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>. All rights reserved. - * - * 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 THE AUTHOR ``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 THE AUTHOR 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. - */ - -#import "config.h" -#import "WKTableTransferFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -static CIKernel *tableTransferFilter = nil; - -@implementation WKTableTransferFilter -+ (void)initialize -{ - [CIFilter registerFilterName:@"WKTableTransfer" - constructor:self - classAttributes:[NSDictionary dictionaryWithObjectsAndKeys: - @"WebKit Table Transfer", kCIAttributeFilterDisplayName, - [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo, - kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories, - [NSDictionary dictionaryWithObjectsAndKeys: - kCIAttributeTypeGradient, kCIAttributeType, - nil], @"inputTable", - nil]]; -} - -+ (CIFilter *)filterWithName:(NSString *)name -{ - return [[[self alloc] init] autorelease]; -} - -- (id)init -{ - if (!tableTransferFilter) { - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; - NSString *kernelFile = [bundle pathForResource:@"WKTableTransferFilter" ofType:@"cikernel"]; - NSString *code = [NSString stringWithContentsOfFile:kernelFile encoding:NSUTF8StringEncoding error:0]; - NSArray *kernels = [CIKernel kernelsWithString:code]; - tableTransferFilter = [[kernels objectAtIndex:0] retain]; - } - return [super init]; -} - -- (CIImage *)outputImage -{ - CISampler *inputSampler = [CISampler samplerWithImage: inputImage]; - CISampler *tableSampler = [CISampler samplerWithImage: inputTable keysAndValues:kCISamplerFilterMode, kCISamplerFilterLinear, kCISamplerWrapMode, kCISamplerWrapClamp, nil]; - NSArray *args = [NSArray arrayWithObjects:inputSampler, tableSampler, inputSelector, - [NSNumber numberWithDouble:[inputTable extent].size.width - 1.0f], @"definition", [inputSampler definition], nil]; - return [self apply:tableTransferFilter arguments:args options:nil]; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/mac/SVGResourceFilterPlatformDataMac.h b/WebCore/svg/graphics/mac/SVGResourceFilterPlatformDataMac.h deleted file mode 100644 index 3236ee5..0000000 --- a/WebCore/svg/graphics/mac/SVGResourceFilterPlatformDataMac.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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 - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#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*); - virtual ~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 // #if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#endif // SVGResourceFilterPlatformDataMac_h diff --git a/WebCore/svg/graphics/mac/SVGResourceFilterPlatformDataMac.mm b/WebCore/svg/graphics/mac/SVGResourceFilterPlatformDataMac.mm deleted file mode 100644 index c031bbc..0000000 --- a/WebCore/svg/graphics/mac/SVGResourceFilterPlatformDataMac.mm +++ /dev/null @@ -1,129 +0,0 @@ -/* - * 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 "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#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()); -} - - -} - -#endif // #if ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/qt/RenderPathQt.cpp b/WebCore/svg/graphics/qt/RenderPathQt.cpp deleted file mode 100644 index 8bee8b8..0000000 --- a/WebCore/svg/graphics/qt/RenderPathQt.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org> - 2004, 2005, 2006 Rob Buis <buis@kde.org> - 2005 Eric Seidel <eric.seidel@kdemail.net> - - This file is part of the KDE project - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" -#include "RenderPath.h" -#include "SVGRenderStyle.h" -#include "SVGPaintServer.h" - -#include <QDebug> -#include <QPainterPathStroker> - -namespace WebCore { - -bool RenderPath::strokeContains(const FloatPoint& point, bool requiresStroke) const -{ - if (path().isEmpty()) - return false; - - if (requiresStroke && !SVGPaintServer::strokePaintServer(style(), this)) - return false; - - return false; -} - -static QPainterPath getPathStroke(const QPainterPath &path, const RenderObject* object, const RenderStyle* style) -{ - QPainterPathStroker s; - s.setWidth(SVGRenderStyle::cssPrimitiveToLength(object, style->svgStyle()->strokeWidth(), 1.0)); - - if (style->svgStyle()->capStyle() == ButtCap) - s.setCapStyle(Qt::FlatCap); - else if (style->svgStyle()->capStyle() == RoundCap) - s.setCapStyle(Qt::RoundCap); - - if (style->svgStyle()->joinStyle() == MiterJoin) { - s.setJoinStyle(Qt::MiterJoin); - s.setMiterLimit((qreal) style->svgStyle()->strokeMiterLimit()); - } else if(style->svgStyle()->joinStyle() == RoundJoin) - s.setJoinStyle(Qt::RoundJoin); - - const DashArray& dashes = WebCore::dashArrayFromRenderingStyle(style); - double dashOffset = SVGRenderStyle::cssPrimitiveToLength(object, style->svgStyle()->strokeDashOffset(), 0.0); - - unsigned int dashLength = !dashes.isEmpty() ? dashes.size() : 0; - if(dashLength) { - QVector<qreal> pattern; - unsigned int count = (dashLength % 2) == 0 ? dashLength : dashLength * 2; - - for(unsigned int i = 0; i < count; i++) - pattern.append(dashes[i % dashLength] / (float)s.width()); - - s.setDashPattern(pattern); - - Q_UNUSED(dashOffset); - // TODO: dash-offset, does/will qt4 API allow it? (Rob) - } - - return s.createStroke(path); -} - -FloatRect RenderPath::strokeBBox() const -{ - QPainterPath outline = getPathStroke(*(path().platformPath()), this, style()); - return outline.boundingRect(); -} - -} - -// vim:ts=4:noet diff --git a/WebCore/svg/graphics/qt/SVGPaintServerGradientQt.cpp b/WebCore/svg/graphics/qt/SVGPaintServerGradientQt.cpp deleted file mode 100644 index 113f9a7..0000000 --- a/WebCore/svg/graphics/qt/SVGPaintServerGradientQt.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - Copyright (C) 2006 Nikolas Zimmermann <wildfox@kde.org> - - This file is part of the KDE project - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) -#include "SVGPaintServerGradient.h" - -#include "GraphicsContext.h" -#include "RenderObject.h" -#include "RenderStyle.h" -#include "SVGGradientElement.h" - -#include <QPainter> -#include <QPainterPath> -#include <QColor> -#include <QGradient> - -namespace WebCore { - -// Helper function used by linear & radial gradient -void SVGPaintServerGradient::fillColorArray(QGradient& gradient, const Vector<SVGGradientStop>& stops, - float opacity) const -{ - for (unsigned i = 0; i < stops.size(); ++i) { - float offset = stops[i].first; - Color color = stops[i].second; - - QColor c(color.red(), color.green(), color.blue()); - c.setAlpha(int(color.alpha() * opacity)); - - gradient.setColorAt(offset, c); - } -} - -bool SVGPaintServerGradient::setup(GraphicsContext*& context, const RenderObject* object, - SVGPaintTargetType type, bool isPaintingText) const -{ - m_ownerElement->buildGradient(); - - QPainter* painter(context ? context->platformContext() : 0); - Q_ASSERT(painter); - - QPainterPath* path(context ? context->currentPath() : 0); - Q_ASSERT(path); - - const SVGRenderStyle* svgStyle = object->style()->svgStyle(); - RenderStyle* style = object->style(); - - QGradient gradient = setupGradient(context, object); - - painter->setPen(Qt::NoPen); - painter->setBrush(Qt::NoBrush); - - if (spreadMethod() == SpreadMethodRepeat) - gradient.setSpread(QGradient::RepeatSpread); - else if (spreadMethod() == SpreadMethodReflect) - gradient.setSpread(QGradient::ReflectSpread); - else - gradient.setSpread(QGradient::PadSpread); - double opacity = 1.0; - - if ((type & ApplyToFillTargetType) && svgStyle->hasFill()) { - fillColorArray(gradient, gradientStops(), opacity); - - QBrush brush(gradient); - brush.setMatrix(gradientTransform()); - - painter->setBrush(brush); - context->setFillRule(svgStyle->fillRule()); - } - - if ((type & ApplyToStrokeTargetType) && svgStyle->hasStroke()) { - fillColorArray(gradient, gradientStops(), opacity); - - QPen pen; - QBrush brush(gradient); - brush.setMatrix(gradientTransform()); - pen.setBrush(brush); - painter->setPen(pen); - - applyStrokeStyleToContext(context, style, object); - } - - return true; -} - -} // namespace WebCore - -#endif - -// vim:ts=4:noet diff --git a/WebCore/svg/graphics/qt/SVGPaintServerLinearGradientQt.cpp b/WebCore/svg/graphics/qt/SVGPaintServerLinearGradientQt.cpp deleted file mode 100644 index 69934ab..0000000 --- a/WebCore/svg/graphics/qt/SVGPaintServerLinearGradientQt.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2006 Nikolas Zimmermann <wildfox@kde.org> - - This file is part of the KDE project - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) -#include "SVGPaintServerLinearGradient.h" -#include "SVGGradientElement.h" - -#include "GraphicsContext.h" -#include "RenderPath.h" - -#include <QLinearGradient> -#include <QPainter> -#include <QPainterPath> - -namespace WebCore { - -QGradient SVGPaintServerLinearGradient::setupGradient(GraphicsContext*& context, const RenderObject* object) const -{ - QPainterPath* path(context ? context->currentPath() : 0); - Q_ASSERT(path); - - double x1, x2, y1, y2; - if (boundingBoxMode()) { - QRectF bbox = path->boundingRect(); - x1 = bbox.x(); - y1 = bbox.y(); - x2 = bbox.x() + bbox.width(); - y2 = bbox.y() + bbox.height(); - } else { - x1 = gradientStart().x(); - y1 = gradientStart().y(); - x2 = gradientEnd().x(); - y2 = gradientEnd().y(); - } - - QLinearGradient gradient(QPointF(x1, y1), QPointF(x2, y2)); - - return gradient; -} - -} // namespace WebCore - -#endif - -// vim:ts=4:noet diff --git a/WebCore/svg/graphics/qt/SVGPaintServerPatternQt.cpp b/WebCore/svg/graphics/qt/SVGPaintServerPatternQt.cpp deleted file mode 100644 index 70ec14c..0000000 --- a/WebCore/svg/graphics/qt/SVGPaintServerPatternQt.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - Copyright (C) 2006 Nikolas Zimmermann <wildfox@kde.org> - Copyright (C) 2008 Dirk Schulze <vbs85@gmx.de> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) -#include "SVGPaintServerPattern.h" - -#include "AffineTransform.h" -#include "GraphicsContext.h" -#include "ImageBuffer.h" -#include "Pattern.h" -#include "RenderObject.h" -#include "SVGPatternElement.h" - -#include <QPainter> -#include <QPainterPath> - -namespace WebCore { - -bool SVGPaintServerPattern::setup(GraphicsContext*& context, const RenderObject* object, SVGPaintTargetType type, bool isPaintingText) const -{ - Q_ASSERT(context); - Q_ASSERT(object); - - FloatRect targetRect = object->relativeBBox(false); - m_ownerElement->buildPattern(targetRect); - - if (!tile()) - return false; - - QPainter* painter = context->platformContext(); - QPainterPath* path = context->currentPath(); - - RenderStyle* style = object->style(); - const SVGRenderStyle* svgStyle = object->style()->svgStyle(); - - RefPtr<Pattern> pattern = Pattern::create(tile()->image(), true, true); - - context->save(); - painter->setPen(Qt::NoPen); - painter->setBrush(Qt::NoBrush); - - AffineTransform affine; - affine.translate(patternBoundaries().x(), patternBoundaries().y()); - affine.multiply(patternTransform()); - - QBrush brush(pattern->createPlatformPattern(affine)); - if ((type & ApplyToFillTargetType) && svgStyle->hasFill()) { - painter->setBrush(brush); - context->setFillRule(svgStyle->fillRule()); - } - - if ((type & ApplyToStrokeTargetType) && svgStyle->hasStroke()) { - QPen pen; - pen.setBrush(brush); - painter->setPen(pen); - applyStrokeStyleToContext(context, style, object); - } - - return true; -} - -void SVGPaintServerPattern::teardown(GraphicsContext*& context, const RenderObject*, SVGPaintTargetType, bool) const -{ - context->restore(); -} - -} // namespace WebCore - -#endif - -// vim:ts=4:noet diff --git a/WebCore/svg/graphics/qt/SVGPaintServerQt.cpp b/WebCore/svg/graphics/qt/SVGPaintServerQt.cpp deleted file mode 100644 index 801201b..0000000 --- a/WebCore/svg/graphics/qt/SVGPaintServerQt.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - Copyright (C) 2006 Nikolas Zimmermann <wildfox@kde.org> - Copyright (C) 2008 Holger Hans Peter Freyther - - This file is part of the KDE project - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) -#include "SVGPaintServer.h" - -#include "GraphicsContext.h" -#include "SVGRenderStyle.h" -#include "RenderObject.h" - -#include <QPainter> -#include <QVector> - -namespace WebCore { - -void SVGPaintServer::draw(GraphicsContext*& context, const RenderObject* path, SVGPaintTargetType type) const -{ - if (!setup(context, path, type)) - return; - - renderPath(context, path, type); - teardown(context, path, type); -} - -void SVGPaintServer::teardown(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText) const -{ - // no-op -} - -void SVGPaintServer::renderPath(GraphicsContext*& context, const RenderObject* path, SVGPaintTargetType type) const -{ - RenderStyle* renderStyle = path ? path->style(): 0; - - QPainter* painter(context ? context->platformContext() : 0); - Q_ASSERT(painter); - - QPainterPath* painterPath(context ? context->currentPath() : 0); - Q_ASSERT(painterPath); - - if ((type & ApplyToFillTargetType) && (!renderStyle || renderStyle->svgStyle()->hasFill())) - painter->fillPath(*painterPath, painter->brush()); - - if ((type & ApplyToStrokeTargetType) && (!renderStyle || renderStyle->svgStyle()->hasStroke())) - painter->strokePath(*painterPath, painter->pen()); -} - -} // namespace WebCore - -#endif - -// vim:ts=4:noet diff --git a/WebCore/svg/graphics/qt/SVGPaintServerRadialGradientQt.cpp b/WebCore/svg/graphics/qt/SVGPaintServerRadialGradientQt.cpp deleted file mode 100644 index 95d71a3..0000000 --- a/WebCore/svg/graphics/qt/SVGPaintServerRadialGradientQt.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - Copyright (C) 2006 Nikolas Zimmermann <wildfox@kde.org> - - This file is part of the KDE project - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) -#include "SVGPaintServerRadialGradient.h" - -#include "GraphicsContext.h" -#include "RenderPath.h" - -#include <math.h> -#include <QPainter> -#include <QPainterPath> -#include <QRadialGradient> - -namespace WebCore { - -QGradient SVGPaintServerRadialGradient::setupGradient(GraphicsContext*& context, const RenderObject* object) const -{ - QPainter* painter(context ? context->platformContext() : 0); - Q_ASSERT(painter); - - QPainterPath* path(context ? context->currentPath() : 0); - Q_ASSERT(path); - - RenderStyle* renderStyle = object->style(); - - QMatrix mat = painter->matrix(); - - double cx, fx, cy, fy, r; - if (boundingBoxMode()) { - QRectF bbox = path->boundingRect(); - cx = double(bbox.left()) + (double(gradientCenter().x() / 100.0) * double(bbox.width())); - cy = double(bbox.top()) + (double(gradientCenter().y() / 100.0) * double(bbox.height())); - fx = double(bbox.left()) + (double(gradientFocal().x() / 100.0) * double(bbox.width())) - cx; - fy = double(bbox.top()) + (double(gradientFocal().y() / 100.0) * double(bbox.height())) - cy; - r = double(gradientRadius() / 100.0) * (sqrt(pow(bbox.width(), 2) + pow(bbox.height(), 2))); - - float width = bbox.width(); - float height = bbox.height(); - - int diff = int(width - height); // allow slight tolerance - if (!(diff > -2 && diff < 2)) { - // make elliptical or circular depending on bbox aspect ratio - float ratioX = (width / height); - float ratioY = (height / width); - mat.scale((width > height) ? 1 : ratioX, (width > height) ? ratioY : 1); - } - } else { - cx = gradientCenter().x(); - cy = gradientCenter().y(); - - fx = gradientFocal().x(); - fy = gradientFocal().y(); - - fx -= cx; - fy -= cy; - - r = gradientRadius(); - } - - if (sqrt(fx * fx + fy * fy) > r) { - // Spec: If (fx, fy) lies outside the circle defined by (cx, cy) and r, set (fx, fy) - // to the point of intersection of the line through (fx, fy) and the circle. - double angle = atan2(fy, fx); - fx = int(cos(angle) * r) - 1; - fy = int(sin(angle) * r) - 1; - } - - QRadialGradient gradient(QPointF(cx, cy), gradientRadius(), QPointF(fx + cx, fy + cy)); - - return gradient; -} - -} // namespace WebCore - -#endif - -// vim:ts=4:noet diff --git a/WebCore/svg/graphics/qt/SVGPaintServerSolidQt.cpp b/WebCore/svg/graphics/qt/SVGPaintServerSolidQt.cpp deleted file mode 100644 index e088df2..0000000 --- a/WebCore/svg/graphics/qt/SVGPaintServerSolidQt.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - Copyright (C) 2006 Nikolas Zimmermann <wildfox@kde.org> - Copyright (C) 2008 Holger Hans Peter Freyther - - This file is part of the KDE project - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) -#include "SVGPaintServerSolid.h" - -#include "GraphicsContext.h" -#include "RenderPath.h" - -#include <QPainter> - -namespace WebCore { - -bool SVGPaintServerSolid::setup(GraphicsContext*& context, const RenderObject* object, SVGPaintTargetType type, bool isPaintingText) const -{ - QPainter* painter(context ? context->platformContext() : 0); - Q_ASSERT(painter); - - const SVGRenderStyle* svgStyle = object->style()->svgStyle(); - RenderStyle* style = object ? object->style() : 0; - // TODO? painter->setOpacity(renderStyle->opacity()); - - QColor c = color(); - - if ((type & ApplyToFillTargetType) && (!style || svgStyle->hasFill())) { - if (style) - c.setAlphaF(svgStyle->fillOpacity()); - - QBrush brush(c); - painter->setBrush(brush); - - if (style) - context->setFillRule(svgStyle->fillRule()); - - /* if(isPaintingText()) ... */ - } - - if ((type & ApplyToStrokeTargetType) && (!style || svgStyle->hasStroke())) { - if (style) - c.setAlphaF(svgStyle->strokeOpacity()); - - QPen pen(c); - painter->setPen(pen); - if (style) - applyStrokeStyleToContext(context, style, object); - - /* if(isPaintingText()) ... */ - } - - return true; -} - -} // namespace WebCore - -#endif - -// vim:ts=4:noet diff --git a/WebCore/svg/graphics/qt/SVGResourceClipperQt.cpp b/WebCore/svg/graphics/qt/SVGResourceClipperQt.cpp deleted file mode 100644 index 42d3855..0000000 --- a/WebCore/svg/graphics/qt/SVGResourceClipperQt.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org> - 2004, 2005, 2006 Rob Buis <buis@kde.org> - 2005 Apple Computer, Inc. - - This file is part of the KDE project - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) -#include "SVGResourceClipper.h" - -#include "GraphicsContext.h" - -#include <QPainter> -#include <QPainterPath> - -namespace WebCore { - -void SVGResourceClipper::applyClip(GraphicsContext* context, const FloatRect& boundingBox) const -{ - if (m_clipData.clipData().size() < 1) - return; - - context->beginPath(); - - QPainterPath newPath; - - bool heterogenousClipRules = false; - WindRule clipRule = m_clipData.clipData()[0].windRule; - - unsigned int clipDataCount = m_clipData.clipData().size(); - for (unsigned int x = 0; x < clipDataCount; x++) { - ClipData clipData = m_clipData.clipData()[x]; - if (clipData.windRule != clipRule) - heterogenousClipRules = true; - - QPainterPath path = *(clipData.path.platformPath()); - if (path.isEmpty()) - continue; - - if (!newPath.isEmpty()) - newPath.closeSubpath(); - - // Respect clipping units... - QMatrix transform; - - if (clipData.bboxUnits) { - transform.translate(boundingBox.x(), boundingBox.y()); - transform.scale(boundingBox.width(), boundingBox.height()); - } - - // TODO: support heterogenous clip rules! - //clipRule = (clipData.windRule() == RULE_EVENODD ? Qt::OddEvenFill : Qt::WindingFill); - - for (int i = 0; i < path.elementCount(); ++i) { - const QPainterPath::Element &cur = path.elementAt(i); - - switch (cur.type) { - case QPainterPath::MoveToElement: - newPath.moveTo(QPointF(cur.x, cur.y) * transform); - break; - case QPainterPath::LineToElement: - newPath.lineTo(QPointF(cur.x, cur.y) * transform); - break; - case QPainterPath::CurveToElement: - { - const QPainterPath::Element &c1 = path.elementAt(i + 1); - const QPainterPath::Element &c2 = path.elementAt(i + 2); - - Q_ASSERT(c1.type == QPainterPath::CurveToDataElement); - Q_ASSERT(c2.type == QPainterPath::CurveToDataElement); - - newPath.cubicTo(QPointF(cur.x, cur.y) * transform, - QPointF(c1.x, c1.y) * transform, - QPointF(c2.x, c2.y) * transform); - - i += 2; - break; - } - case QPainterPath::CurveToDataElement: - Q_ASSERT(false); - break; - } - } - } - - if (m_clipData.clipData().size()) { - // FIXME! - // We don't currently allow for heterogenous clip rules. - // we would have to detect such, draw to a mask, and then clip - // to that mask - // if (!CGContextIsPathEmpty(cgContext)) { - if (clipRule == RULE_EVENODD) - newPath.setFillRule(Qt::OddEvenFill); - else - newPath.setFillRule(Qt::WindingFill); - // } - } - - QPainter* painter(context ? context->platformContext() : 0); - Q_ASSERT(painter); - - painter->setClipPath(newPath); -} - -} // namespace WebCore - -#endif - -// vim:ts=4:noet diff --git a/WebCore/svg/graphics/qt/SVGResourceFilterQt.cpp b/WebCore/svg/graphics/qt/SVGResourceFilterQt.cpp deleted file mode 100644 index cbf90cd..0000000 --- a/WebCore/svg/graphics/qt/SVGResourceFilterQt.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (C) 2006 Nikolas Zimmermann <wildfox@kde.org> - - This file is part of the KDE project - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "SVGResourceFilter.h" -#include "NotImplemented.h" - -namespace WebCore { - -SVGResourceFilterPlatformData* SVGResourceFilter::createPlatformData() -{ - notImplemented(); - return 0; -} - -void SVGResourceFilter::prepareFilter(GraphicsContext*&, const FloatRect&) -{ - notImplemented(); -} - -void SVGResourceFilter::applyFilter(GraphicsContext*&, const FloatRect&) -{ - notImplemented(); -} - -} // namespace WebCore - -#endif - -// vim:ts=4:noet diff --git a/WebCore/svg/graphics/qt/SVGResourceMaskerQt.cpp b/WebCore/svg/graphics/qt/SVGResourceMaskerQt.cpp deleted file mode 100644 index 2b89bac..0000000 --- a/WebCore/svg/graphics/qt/SVGResourceMaskerQt.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - Copyright (C) 2006 Nikolas Zimmermann <wildfox@kde.org> - - This file is part of the KDE project - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) -#include "SVGResourceMasker.h" - -namespace WebCore { - -void SVGResourceMasker::applyMask(GraphicsContext*, const FloatRect&) -{ - // FIXME: implement me :-) -} - -} // namespace WebCore - -#endif - -// vim:ts=4:noet |