diff options
Diffstat (limited to 'WebCore')
93 files changed, 208 insertions, 3159 deletions
diff --git a/WebCore/Android.v8.mk b/WebCore/Android.v8.mk index e85cae8..dffe8a3 100644 --- a/WebCore/Android.v8.mk +++ b/WebCore/Android.v8.mk @@ -972,9 +972,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ svg/graphics/filters/SVGFETile.cpp \ svg/graphics/filters/SVGFETurbulence.cpp \ svg/graphics/filters/SVGFilterEffect.cpp \ - svg/graphics/filters/SVGLightSource.cpp \ - \ - svg/graphics/skia/SVGResourceFilterSkia.cpp + svg/graphics/filters/SVGLightSource.cpp endif LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ diff --git a/WebCore/bindings/v8/ChildThreadDOMData.h b/WebCore/bindings/v8/ChildThreadDOMData.h index ab90e5b..173a5e8 100644 --- a/WebCore/bindings/v8/ChildThreadDOMData.h +++ b/WebCore/bindings/v8/ChildThreadDOMData.h @@ -39,7 +39,9 @@ namespace WebCore { class ChildThreadDOMData : public DOMData { public: ChildThreadDOMData(); +#if PLATFORM(ANDROID) virtual ~ChildThreadDOMData() { } +#endif DOMDataStore& getStore(); diff --git a/WebCore/bindings/v8/DOMData.h b/WebCore/bindings/v8/DOMData.h index 07e14e5..e67adb4 100644 --- a/WebCore/bindings/v8/DOMData.h +++ b/WebCore/bindings/v8/DOMData.h @@ -45,7 +45,9 @@ namespace WebCore { class DOMData : public Noncopyable { public: DOMData(); +#if PLATFORM(ANDROID) virtual ~DOMData() { } +#endif static DOMData* getCurrent(); static DOMData* getCurrentMainThread(); // Caller must be on the main thread. diff --git a/WebCore/bindings/v8/DOMObjectsInclude.h b/WebCore/bindings/v8/DOMObjectsInclude.h index 275d56d..ec5c466 100644 --- a/WebCore/bindings/v8/DOMObjectsInclude.h +++ b/WebCore/bindings/v8/DOMObjectsInclude.h @@ -105,7 +105,6 @@ #include "HTMLSelectElement.h" #include "HTMLOptionsCollection.h" #include "ImageData.h" -#include "InspectorBackend.h" #include "KeyboardEvent.h" #include "Location.h" #include "Media.h" @@ -149,6 +148,7 @@ #include "TextMetrics.h" #include "TimeRanges.h" #include "TreeWalker.h" +#include "XSLTProcessor.h" #include "V8AbstractEventListener.h" #include "V8CustomEventListener.h" #include "V8DOMWindow.h" @@ -156,7 +156,6 @@ #include "V8LazyEventListener.h" #include "V8NodeFilterCondition.h" #include "ValidityState.h" -#include "VoidCallback.h" #include "WebKitAnimationEvent.h" #include "WebKitCSSKeyframeRule.h" #include "WebKitCSSKeyframesRule.h" @@ -174,7 +173,6 @@ #include "XPathExpression.h" #include "XPathNSResolver.h" #include "XPathResult.h" -#include "XSLTProcessor.h" #if ENABLE(OFFLINE_WEB_APPLICATIONS) #include "DOMApplicationCache.h" @@ -234,11 +232,14 @@ #include "V8SVGPODTypeWrapper.h" #endif // SVG +#if PLATFORM(ANDROID) +// TODO: Upstream TOUCH_EVENTS guard. #if ENABLE(TOUCH_EVENTS) #include "Touch.h" #include "TouchList.h" #include "TouchEvent.h" #endif +#endif #if ENABLE(WEB_SOCKETS) #include "WebSocket.h" @@ -261,6 +262,13 @@ #include "XPathEvaluator.h" #endif // XPATH +#if PLATFORM(ANDROID) +// TODO: Upstream INSPECTOR guard. +#if ENABLE(INSPECTOR) +#include "InspectorBackend.h" +#endif // INSPECTOR +#endif + namespace WebCore { // A helper class for undetectable document.all diff --git a/WebCore/bindings/v8/DerivedSourcesAllInOne.cpp b/WebCore/bindings/v8/DerivedSourcesAllInOne.cpp index 2d9715a..c56a695 100644 --- a/WebCore/bindings/v8/DerivedSourcesAllInOne.cpp +++ b/WebCore/bindings/v8/DerivedSourcesAllInOne.cpp @@ -175,11 +175,6 @@ #include "bindings/V8HTMLUListElement.cpp" #include "bindings/V8HTMLVideoElement.cpp" #include "bindings/V8ImageData.cpp" -#if PLATFORM(ANDROID) -// No inspector for now -#else -#include "bindings/V8InspectorBackend.cpp" -#endif #include "bindings/V8KeyboardEvent.cpp" #include "bindings/V8Location.cpp" #include "bindings/V8Media.cpp" @@ -406,3 +401,10 @@ #include "bindings/V8XSLTProcessor.cpp" #endif #endif + +#if PLATFORM(ANDROID) +// TODO: Upstream INSPECTOR guard. +#if ENABLE(INSPECTOR) +#include "bindings/V8InspectorBackend.cpp" +#endif +#endif diff --git a/WebCore/bindings/v8/V8Index.cpp b/WebCore/bindings/v8/V8Index.cpp index 5782aac..396c93f 100644 --- a/WebCore/bindings/v8/V8Index.cpp +++ b/WebCore/bindings/v8/V8Index.cpp @@ -200,24 +200,11 @@ #include "V8XMLHttpRequestUpload.h" #include "V8XMLSerializer.h" #include "V8RGBColor.h" -#include "V8VoidCallback.h" - -#if !PLATFORM(ANDROID) -#include "V8InspectorBackend.h" -#endif #if ENABLE(OFFLINE_WEB_APPLICATIONS) #include "V8DOMApplicationCache.h" #endif -#if ENABLE(DATABASE) -#include "V8Database.h" -#include "V8SQLError.h" -#include "V8SQLResultSet.h" -#include "V8SQLResultSetRowList.h" -#include "V8SQLTransaction.h" -#endif - #if ENABLE(DOM_STORAGE) #include "V8Storage.h" #include "V8StorageEvent.h" @@ -404,6 +391,35 @@ #include "V8SharedWorker.h" #endif +#if ENABLE(3D_CANVAS) +#include "V8CanvasRenderingContext3D.h" +#include "V8CanvasArrayBuffer.h" +#include "V8CanvasArray.h" +#include "V8CanvasByteArray.h" +#include "V8CanvasBuffer.h" +#include "V8CanvasFloatArray.h" +#include "V8CanvasFramebuffer.h" +#include "V8CanvasIntArray.h" +#include "V8CanvasProgram.h" +#include "V8CanvasRenderbuffer.h" +#include "V8CanvasShader.h" +#include "V8CanvasShortArray.h" +#include "V8CanvasTexture.h" +#include "V8CanvasUnsignedByteArray.h" +#include "V8CanvasUnsignedIntArray.h" +#include "V8CanvasUnsignedShortArray.h" +#endif + +#if PLATFORM(ANDROID) +// TODO: Upstream these guards to webkit.org +#if ENABLE(DATABASE) +#include "V8Database.h" +#include "V8SQLError.h" +#include "V8SQLResultSet.h" +#include "V8SQLResultSetRowList.h" +#include "V8SQLTransaction.h" +#endif + #if ENABLE(GEOLOCATION) #include "V8Coordinates.h" #include "V8Geolocation.h" @@ -429,25 +445,13 @@ #include "V8XSLTProcessor.h" #endif -#if ENABLE(3D_CANVAS) -#include "V8CanvasRenderingContext3D.h" -#include "V8CanvasArrayBuffer.h" -#include "V8CanvasArray.h" -#include "V8CanvasByteArray.h" -#include "V8CanvasBuffer.h" -#include "V8CanvasFloatArray.h" -#include "V8CanvasFramebuffer.h" -#include "V8CanvasIntArray.h" -#include "V8CanvasProgram.h" -#include "V8CanvasRenderbuffer.h" -#include "V8CanvasShader.h" -#include "V8CanvasShortArray.h" -#include "V8CanvasTexture.h" -#include "V8CanvasUnsignedByteArray.h" -#include "V8CanvasUnsignedIntArray.h" -#include "V8CanvasUnsignedShortArray.h" +#if ENABLE(INSPECTOR) +#include "V8InspectorBackend.h" #endif +#include "V8VoidCallback.h" +#endif // PLATFORM(ANDROID) + namespace WebCore { FunctionTemplateFactory V8ClassIndex::GetFactory(V8WrapperType type) diff --git a/WebCore/bindings/v8/V8Index.h b/WebCore/bindings/v8/V8Index.h index e91ffd7..6255079 100644 --- a/WebCore/bindings/v8/V8Index.h +++ b/WebCore/bindings/v8/V8Index.h @@ -363,7 +363,7 @@ typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)(); V(CANVASPIXELARRAY, CanvasPixelArray) \ V(KEYBOARDEVENT, KeyboardEvent) \ V(LOCATION, Location) \ - V(MEDIA, Media) \ + V(MEDIA, Media) \ V(MEDIALIST, MediaList) #define DOM_OBJECT_TYPES_2(V) \ @@ -395,7 +395,6 @@ typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)(); V(TREEWALKER, TreeWalker) \ V(UIEVENT, UIEvent) \ V(VALIDITYSTATE, ValidityState) \ - V(VOIDCALLBACK, VoidCallback) \ V(WEBKITANIMATIONEVENT, WebKitAnimationEvent) \ V(WEBKITCSSKEYFRAMERULE, WebKitCSSKeyframeRule) \ V(WEBKITCSSKEYFRAMESRULE, WebKitCSSKeyframesRule) \ @@ -416,24 +415,6 @@ typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)(); SHARED_WORKER_NONNODE_WRAPPER_TYPES(V) \ WORKER_NONNODE_WRAPPER_TYPES(V) -#if ENABLE(XPATH) -#define DOM_OBJECT_XPATH_TYPES(V) \ - V(XPATHEVALUATOR, XPathEvaluator) \ - V(XPATHEXCEPTION, XPathException) \ - V(XPATHEXPRESSION, XPathExpression) \ - V(XPATHNSRESOLVER, XPathNSResolver) \ - V(XPATHRESULT, XPathResult) -#else -#define DOM_OBJECT_XPATH_TYPES(V) -#endif - -#if ENABLE(XSLT) -#define DOM_OBJECT_XSLT_TYPES(V) \ - V(XSLTPROCESSOR, XSLTProcessor) -#else -#define DOM_OBJECT_XSLT_TYPES(V) -#endif - #if ENABLE(DATABASE) #define DOM_OBJECT_DATABASE_TYPES(V) \ V(DATABASE, Database) \ @@ -460,16 +441,6 @@ typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)(); #define DOM_OBJECT_WORKERS_TYPES(V) #endif -#if ENABLE(GEOLOCATION) -#define DOM_OBJECT_GEOLOCATION_TYPES(V) \ - V(COORDINATES, Coordinates) \ - V(GEOLOCATION, Geolocation) \ - V(GEOPOSITION, Geoposition) \ - V(POSITIONERROR, PositionError) -#else -#define DOM_OBJECT_GEOLOCATION_TYPES(V) -#endif - #if ENABLE(3D_CANVAS) #define DOM_OBJECT_3D_CANVAS_TYPES(V) \ V(CANVASARRAY, CanvasArray) \ @@ -492,6 +463,8 @@ typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)(); #define DOM_OBJECT_3D_CANVAS_TYPES(V) #endif +#if PLATFORM(ANDROID) +// TODO: Upstream these guards. #if ENABLE(TOUCH_EVENTS) #define DOM_OBJECT_TOUCH_EVENT_TYPES(V) \ V(TOUCHLIST, TouchList) \ @@ -501,7 +474,51 @@ typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)(); #define DOM_OBJECT_TOUCH_EVENT_TYPES(V) #endif -#if PLATFORM(CHROMIUM) +#if ENABLE(XPATH) +#define DOM_OBJECT_XPATH_TYPES(V) \ + V(XPATHEVALUATOR, XPathEvaluator) \ + V(XPATHEXCEPTION, XPathException) \ + V(XPATHEXPRESSION, XPathExpression) \ + V(XPATHNSRESOLVER, XPathNSResolver) \ + V(XPATHRESULT, XPathResult) +#else +#define DOM_OBJECT_XPATH_TYPES(V) +#endif + +#if ENABLE(XSLT) +#define DOM_OBJECT_XSLT_TYPES(V) \ + V(XSLTPROCESSOR, XSLTProcessor) +#else +#define DOM_OBJECT_XSLT_TYPES(V) +#endif + +#if ENABLE(GEOLOCATION) +#define DOM_OBJECT_GEOLOCATION_TYPES(V) \ + V(COORDINATES, Coordinates) \ + V(GEOLOCATION, Geolocation) \ + V(GEOPOSITION, Geoposition) \ + V(POSITIONERROR, PositionError) +#else +#define DOM_OBJECT_GEOLOCATION_TYPES(V) +#endif + +#if ENABLE(INSPECTOR) +#define DOM_OBJECT_INSPECTOR_TYPES(V) \ + V(INSPECTORBACKEND, InspectorBackend) +#else +#define DOM_OBJECT_INSPECTOR_TYPES(V) +#endif +#endif + +#if PLATFORM(ANDROID) +#define DOM_OBJECT_VOIDCALLBACK_TYPES(V) \ + V(VOIDCALLBACK, VoidCallback) +#else +#define DOM_OBJECT_VOIDCALLBACK_TYPES(V) +#endif + +#if PLATFORM(ANDROID) +// This block is modified, but is not Android-specific. #define DOM_OBJECT_TYPES(V) \ DOM_OBJECT_TYPES_1(V) \ DOM_OBJECT_TYPES_2(V) \ @@ -511,16 +528,10 @@ typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)(); DOM_OBJECT_3D_CANVAS_TYPES(V) \ DOM_OBJECT_XPATH_TYPES(V) \ DOM_OBJECT_XSLT_TYPES(V) \ - V(INSPECTORBACKEND, InspectorBackend) -#elif PLATFORM(ANDROID) -#define DOM_OBJECT_TYPES(V) \ - DOM_OBJECT_TYPES_1(V) \ - DOM_OBJECT_TYPES_2(V) \ - DOM_OBJECT_DATABASE_TYPES(V) \ DOM_OBJECT_GEOLOCATION_TYPES(V) \ - DOM_OBJECT_STORAGE_TYPES(V) \ DOM_OBJECT_TOUCH_EVENT_TYPES(V) \ - DOM_OBJECT_WORKERS_TYPES(V) + DOM_OBJECT_VOIDCALLBACK_TYPES(V) \ + DOM_OBJECT_INSPECTOR_TYPES(V) #endif #if ENABLE(SVG) diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp index fa2370c..dd3c218 100644 --- a/WebCore/bindings/v8/V8Proxy.cpp +++ b/WebCore/bindings/v8/V8Proxy.cpp @@ -32,7 +32,6 @@ #include "V8Proxy.h" #include "CSSMutableStyleDeclaration.h" -#include "CString.h" #include "DateExtension.h" #include "DOMObjectsInclude.h" #include "DocumentLoader.h" @@ -51,6 +50,8 @@ #include "V8Index.h" #include "V8IsolatedWorld.h" +#include <algorithm> +#include <utility> #include <v8.h> #include <v8-debug.h> #include <wtf/Assertions.h> @@ -66,6 +67,10 @@ #include "TimeCounter.h" #endif +#if PLATFORM(ANDROID) +#include "CString.h" +#endif + namespace WebCore { v8::Persistent<v8::Context> V8Proxy::m_utilityContext; diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp index 5ba9db0..efa2f7a 100644 --- a/WebCore/dom/Document.cpp +++ b/WebCore/dom/Document.cpp @@ -22,6 +22,7 @@ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ + #include "config.h" #include "Document.h" diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h index 82a5b98..fc2eea0 100644 --- a/WebCore/dom/Document.h +++ b/WebCore/dom/Document.h @@ -809,7 +809,7 @@ public: void updateFocusAppearanceSoon(); void cancelFocusAppearanceUpdate(); - + #ifdef ANDROID_MOBILE void setExtraLayoutDelay(int delay) { mExtraLayoutDelay = delay; } int extraLayoutDelay() { return mExtraLayoutDelay; } diff --git a/WebCore/dom/Element.h b/WebCore/dom/Element.h index 8d12cc9..d27976a 100644 --- a/WebCore/dom/Element.h +++ b/WebCore/dom/Element.h @@ -196,6 +196,7 @@ public: KURL getURLAttribute(const QualifiedName&) const; virtual const QualifiedName& imageSourceAttributeName() const; virtual String target() const { return String(); } + virtual void focus(bool restorePreviousSelection = true); virtual void updateFocusAppearance(bool restorePreviousSelection); void blur(); diff --git a/WebCore/html/HTMLCollection.cpp b/WebCore/html/HTMLCollection.cpp index 76de60a..2b29589 100644 --- a/WebCore/html/HTMLCollection.cpp +++ b/WebCore/html/HTMLCollection.cpp @@ -251,15 +251,15 @@ Node* HTMLCollection::firstItem() const Node* HTMLCollection::nextItem() const { resetCollectionInfo(); - + #ifdef ANDROID_FIX - // resetCollectionInfo() can set info->current to be 0. If this is the - // case, we need to go back to the firstItem. Otherwise traverseNextItem + // resetCollectionInfo() can set info->current to be 0. If this is the + // case, we need to go back to the firstItem. Otherwise traverseNextItem // will crash. if (!m_info->current) return firstItem(); #endif - + // Look for the 'second' item. The first one is currentItem, already given back. Element* retval = itemAfter(m_info->current); m_info->current = retval; diff --git a/WebCore/html/HTMLSelectElement.h b/WebCore/html/HTMLSelectElement.h index d28f116..8f575d2 100644 --- a/WebCore/html/HTMLSelectElement.h +++ b/WebCore/html/HTMLSelectElement.h @@ -106,8 +106,8 @@ private: virtual RenderObject* createRenderer(RenderArena*, RenderStyle *); virtual bool appendFormData(FormDataList&, bool); - virtual int listToOptionIndex(int listIndex) const; virtual int optionToListIndex(int optionIndex) const; + virtual int listToOptionIndex(int listIndex) const; virtual void reset(); diff --git a/WebCore/html/HTMLTokenizer.cpp b/WebCore/html/HTMLTokenizer.cpp index 9215dc3..7c01f6a 100644 --- a/WebCore/html/HTMLTokenizer.cpp +++ b/WebCore/html/HTMLTokenizer.cpp @@ -24,6 +24,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + #include "config.h" #include "HTMLTokenizer.h" @@ -484,7 +485,7 @@ HTMLTokenizer::State HTMLTokenizer::scriptHandler(State state) #ifdef ANDROID_INSTRUMENT android::TimeCounter::recordNoCounter(android::TimeCounter::ParsingTimeCounter, __FUNCTION__); #endif - + if (!m_parser->skipMode() && !followingFrameset) { if (cs) { if (savedPrependingSrc) @@ -517,7 +518,7 @@ HTMLTokenizer::State HTMLTokenizer::scriptHandler(State state) #ifdef ANDROID_INSTRUMENT android::TimeCounter::start(android::TimeCounter::ParsingTimeCounter); #endif - + if (!m_executingScript && !state.loadingExtScript()) { m_src.append(m_pendingSrc); m_pendingSrc.clear(); @@ -541,7 +542,6 @@ HTMLTokenizer::State HTMLTokenizer::scriptHandler(State state) } } - #if PRELOAD_SCANNER_ENABLED if (!m_pendingScripts.isEmpty() && !m_executingScript) { if (!m_preloadScanner) @@ -1651,7 +1651,6 @@ void HTMLTokenizer::write(const SegmentedString& str, bool appendData) return; } - #if PRELOAD_SCANNER_ENABLED if (m_preloadScanner && m_preloadScanner->inProgress() && appendData) m_preloadScanner->end(); diff --git a/WebCore/inspector/InspectorController.h b/WebCore/inspector/InspectorController.h index dcbfe38..06fd250 100644 --- a/WebCore/inspector/InspectorController.h +++ b/WebCore/inspector/InspectorController.h @@ -62,6 +62,9 @@ class Document; class DocumentLoader; class GraphicsContext; class HitTestResult; +#if !PLATFORM(ANDROID) +class InspectorBackend; +#endif class InspectorClient; class InspectorDOMAgent; class InspectorFrontend; @@ -84,11 +87,6 @@ class InspectorDatabaseResource; class InspectorDOMStorageResource; class InspectorResource; -#if !PLATFORM(ANDROID) -class InspectorBackend; -class InspectorFrontend; -#endif - class InspectorController #if ENABLE(JAVASCRIPT_DEBUGGER) : JavaScriptDebugListener @@ -360,6 +358,7 @@ private: Page* m_inspectedPage; InspectorClient* m_client; + OwnPtr<InspectorFrontend> m_frontend; RefPtr<InspectorDOMAgent> m_domAgent; OwnPtr<InspectorTimelineAgent> m_timelineAgent; ScriptObject m_injectedScriptObj; @@ -389,7 +388,6 @@ private: bool m_resourceTrackingEnabled; bool m_resourceTrackingSettingsLoaded; #if !PLATFORM(ANDROID) - OwnPtr<InspectorFrontend> m_frontend; RefPtr<InspectorBackend> m_inspectorBackend; #endif HashMap<String, ScriptValue> m_idToWrappedObject; diff --git a/WebCore/loader/Cache.cpp b/WebCore/loader/Cache.cpp index 1f28709..391790f 100644 --- a/WebCore/loader/Cache.cpp +++ b/WebCore/loader/Cache.cpp @@ -38,7 +38,6 @@ #include <stdio.h> #include <wtf/CurrentTime.h> - using namespace std; namespace WebCore { diff --git a/WebCore/loader/DocLoader.cpp b/WebCore/loader/DocLoader.cpp index b2d9cc8..fff8e59 100644 --- a/WebCore/loader/DocLoader.cpp +++ b/WebCore/loader/DocLoader.cpp @@ -255,6 +255,7 @@ CachedResource* DocLoader::requestResource(CachedResource::Type type, const Stri } checkForReload(fullURL); + CachedResource* resource = cache()->requestResource(this, type, fullURL, charset, isPreload); if (resource) { // Check final URL of resource to catch redirects. diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp index fffd6ee..071c0a7 100644 --- a/WebCore/loader/FrameLoader.cpp +++ b/WebCore/loader/FrameLoader.cpp @@ -3091,7 +3091,7 @@ void FrameLoader::checkLoadCompleteForThisFrame() if (Page* page = m_frame->page()) page->progress()->progressCompleted(m_frame); - + #ifdef ANDROID_INSTRUMENT if (!m_frame->tree()->parent() && m_frame->document()->renderArena()) android::TimeCounter::report(m_URL, cache()->getLiveSize(), cache()->getDeadSize(), diff --git a/WebCore/loader/FrameLoader.h b/WebCore/loader/FrameLoader.h index 3a1d27f..9ea3775 100644 --- a/WebCore/loader/FrameLoader.h +++ b/WebCore/loader/FrameLoader.h @@ -100,7 +100,6 @@ namespace WebCore { void setupForReplace(); void setupForReplaceByMIMEType(const String& newMIMEType); - void loadURLIntoChildFrame(const KURL&, const String& referer, Frame*); void loadFrameRequest(const FrameLoadRequest&, bool lockHistory, bool lockBackForwardList, // Called by submitForm, calls loadPostRequest and loadURL. diff --git a/WebCore/loader/appcache/ApplicationCacheGroup.cpp b/WebCore/loader/appcache/ApplicationCacheGroup.cpp index a3d551b..1a223ce 100644 --- a/WebCore/loader/appcache/ApplicationCacheGroup.cpp +++ b/WebCore/loader/appcache/ApplicationCacheGroup.cpp @@ -777,7 +777,6 @@ void ApplicationCacheGroup::checkIfLoadIsComplete() RefPtr<ApplicationCache> oldNewestCache = (m_newestCache == m_cacheBeingUpdated) ? 0 : m_newestCache; setNewestCache(m_cacheBeingUpdated.release()); - if (cacheStorage().storeNewestCache(this)) { // New cache stored, now remove the old cache. if (oldNewestCache) diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp index c03efb0..da3c92b 100644 --- a/WebCore/page/Frame.cpp +++ b/WebCore/page/Frame.cpp @@ -25,6 +25,7 @@ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ + #include "config.h" #include "Frame.h" @@ -1630,7 +1631,6 @@ void Frame::pageDestroyed() page()->focusController()->setFocusedFrame(0); script()->clearWindowShell(); - script()->clearScriptObjects(); script()->updatePlatformScriptObjects(); @@ -1705,7 +1705,6 @@ bool Frame::shouldClose() return chrome->runBeforeUnloadConfirmPanel(text, this); } - void Frame::scheduleClose() { if (!shouldClose()) diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp index e7006ed..888e975 100644 --- a/WebCore/page/FrameView.cpp +++ b/WebCore/page/FrameView.cpp @@ -23,6 +23,7 @@ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ + #include "config.h" #include "FrameView.h" diff --git a/WebCore/page/Geolocation.cpp b/WebCore/page/Geolocation.cpp index fd38614..ba3516d 100644 --- a/WebCore/page/Geolocation.cpp +++ b/WebCore/page/Geolocation.cpp @@ -574,7 +574,7 @@ bool Geolocation::operator==(const EventListener& listener) void Geolocation::handleEvent(ScriptExecutionContext*, Event* event) { - ASSERT_UNUSED(event, event->type() == eventTypes().unloadEvent); + ASSERT_UNUSED(event, event->type() == eventNames().unloadEvent); // Cancel any ongoing requests on page unload. This is required to release // references to JS callbacks in the page, to allow the frame to be cleaned up // by WebKit. diff --git a/WebCore/page/Geolocation.idl b/WebCore/page/Geolocation.idl index e9770ad..e125118 100644 --- a/WebCore/page/Geolocation.idl +++ b/WebCore/page/Geolocation.idl @@ -31,6 +31,7 @@ module core { [Custom] void getCurrentPosition(in PositionCallback successCallback, in PositionErrorCallback errorCallback, in PositionOptions options); [Custom] long watchPosition(in PositionCallback successCallback, in PositionErrorCallback errorCallback, in PositionOptions options); + void clearWatch(in long watchId); }; diff --git a/WebCore/page/Settings.cpp b/WebCore/page/Settings.cpp index 98d08d2..df42718 100644 --- a/WebCore/page/Settings.cpp +++ b/WebCore/page/Settings.cpp @@ -138,7 +138,7 @@ Settings::Settings(Page* page) // A Frame may not have been created yet, so we initialize the AtomicString // hash before trying to use it. AtomicString::init(); -#ifdef ANDROID_META_SUPPORT +#ifdef ANDROID_META_SUPPORT resetMetadataSettings(); #endif } @@ -444,9 +444,9 @@ void Settings::setMetadataSettings(const String& key, const String& value) int width = value.toInt(); if (width <= 10000) { if (width <= 320) { - // This is a hack to accommodate the pages designed for the - // original iPhone. The new version, since 10/2007, is to - // use device-width which works for both portrait and + // This is a hack to accommodate the pages designed for the + // original iPhone. The new version, since 10/2007, is to + // use device-width which works for both portrait and // landscape modes. m_viewport_width = 0; } else { @@ -502,25 +502,25 @@ void Settings::setMetadataSettings(const String& key, const String& value) } else if (key == "telephone") { if (value == "no") { m_format_detection_telephone = false; - } + } } else if (key == "address") { if (value == "no") { m_format_detection_address = false; - } + } } else if (key == "email") { if (value == "no") { m_format_detection_email = false; - } + } } else if (key == "format-detection") { - // even Apple doc says "format-detection" should be the name of the - // <meta> tag. In the real world, e.g. amazon.com, use + // even Apple doc says "format-detection" should be the name of the + // <meta> tag. In the real world, e.g. amazon.com, use // "format-detection=no" in the "viewport" <meta> tag to disable all // format detection. if (value == "no") { m_format_detection_telephone = false; m_format_detection_address = false; m_format_detection_email = false; - } + } } } #endif diff --git a/WebCore/page/Settings.h b/WebCore/page/Settings.h index 344746f..f03e792 100644 --- a/WebCore/page/Settings.h +++ b/WebCore/page/Settings.h @@ -92,7 +92,7 @@ namespace WebCore { bool useWideViewport() const { return m_useWideViewport; } void setUseWideViewport(bool use) { m_useWideViewport = use; } #endif - + void setSerifFontFamily(const AtomicString&); const AtomicString& serifFontFamily() const { return m_serifFontFamily; } diff --git a/WebCore/platform/android/GeolocationServiceAndroid.cpp b/WebCore/platform/android/GeolocationServiceAndroid.cpp index 9e1c919..c4e9f0e 100644 --- a/WebCore/platform/android/GeolocationServiceAndroid.cpp +++ b/WebCore/platform/android/GeolocationServiceAndroid.cpp @@ -220,7 +220,7 @@ void GeolocationServiceBridge::startJavaImplementation() kJavaGeolocationServiceClass, kJavaGeolocationServiceClassNativeMethods, NELEM(kJavaGeolocationServiceClassNativeMethods)); - ASSERT(registered == NELEM(kJavaGeolocationServiceClassNativeMethods)); + ASSERT(registered == JNI_OK); // Set up the methods we wish to call on the Java Location class. jclass javaLocationClass = env->FindClass(kJavaLocationClass); diff --git a/WebCore/platform/wx/TemporaryLinkStubs.cpp b/WebCore/platform/wx/TemporaryLinkStubs.cpp index 8b13789..e69de29 100644 --- a/WebCore/platform/wx/TemporaryLinkStubs.cpp +++ b/WebCore/platform/wx/TemporaryLinkStubs.cpp @@ -1 +0,0 @@ - diff --git a/WebCore/plugins/PluginView.cpp b/WebCore/plugins/PluginView.cpp index c066e25..811f6be 100644 --- a/WebCore/plugins/PluginView.cpp +++ b/WebCore/plugins/PluginView.cpp @@ -60,6 +60,8 @@ #include "RenderObject.h" #include "npruntime_impl.h" #include "Settings.h" +#include <wtf/ASCIICType.h> + #if defined(ANDROID_PLUGINS) #include "TouchEvent.h" #endif @@ -72,11 +74,7 @@ #include "runtime.h" #include <runtime/JSLock.h> #include <runtime/JSValue.h> -#endif - -#include <wtf/ASCIICType.h> -#if USE(JSC) using JSC::ExecState; using JSC::JSLock; using JSC::JSObject; @@ -1269,9 +1267,8 @@ void PluginView::invalidateWindowlessPluginRect(const IntRect& rect) void PluginView::paintMissingPluginIcon(GraphicsContext* context, const IntRect& rect) { static RefPtr<Image> nullPluginImage; - if (!nullPluginImage) { + if (!nullPluginImage) nullPluginImage = Image::loadPlatformResource("nullPlugin"); - } IntRect imageRect(frameRect().x(), frameRect().y(), nullPluginImage->width(), nullPluginImage->height()); @@ -1280,9 +1277,8 @@ void PluginView::paintMissingPluginIcon(GraphicsContext* context, const IntRect& imageRect.move(xOffset, yOffset); - if (!rect.intersects(imageRect)) { + if (!rect.intersects(imageRect)) return; - } context->save(); context->clip(windowClipRect()); @@ -1311,8 +1307,10 @@ const char* PluginView::userAgent() if (m_plugin->quirks().contains(PluginQuirkWantsMozillaUserAgent)) return MozillaUserAgent; #endif + if (m_userAgent.isNull()) m_userAgent = m_parentFrame->loader()->userAgent(m_url).utf8(); + return m_userAgent.data(); } diff --git a/WebCore/rendering/AutoTableLayout.cpp b/WebCore/rendering/AutoTableLayout.cpp index c37fba4..0e001c7 100644 --- a/WebCore/rendering/AutoTableLayout.cpp +++ b/WebCore/rendering/AutoTableLayout.cpp @@ -495,10 +495,10 @@ void AutoTableLayout::insertSpanCell(RenderTableCell *cell) void AutoTableLayout::layout() { -#ifdef ANDROID_LAYOUT +#ifdef ANDROID_LAYOUT if (m_table->isSingleColumn()) return; -#endif +#endif // table layout based on the values collected in the layout structure. int tableWidth = m_table->width() - m_table->bordersPaddingAndSpacing(); int available = tableWidth; diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp index c6d18d2..902a5b3 100644 --- a/WebCore/rendering/RenderBlock.cpp +++ b/WebCore/rendering/RenderBlock.cpp @@ -1428,7 +1428,7 @@ bool RenderBlock::layoutOnlyPositionedObjects() updateScrollInfoAfterLayout(); #ifdef ANDROID_FIX - // iframe flatten will call FrameView::layout() which calls performPostLayoutTasks, + // iframe flatten will call FrameView::layout() which calls performPostLayoutTasks, // which may make us need to layout again if (!posChildNeedsLayout() || normalChildNeedsLayout() || selfNeedsLayout()) return false; diff --git a/WebCore/rendering/RenderBlock.h b/WebCore/rendering/RenderBlock.h index e23ebda..09e76ee 100644 --- a/WebCore/rendering/RenderBlock.h +++ b/WebCore/rendering/RenderBlock.h @@ -139,9 +139,6 @@ public: // style from this RenderBlock. RenderBlock* createAnonymousBlock(bool isFlexibleBox = false) const; - Vector<IntRect>* columnRects() const; - int columnGap() const; - protected: int maxTopPosMargin() const { return m_maxMargin ? m_maxMargin->m_topPos : MaxMargin::topPosDefault(this); } int maxTopNegMargin() const { return m_maxMargin ? m_maxMargin->m_topNeg : MaxMargin::topNegDefault(this); } @@ -343,7 +340,17 @@ private: int desiredColumnWidth() const; unsigned desiredColumnCount() const; +#if PLATFORM(ANDROID) +public: + Vector<IntRect>* columnRects() const; +private: +#endif void setDesiredColumnCountAndWidth(int count, int width); +#if PLATFORM(ANDROID) +public: + int columnGap() const; +private: +#endif void paintContinuationOutlines(PaintInfo&, int tx, int ty); diff --git a/WebCore/rendering/RenderBlockLineLayout.cpp b/WebCore/rendering/RenderBlockLineLayout.cpp index b2b14cd..9142953 100644 --- a/WebCore/rendering/RenderBlockLineLayout.cpp +++ b/WebCore/rendering/RenderBlockLineLayout.cpp @@ -865,7 +865,7 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i EFloat cssfloat = style()->floating(); doTextWrap = autowrap && !positioned && (((dir == LTR && cssfloat != FRIGHT) || - (dir == RTL && cssfloat != FLEFT)) && + (dir == RTL && cssfloat != FLEFT)) && ((ta == TAAUTO) || (ta == JUSTIFY) || ((ta == LEFT || ta == WEBKIT_LEFT) && (dir == LTR)) || ((ta == RIGHT || ta == WEBKIT_RIGHT) && (dir == RTL)))); @@ -948,7 +948,7 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i break; } if (obj->isFloating() || obj->isPositioned()) { - // floating and absolute or fixed positioning are done out + // floating and absolute or fixed positioning are done out // of normal flow. Don't need to worry about height any more. break; } diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp index efd88a7..83f9624 100644 --- a/WebCore/rendering/RenderBox.cpp +++ b/WebCore/rendering/RenderBox.cpp @@ -1244,7 +1244,7 @@ void RenderBox::calcWidth() } } #endif - + if (isPositioned()) { calcAbsoluteHorizontal(); return; @@ -1284,10 +1284,11 @@ void RenderBox::calcWidth() if (treatAsReplaced) #endif setWidth(max(w.value() + borderLeft() + borderRight() + paddingLeft() + paddingRight(), minPrefWidth())); + #ifdef ANDROID_LAYOUT // in SSR mode with replaced box, if the box width is wider than the container width, // it will be shrinked to fit to the container. - if (containerWidth && (width() + m_marginLeft + m_marginRight) > containerWidth && + if (containerWidth && (width() + m_marginLeft + m_marginRight) > containerWidth && document()->frame()->settings()->layoutAlgorithm() == Settings::kLayoutSSR) { m_marginLeft = m_marginRight = 0; setWidth(containerWidth); @@ -1338,8 +1339,8 @@ void RenderBox::calcWidth() } #ifdef ANDROID_LAYOUT // in SSR mode with non-replaced box, we use ANDROID_SSR_MARGIN_PADDING for left/right margin. - // If the box width is wider than the container width, it will be shrinked to fit to the container. - if (containerWidth && !treatAsReplaced && + // If the box width is wider than the container width, it will be shrinked to fit to the container. + if (containerWidth && !treatAsReplaced && document()->settings()->layoutAlgorithm() == Settings::kLayoutSSR) { setWidth(width() + m_marginLeft + m_marginRight); m_marginLeft = m_marginLeft > ANDROID_SSR_MARGIN_PADDING ? ANDROID_SSR_MARGIN_PADDING : m_marginLeft; diff --git a/WebCore/rendering/RenderFrame.cpp b/WebCore/rendering/RenderFrame.cpp index 54a73c7..482d10d 100644 --- a/WebCore/rendering/RenderFrame.cpp +++ b/WebCore/rendering/RenderFrame.cpp @@ -70,7 +70,7 @@ void RenderFrame::layout() if (widget() && widget()->isFrameView()) { FrameView* view = static_cast<FrameView*>(widget()); RenderView* root = NULL; - if (view->frame() && view->frame()->document() && + if (view->frame() && view->frame()->document() && view->frame()->document()->renderer() && view->frame()->document()->renderer()->isRenderView()) root = static_cast<RenderView*>(view->frame()->document()->renderer()); diff --git a/WebCore/rendering/RenderFrameSet.cpp b/WebCore/rendering/RenderFrameSet.cpp index 041a025..a855a08 100644 --- a/WebCore/rendering/RenderFrameSet.cpp +++ b/WebCore/rendering/RenderFrameSet.cpp @@ -602,7 +602,7 @@ void RenderFrameSet::positionFrames() child = (RenderBox*)firstChild(); yPos = 0; #endif // FLATTEN_FRAMESET - + for (int r = 0; r < rows; r++) { int xPos = 0; int height = m_rows.m_sizes[r]; diff --git a/WebCore/rendering/RenderFrameSet.h b/WebCore/rendering/RenderFrameSet.h index aa3ac64..ef92c39 100644 --- a/WebCore/rendering/RenderFrameSet.h +++ b/WebCore/rendering/RenderFrameSet.h @@ -73,7 +73,7 @@ public: #ifdef FLATTEN_FRAMESET void setGridNeedsLayout() { m_gridCalculated = false; } #endif - + private: static const int noSplit = -1; diff --git a/WebCore/rendering/RenderImage.cpp b/WebCore/rendering/RenderImage.cpp index ec2a4d3..1f79e50 100644 --- a/WebCore/rendering/RenderImage.cpp +++ b/WebCore/rendering/RenderImage.cpp @@ -550,7 +550,7 @@ int RenderImage::calcReplacedWidth(bool includeMaxWidth) const } return width; #else - return max(minW, min(width, maxW)); + return max(minW, min(width, maxW)); #endif } @@ -572,19 +572,19 @@ int RenderImage::calcReplacedHeight() const #ifdef ANDROID_LAYOUT height = max(minH, min(height, maxH)); // in SSR mode, we will fit the image to its container width - if (height && document()->settings()->layoutAlgorithm() == Settings::kLayoutSSR) { + if (height && document()->settings()->layoutAlgorithm() == Settings::kLayoutSSR) { int width; if (isWidthSpecified()) width = calcReplacedWidthUsing(style()->width()); else width = calcAspectRatioWidth(); int minW = calcReplacedWidthUsing(style()->minWidth()); - int maxW = style()->maxWidth().value() == undefinedLength ? width : - calcReplacedWidthUsing(style()->maxWidth()); + int maxW = style()->maxWidth().value() == undefinedLength ? width : + calcReplacedWidthUsing(style()->maxWidth()); width = max(minW, min(width, maxW)); int cw = containingBlockWidthForContent(); - if (cw && width && width>cw) + if (cw && width && width > cw) height = cw * height / width; // preserve aspect ratio } return height; diff --git a/WebCore/rendering/RenderTable.cpp b/WebCore/rendering/RenderTable.cpp index 0acaa43..677851e 100644 --- a/WebCore/rendering/RenderTable.cpp +++ b/WebCore/rendering/RenderTable.cpp @@ -62,8 +62,8 @@ RenderTable::RenderTable(Node* node) , m_borderRight(0) { #ifdef ANDROID_LAYOUT - m_singleColumn = false; -#endif + m_singleColumn = false; +#endif m_columnPos.fill(0, 2); m_columns.fill(ColumnStruct(), 1); } @@ -208,7 +208,7 @@ void RenderTable::calcWidth() } } #endif - + if (isPositioned()) calcAbsoluteHorizontal(); @@ -248,7 +248,7 @@ void RenderTable::calcWidth() // in SSR mode, we ignore left/right margin for table if (document()->settings()->layoutAlgorithm() == Settings::kLayoutSSR) return; -#endif +#endif calcHorizontalMargins(style()->marginLeft(), style()->marginRight(), availableWidth); } @@ -273,13 +273,13 @@ void RenderTable::layout() bool relayoutChildren = false; int oldVisibleWidth = m_visibleWidth; #endif - + int oldWidth = width(); calcWidth(); #ifdef ANDROID_LAYOUT if (oldVisibleWidth != m_visibleWidth - && document()->settings()->layoutAlgorithm() == Settings::kLayoutFitColumnToScreen) + && document()->settings()->layoutAlgorithm() == Settings::kLayoutFitColumnToScreen) relayoutChildren = true; else if (document()->settings()->layoutAlgorithm() == Settings::kLayoutSSR) { // if the width of a table is wider than its container width, or it has a nested table, @@ -298,7 +298,7 @@ void RenderTable::layout() } if (shouldRenderAsSingleColumn) { - m_singleColumn = true; + m_singleColumn = true; if (width() > cw) setWidth(cw); if (m_minPrefWidth > cw) diff --git a/WebCore/rendering/RenderTableSection.cpp b/WebCore/rendering/RenderTableSection.cpp index 1e087f6..9339f9e 100644 --- a/WebCore/rendering/RenderTableSection.cpp +++ b/WebCore/rendering/RenderTableSection.cpp @@ -262,12 +262,11 @@ void RenderTableSection::setCellWidths() if (view()->frameView()) { const Settings* settings = document()->settings(); ASSERT(settings); - if (settings->layoutAlgorithm() == Settings::kLayoutFitColumnToScreen) { + if (settings->layoutAlgorithm() == Settings::kLayoutFitColumnToScreen) visibleWidth = view()->frameView()->screenWidth(); - } } #endif - + for (int i = 0; i < m_gridRows; i++) { Row& row = *m_grid[i].row; int cols = row.size(); @@ -284,12 +283,13 @@ void RenderTableSection::setCellWidths() endCol++; } int w = columnPos[endCol] - columnPos[j] - table()->hBorderSpacing(); -#ifdef ANDROID_LAYOUT - if (table()->isSingleColumn()) - w = table()->width()-(table()->borderLeft()+table()->borderRight()+ - (table()->collapseBorders()?0:(table()->paddingLeft()+table()->paddingRight()+ - 2*table()->hBorderSpacing()))); -#endif +#ifdef ANDROID_LAYOUT + if (table()->isSingleColumn()) { + int b = table()->collapseBorders() ? + 0 : table()->paddingLeft() + table()->paddingRight() + 2 * table()->hBorderSpacing(); + w = table()->width() - (table()->borderLeft() + table()->borderRight() + b); + } +#endif int oldWidth = cell->width(); #ifdef ANDROID_LAYOUT if (w != oldWidth || (visibleWidth > 0 && visibleWidth != cell->getVisibleWidth())) { @@ -326,7 +326,7 @@ int RenderTableSection::calcRowHeight() #ifdef ANDROID_LAYOUT if (table()->isSingleColumn()) return m_rowPos[m_gridRows]; -#endif +#endif RenderTableCell* cell; @@ -446,26 +446,26 @@ int RenderTableSection::layoutRows(int toAdd) int hspacing = table()->hBorderSpacing(); int vspacing = table()->vBorderSpacing(); int rHeight = vspacing; - + int leftOffset = hspacing; - + int nEffCols = table()->numEffCols(); for (int r = 0; r < totalRows; r++) { for (int c = 0; c < nEffCols; c++) { CellStruct current = cellAt(r, c); RenderTableCell* cell = current.cell; - + if (!cell || current.inColSpan) continue; if (r > 0 && (cellAt(r-1, c).cell == cell)) continue; - + // cell->setCellTopExtra(0); // cell->setCellBottomExtra(0); - + int oldCellX = cell->x(); int oldCellY = cell->y(); - + if (style()->direction() == RTL) { cell->setX(table()->width()); cell->setY(rHeight); @@ -485,7 +485,7 @@ int RenderTableSection::layoutRows(int toAdd) rHeight += cell->height() + vspacing; } } - + setHeight(rHeight); return height(); } @@ -1058,7 +1058,7 @@ void RenderTableSection::paintObject(PaintInfo& paintInfo, int tx, int ty) unsigned int startcol = 0; unsigned int endcol = totalCols; if (table()->isSingleColumn()) { - // FIXME: should we be smarter too? + // FIXME: should we be smarter too? } else { // FIXME: possible to rollback to the common tree. // rowPos size is set in calcRowHeight(), which is called from table layout(). @@ -1155,6 +1155,7 @@ void RenderTableSection::paintObject(PaintInfo& paintInfo, int tx, int ty) if (!row->hasSelfPaintingLayer()) cell->paintBackgroundsBehindCell(paintInfo, tx, ty, row); } + if ((!cell->hasSelfPaintingLayer() && !row->hasSelfPaintingLayer()) || paintInfo.phase == PaintPhaseCollapsedTableBorders) cell->paint(paintInfo, tx, ty); } diff --git a/WebCore/rendering/RenderTextControl.cpp b/WebCore/rendering/RenderTextControl.cpp index bcb2455..c8b4e0f 100644 --- a/WebCore/rendering/RenderTextControl.cpp +++ b/WebCore/rendering/RenderTextControl.cpp @@ -318,9 +318,6 @@ void RenderTextControl::subtreeHasChanged() String RenderTextControl::finishText(Vector<UChar>& result) const { - // ANDROID: This method was modified with a fix from WebKit r31081. This - // comment can be removed the next time we update. - // Remove one trailing newline; there's always one that's collapsed out by rendering. size_t size = result.size(); if (size && result[size - 1] == '\n') @@ -495,9 +492,8 @@ void RenderTextControl::calcPrefWidths() m_minPrefWidth += toAdd; m_maxPrefWidth += toAdd; +#if !PLATFORM(ANDROID) // FIXME: This causes cnn.com loading way slow. Comment it out for now -//#ifdef ANDROID_LAYOUT -#if 0 Frame* frame = document()->frame(); if (frame && frame->settings()->layoutAlgorithm() == Settings::kLayoutFitColumnToScreen) { int maxWidth = frame->view()->visibleWidth() - 2 * ANDROID_FCTS_MARGIN_PADDING; diff --git a/WebCore/rendering/break_lines.cpp b/WebCore/rendering/break_lines.cpp index 0e81caa..be460c8 100644 --- a/WebCore/rendering/break_lines.cpp +++ b/WebCore/rendering/break_lines.cpp @@ -52,7 +52,7 @@ static inline bool shouldBreakAfter(UChar ch) case '-': case '?': #ifdef ANDROID_LAYOUT - // as '/' is used in uri which is always long, we would like to break it + // as '/' is used in uri which is always long, we would like to break it case '/': #endif case softHyphen: 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/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 a89ec1d..0000000 --- a/WebCore/svg/graphics/cg/SVGResourceFilterCg.mm +++ /dev/null @@ -1,143 +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 "TransformationMatrix.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 = [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.get() 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.get() drawImage:outputImage atPoint:CGPoint(destOrigin) fromRect:filterRect]; - } - } - - CGLayerRelease(platform->m_filterCGLayer); - platform->m_filterCGLayer = 0; - - platform->m_filterCIContext = 0; - - delete context; - context = 0; -} - -} - -#endif // ENABLE(SVG) ENABLE(SVG_FILTERS) 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 399d4c1..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 = createCGColor(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 6582f9f..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 cce9e06..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 54f8237..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); - - RetainPtr<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 225c649..0000000 --- a/WebCore/svg/graphics/mac/SVGResourceFilterPlatformDataMac.mm +++ /dev/null @@ -1,128 +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_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/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/skia/SVGResourceFilterSkia.cpp b/WebCore/svg/graphics/skia/SVGResourceFilterSkia.cpp deleted file mode 100644 index b54eb4b..0000000 --- a/WebCore/svg/graphics/skia/SVGResourceFilterSkia.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2008, Google 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: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * 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. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "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 COPYRIGHT - * OWNER 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) |