summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/WebKit/Source/platform/graphics/filters/custom
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-08-08 14:30:41 +0200
committerJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-08-12 13:49:54 +0200
commitab0a50979b9eb4dfa3320eff7e187e41efedf7a9 (patch)
tree498dfb8a97ff3361a9f7486863a52bb4e26bb898 /chromium/third_party/WebKit/Source/platform/graphics/filters/custom
parent4ce69f7403811819800e7c5ae1318b2647e778d1 (diff)
Update Chromium to beta version 37.0.2062.68
Change-Id: I188e3b5aff1bec75566014291b654eb19f5bc8ca Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'chromium/third_party/WebKit/Source/platform/graphics/filters/custom')
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterArrayParameter.cpp54
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterArrayParameter.h74
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterCompiledProgram.cpp149
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterCompiledProgram.h95
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterConstants.h60
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterGlobalContext.cpp112
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterGlobalContext.h83
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterMesh.cpp68
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterMesh.h76
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterMeshGenerator.cpp171
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterMeshGenerator.h121
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterNumberParameter.cpp50
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterNumberParameter.h73
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterOperation.cpp74
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterOperation.h97
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterParameter.h78
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterParameterList.cpp116
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterParameterList.h63
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterProgram.cpp85
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterProgram.h92
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterProgramClient.cpp39
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterProgramClient.h49
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterProgramInfo.cpp106
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterProgramInfo.h110
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterRenderer.cpp292
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterRenderer.h98
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterTransformParameter.cpp70
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterTransformParameter.h72
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterValidatedProgram.cpp617
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterValidatedProgram.h123
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/FECustomFilter.cpp367
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/FECustomFilter.h101
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/ValidatedCustomFilterOperation.cpp60
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/filters/custom/ValidatedCustomFilterOperation.h93
34 files changed, 0 insertions, 3988 deletions
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterArrayParameter.cpp b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterArrayParameter.cpp
deleted file mode 100644
index 138fef6ef36..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterArrayParameter.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER “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 HOLDER 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"
-#include "platform/graphics/filters/custom/CustomFilterArrayParameter.h"
-
-#include "platform/animation/AnimationUtilities.h"
-
-namespace WebCore {
-
-PassRefPtr<CustomFilterParameter> CustomFilterArrayParameter::blend(const CustomFilterParameter* from, double progress)
-{
- if (!from || !isSameType(*from))
- return this;
-
- const CustomFilterArrayParameter* fromArray = static_cast<const CustomFilterArrayParameter*>(from);
-
- if (size() != fromArray->size())
- return this;
-
- RefPtr<CustomFilterArrayParameter> result = CustomFilterArrayParameter::create(name());
- for (size_t i = 0; i < size(); ++i)
- result->addValue(WebCore::blend(fromArray->valueAt(i), valueAt(i), progress));
-
- return result.release();
-}
-
-} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterArrayParameter.h b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterArrayParameter.h
deleted file mode 100644
index a58d1525c30..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterArrayParameter.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER “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 HOLDER 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 CustomFilterArrayParameter_h
-#define CustomFilterArrayParameter_h
-
-#include "platform/PlatformExport.h"
-#include "platform/graphics/filters/custom/CustomFilterParameter.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-class PLATFORM_EXPORT CustomFilterArrayParameter : public CustomFilterParameter {
-public:
- static PassRefPtr<CustomFilterArrayParameter> create(const String& name)
- {
- return adoptRef(new CustomFilterArrayParameter(name));
- }
-
- unsigned size() const { return m_data.size(); }
- double valueAt(unsigned index) const { return m_data.at(index); }
-
- void addValue(double value) { m_data.append(value); }
-
- virtual PassRefPtr<CustomFilterParameter> blend(const CustomFilterParameter* from, double progress);
-
- virtual bool operator==(const CustomFilterParameter& o) const
- {
- if (!isSameType(o))
- return false;
-
- const CustomFilterArrayParameter* other = static_cast<const CustomFilterArrayParameter*>(&o);
- return m_data == other->m_data;
- }
-
-private:
- CustomFilterArrayParameter(const String& name)
- : CustomFilterParameter(Array, name)
- {
- }
-
- Vector<double> m_data;
-};
-
-} // namespace WebCore
-
-
-#endif // CustomFilterArrayParameter_h
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterCompiledProgram.cpp b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterCompiledProgram.cpp
deleted file mode 100644
index 2e5d853dcc9..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterCompiledProgram.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER “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 HOLDER 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"
-#include "platform/graphics/filters/custom/CustomFilterCompiledProgram.h"
-
-namespace WebCore {
-
-CustomFilterCompiledProgram::CustomFilterCompiledProgram(PassRefPtr<GraphicsContext3D> context, const String& validatedVertexShader, const String& validatedFragmentShader, CustomFilterProgramType programType)
- : m_context(context)
- , m_program(0)
- , m_positionAttribLocation(-1)
- , m_texAttribLocation(-1)
- , m_meshAttribLocation(-1)
- , m_triangleAttribLocation(-1)
- , m_meshBoxLocation(-1)
- , m_projectionMatrixLocation(-1)
- , m_tileSizeLocation(-1)
- , m_meshSizeLocation(-1)
- , m_samplerLocation(-1)
- , m_samplerSizeLocation(-1)
- , m_contentSamplerLocation(-1)
- , m_isInitialized(false)
-{
- m_context->makeContextCurrent();
-
- Platform3DObject vertexShader = compileShader(GL_VERTEX_SHADER, validatedVertexShader);
- if (!vertexShader)
- return;
-
- Platform3DObject fragmentShader = compileShader(GL_FRAGMENT_SHADER, validatedFragmentShader);
- if (!fragmentShader) {
- m_context->deleteShader(vertexShader);
- return;
- }
-
- m_program = linkProgram(vertexShader, fragmentShader);
-
- m_context->deleteShader(vertexShader);
- m_context->deleteShader(fragmentShader);
-
- if (!m_program)
- return;
-
- initializeParameterLocations(programType);
-
- m_isInitialized = true;
-}
-
-Platform3DObject CustomFilterCompiledProgram::compileShader(GC3Denum shaderType, const String& shaderString)
-{
- ASSERT(!shaderString.isNull());
-
- Platform3DObject shader = m_context->createShader(shaderType);
- m_context->shaderSource(shader, shaderString);
- m_context->compileShader(shader);
-
- int compiled = 0;
- m_context->getShaderiv(shader, GL_COMPILE_STATUS, &compiled);
- if (!compiled) {
- // FIXME: This is an invalid shader. Throw some errors.
- // https://bugs.webkit.org/show_bug.cgi?id=74416
- m_context->deleteShader(shader);
- return 0;
- }
-
- return shader;
-}
-
-Platform3DObject CustomFilterCompiledProgram::linkProgram(Platform3DObject vertexShader, Platform3DObject fragmentShader)
-{
- Platform3DObject program = m_context->createProgram();
- m_context->attachShader(program, vertexShader);
- m_context->attachShader(program, fragmentShader);
- m_context->linkProgram(program);
-
- int linked = 0;
- m_context->getProgramiv(program, GL_LINK_STATUS, &linked);
- if (!linked) {
- // FIXME: Invalid vertex/fragment shader combination. Throw some errors here.
- // https://bugs.webkit.org/show_bug.cgi?id=74416
- m_context->deleteProgram(program);
- return 0;
- }
-
- return program;
-}
-
-void CustomFilterCompiledProgram::initializeParameterLocations(CustomFilterProgramType programType)
-{
- m_positionAttribLocation = m_context->getAttribLocation(m_program, "a_position");
- m_texAttribLocation = m_context->getAttribLocation(m_program, "a_texCoord");
- m_meshAttribLocation = m_context->getAttribLocation(m_program, "a_meshCoord");
- m_triangleAttribLocation = m_context->getAttribLocation(m_program, "a_triangleCoord");
- m_meshBoxLocation = m_context->getUniformLocation(m_program, "u_meshBox");
- m_tileSizeLocation = m_context->getUniformLocation(m_program, "u_tileSize");
- m_meshSizeLocation = m_context->getUniformLocation(m_program, "u_meshSize");
- m_projectionMatrixLocation = m_context->getUniformLocation(m_program, "u_projectionMatrix");
- m_samplerSizeLocation = m_context->getUniformLocation(m_program, "u_textureSize");
- m_contentSamplerLocation = m_context->getUniformLocation(m_program, "u_contentTexture");
- if (programType == ProgramTypeBlendsElementTexture) {
- // When the author uses the CSS mix function in a custom filter, WebKit adds the internal
- // symbol css_u_texture to the shader code, which references the texture of the element.
- m_samplerLocation = m_context->getUniformLocation(m_program, "css_u_texture");
- }
-}
-
-int CustomFilterCompiledProgram::uniformLocationByName(const String& name)
-{
- ASSERT(m_isInitialized);
- // FIXME: Improve this by caching the uniform locations.
- return m_context->getUniformLocation(m_program, name);
-}
-
-CustomFilterCompiledProgram::~CustomFilterCompiledProgram()
-{
- if (m_program) {
- m_context->makeContextCurrent();
- m_context->deleteProgram(m_program);
- }
-}
-
-} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterCompiledProgram.h b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterCompiledProgram.h
deleted file mode 100644
index 54b6a0a7f6c..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterCompiledProgram.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER “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 HOLDER 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 CustomFilterCompiledProgram_h
-#define CustomFilterCompiledProgram_h
-
-#include "platform/graphics/GraphicsContext3D.h"
-#include "platform/graphics/filters/custom/CustomFilterProgramInfo.h"
-#include "wtf/RefCounted.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class CustomFilterGlobalContext;
-
-class CustomFilterCompiledProgram: public RefCounted<CustomFilterCompiledProgram> {
-public:
- static PassRefPtr<CustomFilterCompiledProgram> create(PassRefPtr<GraphicsContext3D> context, const String& validatedVertexShader, const String& validatedFragmentShader, CustomFilterProgramType programType)
- {
- return adoptRef(new CustomFilterCompiledProgram(context, validatedVertexShader, validatedFragmentShader, programType));
- }
-
- ~CustomFilterCompiledProgram();
-
- int positionAttribLocation() const { return m_positionAttribLocation; }
- int texAttribLocation() const { return m_texAttribLocation; }
- int meshAttribLocation() const { return m_meshAttribLocation; }
- int triangleAttribLocation() const { return m_triangleAttribLocation; }
- int meshBoxLocation() const { return m_meshBoxLocation; }
- int projectionMatrixLocation() const { return m_projectionMatrixLocation; }
- int tileSizeLocation() const { return m_tileSizeLocation; }
- int meshSizeLocation() const { return m_meshSizeLocation; }
- int samplerLocation() const { return m_samplerLocation; }
- int contentSamplerLocation() const { return m_contentSamplerLocation; }
- int samplerSizeLocation() const { return m_samplerSizeLocation; }
-
- int uniformLocationByName(const String&);
-
- bool isInitialized() const { return m_isInitialized; }
-
- Platform3DObject program() const { return m_program; }
-private:
- CustomFilterCompiledProgram(PassRefPtr<GraphicsContext3D>, const String& validatedVertexShader, const String& validatedFragmentShader, CustomFilterProgramType);
-
- Platform3DObject compileShader(GC3Denum shaderType, const String& shaderString);
- Platform3DObject linkProgram(Platform3DObject vertexShader, Platform3DObject fragmentShader);
- void initializeParameterLocations(CustomFilterProgramType);
-
- RefPtr<GraphicsContext3D> m_context;
- Platform3DObject m_program;
-
- int m_positionAttribLocation;
- int m_texAttribLocation;
- int m_meshAttribLocation;
- int m_triangleAttribLocation;
- int m_meshBoxLocation;
- int m_projectionMatrixLocation;
- int m_tileSizeLocation;
- int m_meshSizeLocation;
- int m_samplerLocation;
- int m_samplerSizeLocation;
- int m_contentSamplerLocation;
-
- bool m_isInitialized;
-};
-
-}
-
-#endif
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterConstants.h b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterConstants.h
deleted file mode 100644
index 5c3b2143e2a..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterConstants.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER “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 HOLDER 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 CustomFilterConstants_h
-#define CustomFilterConstants_h
-
-namespace WebCore {
-
-enum CustomFilterMeshConstants {
- // Vertex attribute sizes
- PositionAttribSize = 4,
- TexAttribSize = 2,
- MeshAttribSize = 2,
- TriangleAttribSize = 3,
- // Vertex attribute offsets
- PositionAttribOffset = 0,
- TexAttribOffset = PositionAttribOffset + PositionAttribSize * sizeof(float),
- MeshAttribOffset = TexAttribOffset + TexAttribSize * sizeof(float),
- TriangleAttribOffset = MeshAttribOffset + MeshAttribSize * sizeof(float)
-};
-
-enum CustomFilterMeshType {
- MeshTypeAttached,
- MeshTypeDetached
-};
-
-enum CustomFilterProgramType {
- ProgramTypeNoElementTexture,
- ProgramTypeBlendsElementTexture
-};
-
-} // namespace WebCore
-
-#endif // CustomFilterConstants_h
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterGlobalContext.cpp b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterGlobalContext.cpp
deleted file mode 100644
index a3727ae3446..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterGlobalContext.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER “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 HOLDER 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"
-#include "platform/graphics/filters/custom/CustomFilterGlobalContext.h"
-
-#include "platform/graphics/GraphicsContext3D.h"
-#include "platform/graphics/filters/custom/CustomFilterValidatedProgram.h"
-
-namespace WebCore {
-
-CustomFilterGlobalContext::CustomFilterGlobalContext()
-{
-}
-
-CustomFilterGlobalContext::~CustomFilterGlobalContext()
-{
- for (CustomFilterValidatedProgramsMap::iterator iter = m_programs.begin(); iter != m_programs.end(); ++iter)
- iter->value->detachFromGlobalContext();
-}
-
-ANGLEPlatformBridge* CustomFilterGlobalContext::webglShaderValidator()
-{
- if (!m_webglShaderValidator)
- m_webglShaderValidator = createShaderValidator(SH_WEBGL_SPEC);
- return m_webglShaderValidator.get();
-}
-
-ANGLEPlatformBridge* CustomFilterGlobalContext::mixShaderValidator()
-{
- if (!m_mixShaderValidator)
- m_mixShaderValidator = createShaderValidator(SH_CSS_SHADERS_SPEC);
- return m_mixShaderValidator.get();
-}
-
-PassOwnPtr<ANGLEPlatformBridge> CustomFilterGlobalContext::createShaderValidator(ShShaderSpec shaderSpec)
-{
- OwnPtr<ANGLEPlatformBridge> validator = adoptPtr(new ANGLEPlatformBridge(SH_ESSL_OUTPUT, shaderSpec));
- ShBuiltInResources resources;
- ShInitBuiltInResources(&resources);
- validator->setResources(resources);
- return validator.release();
-}
-
-void CustomFilterGlobalContext::prepareContextIfNeeded()
-{
- if (m_context.get())
- return;
-
- GraphicsContext3D::Attributes attributes;
- attributes.preserveDrawingBuffer = true;
- attributes.premultipliedAlpha = false;
- attributes.shareResources = true;
- attributes.preferDiscreteGPU = true;
- m_context = GraphicsContext3D::create(attributes);
- if (!m_context)
- return;
- m_context->makeContextCurrent();
- m_context->enable(GL_DEPTH_TEST);
-}
-
-PassRefPtr<CustomFilterValidatedProgram> CustomFilterGlobalContext::getValidatedProgram(const CustomFilterProgramInfo& programInfo)
-{
- CustomFilterValidatedProgramsMap::iterator iter = m_programs.find(programInfo);
- if (iter != m_programs.end())
- return iter->value;
-
- RefPtr<CustomFilterValidatedProgram> validatedProgram = CustomFilterValidatedProgram::create(this, programInfo);
- m_programs.set(programInfo, validatedProgram.get());
- return validatedProgram.release();
-}
-
-void CustomFilterGlobalContext::removeValidatedProgram(const CustomFilterValidatedProgram* program)
-{
- CustomFilterValidatedProgramsMap::iterator iter = m_programs.find(program->programInfo());
- ASSERT_WITH_SECURITY_IMPLICATION(iter != m_programs.end());
- m_programs.remove(iter);
-
-#ifndef NDEBUG
- // Check that there's no way we could have the same program under a different key.
- for (iter = m_programs.begin(); iter != m_programs.end(); ++iter)
- ASSERT(iter->value != program);
-#endif
-}
-
-} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterGlobalContext.h b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterGlobalContext.h
deleted file mode 100644
index 01f54d5fa92..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterGlobalContext.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER “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 HOLDER 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 CustomFilterGlobalContext_h
-#define CustomFilterGlobalContext_h
-
-#include "platform/graphics/angle/ANGLEPlatformBridge.h"
-#include "platform/graphics/filters/custom/CustomFilterProgramInfo.h"
-#include "wtf/HashMap.h"
-#include "wtf/Noncopyable.h"
-#include "wtf/RefPtr.h"
-
-namespace WebCore {
-
-class CustomFilterValidatedProgram;
-class GraphicsContext3D;
-
-typedef HashMap<CustomFilterProgramInfo, CustomFilterValidatedProgram*> CustomFilterValidatedProgramsMap;
-
-class PLATFORM_EXPORT CustomFilterGlobalContext {
- WTF_MAKE_NONCOPYABLE(CustomFilterGlobalContext);
-public:
- CustomFilterGlobalContext();
- ~CustomFilterGlobalContext();
-
- GraphicsContext3D* context() const { return m_context.get(); }
-
- // CSS shaders not referenced from the CSS mix function should be validated just like regular WebGL shaders.
- // This ANGLE validator uses the SH_WEBGL_SPEC flag.
- ANGLEPlatformBridge* webglShaderValidator();
-
- // CSS shaders referenced from the CSS mix function should be validated slightly differently than WebGL shaders.
- // This ANGLE validator uses the SH_CSS_SHADERS_SPEC flag.
- // Under this flag, most notably:
- // - The "gl_FragColor" built-in is not available.
- // - Instead, the "css_MixColor" and "css_ColorMatrix" built-ins are available.
- // - The "css_" prefix is reserved.
- // - In the translated source that ANGLE returns, ANGLE renames the author's "main" function to "css_main".
- // The complete details are documented in ANGLE/ShaderLang.h.
- ANGLEPlatformBridge* mixShaderValidator();
-
- void prepareContextIfNeeded();
-
- PassRefPtr<CustomFilterValidatedProgram> getValidatedProgram(const CustomFilterProgramInfo&);
- void removeValidatedProgram(const CustomFilterValidatedProgram*);
-private:
- static PassOwnPtr<ANGLEPlatformBridge> createShaderValidator(ShShaderSpec);
-
- RefPtr<GraphicsContext3D> m_context;
- OwnPtr<ANGLEPlatformBridge> m_webglShaderValidator;
- OwnPtr<ANGLEPlatformBridge> m_mixShaderValidator;
- CustomFilterValidatedProgramsMap m_programs;
-};
-
-} // namespace WebCore
-
-#endif // CustomFilterGlobalContext_h
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterMesh.cpp b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterMesh.cpp
deleted file mode 100644
index cb4c59cfc37..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterMesh.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2011 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER “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 HOLDER 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"
-#include "platform/graphics/filters/custom/CustomFilterMesh.h"
-
-#include "platform/graphics/GraphicsContext3D.h"
-#include "platform/graphics/filters/custom/CustomFilterMeshGenerator.h"
-
-namespace WebCore {
-
-CustomFilterMesh::CustomFilterMesh(GraphicsContext3D* context, unsigned columns, unsigned rows,
- const FloatRect& meshBox, CustomFilterMeshType meshType)
- : m_context(context)
- , m_verticesBufferObject(0)
- , m_elementsBufferObject(0)
- , m_meshBox(meshBox)
- , m_meshType(meshType)
-{
- CustomFilterMeshGenerator generator(columns, rows, meshBox, meshType);
- m_indicesCount = generator.indicesCount();
- m_bytesPerVertex = generator.floatsPerVertex() * sizeof(float);
-
- m_context->makeContextCurrent();
-
- m_verticesBufferObject = m_context->createBuffer();
- m_context->bindBuffer(GL_ARRAY_BUFFER, m_verticesBufferObject);
- m_context->bufferData(GL_ARRAY_BUFFER, generator.vertices().size() * sizeof(float), generator.vertices().data(), GL_STATIC_DRAW);
-
- m_elementsBufferObject = m_context->createBuffer();
- m_context->bindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_elementsBufferObject);
- m_context->bufferData(GL_ELEMENT_ARRAY_BUFFER, generator.indices().size() * sizeof(uint16_t), generator.indices().data(), GL_STATIC_DRAW);
-}
-
-CustomFilterMesh::~CustomFilterMesh()
-{
- m_context->makeContextCurrent();
- m_context->deleteBuffer(m_verticesBufferObject);
- m_context->deleteBuffer(m_elementsBufferObject);
-}
-
-} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterMesh.h b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterMesh.h
deleted file mode 100644
index b9e8a1b5f11..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterMesh.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2011 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER “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 HOLDER 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 CustomFilterMesh_h
-#define CustomFilterMesh_h
-
-#include "platform/geometry/FloatRect.h"
-#include "platform/graphics/GraphicsTypes3D.h"
-#include "platform/graphics/filters/custom/CustomFilterOperation.h"
-#include "wtf/RefCounted.h"
-
-namespace WebCore {
-
-class GraphicsContext3D;
-
-class PLATFORM_EXPORT CustomFilterMesh : public RefCounted<CustomFilterMesh> {
-public:
- static PassRefPtr<CustomFilterMesh> create(GraphicsContext3D* context, unsigned cols, unsigned rows, const FloatRect& meshBox, CustomFilterMeshType meshType)
- {
- return adoptRef(new CustomFilterMesh(context, cols, rows, meshBox, meshType));
- }
- ~CustomFilterMesh();
-
- Platform3DObject verticesBufferObject() const { return m_verticesBufferObject; }
- unsigned bytesPerVertex() const { return m_bytesPerVertex; }
-
- Platform3DObject elementsBufferObject() const { return m_elementsBufferObject; }
- unsigned indicesCount() const { return m_indicesCount; }
-
- const FloatRect& meshBox() const { return m_meshBox; }
- CustomFilterMeshType meshType() const { return m_meshType; }
-
-private:
- CustomFilterMesh(GraphicsContext3D*, unsigned cols, unsigned rows, const FloatRect& meshBox, CustomFilterMeshType);
-
- GraphicsContext3D* m_context;
-
- Platform3DObject m_verticesBufferObject;
- unsigned m_bytesPerVertex;
-
- Platform3DObject m_elementsBufferObject;
- unsigned m_indicesCount;
-
- FloatRect m_meshBox;
- CustomFilterMeshType m_meshType;
-};
-
-} // namespace WebCore
-
-#endif // CustomFilterMesh_h
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterMeshGenerator.cpp b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterMeshGenerator.cpp
deleted file mode 100644
index 3e373009979..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterMeshGenerator.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (C) 2011 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER “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 HOLDER 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"
-#include "platform/graphics/filters/custom/CustomFilterMeshGenerator.h"
-
-#ifndef NDEBUG
-#include <stdio.h> // Needed for printf used in dumpBuffers.
-#endif
-
-namespace WebCore {
-
-#ifndef NDEBUG
-// Use "call 'WebCore::s_dumpCustomFilterMeshBuffers' = 1" in GDB to activate printing of the mesh buffers.
-static bool s_dumpCustomFilterMeshBuffers = false;
-#endif
-
-CustomFilterMeshGenerator::CustomFilterMeshGenerator(unsigned columns, unsigned rows, const FloatRect& meshBox, CustomFilterMeshType meshType)
- : m_meshType(meshType)
- , m_points(columns + 1, rows + 1)
- , m_tiles(columns, rows)
- , m_tileSizeInPixels(meshBox.width() / m_tiles.width(), meshBox.height() / m_tiles.height())
- , m_tileSizeInDeviceSpace(1.0f / m_tiles.width(), 1.0f / m_tiles.height())
- , m_meshBox(meshBox)
-{
- // Build the two buffers needed to draw triangles:
- // * m_vertices has a number of float attributes that will be passed to the vertex shader
- // for each computed vertex. This number is calculated in floatsPerVertex() based on the meshType.
- // * m_indices is a buffer that will have 3 indices per triangle. Each index will point inside
- // the m_vertices buffer.
- m_vertices.reserveCapacity(verticesCount() * floatsPerVertex());
- m_indices.reserveCapacity(indicesCount());
-
- // Based on the meshType there can be two types of meshes.
- // * attached: each triangle uses vertices from the neighbor triangles. This is useful to save some GPU memory
- // when there's no need to explode the tiles.
- // * detached: each triangle has its own vertices. This means each triangle can be moved independently and a vec3
- // attribute is passed, so that each vertex can be uniquely identified.
- if (m_meshType == MeshTypeAttached)
- generateAttachedMesh();
- else
- generateDetachedMesh();
-
-#ifndef NDEBUG
- if (s_dumpCustomFilterMeshBuffers)
- dumpBuffers();
-#endif
-}
-
-void CustomFilterMeshGenerator::addAttachedMeshIndex(int quadX, int quadY, int triangleX, int triangleY, int)
-{
- m_indices.append((quadY + triangleY) * m_points.width() + (quadX + triangleX));
-}
-
-void CustomFilterMeshGenerator::generateAttachedMesh()
-{
- for (int j = 0; j < m_points.height(); ++j) {
- for (int i = 0; i < m_points.width(); ++i)
- addAttachedMeshVertexAttributes(i, j);
- }
-
- for (int j = 0; j < m_tiles.height(); ++j) {
- for (int i = 0; i < m_tiles.width(); ++i)
- addTile<&CustomFilterMeshGenerator::addAttachedMeshIndex>(i, j);
- }
-}
-
-void CustomFilterMeshGenerator::addDetachedMeshVertexAndIndex(int quadX, int quadY, int triangleX, int triangleY, int triangle)
-{
- addDetachedMeshVertexAttributes(quadX, quadY, triangleX, triangleY, triangle);
- m_indices.append(m_indices.size());
-}
-
-void CustomFilterMeshGenerator::generateDetachedMesh()
-{
- for (int j = 0; j < m_tiles.height(); ++j) {
- for (int i = 0; i < m_tiles.width(); ++i)
- addTile<&CustomFilterMeshGenerator::addDetachedMeshVertexAndIndex>(i, j);
- }
-}
-
-void CustomFilterMeshGenerator::addPositionAttribute(int quadX, int quadY)
-{
- // vec4 a_position
- m_vertices.append(m_tileSizeInPixels.width() * quadX - 0.5f + m_meshBox.x());
- m_vertices.append(m_tileSizeInPixels.height() * quadY - 0.5f + m_meshBox.y());
- m_vertices.append(0.0f); // z
- m_vertices.append(1.0f);
-}
-
-void CustomFilterMeshGenerator::addTexCoordAttribute(int quadX, int quadY)
-{
- // vec2 a_texCoord
- m_vertices.append(m_tileSizeInPixels.width() * quadX + m_meshBox.x());
- m_vertices.append(m_tileSizeInPixels.height() * quadY + m_meshBox.y());
-}
-
-void CustomFilterMeshGenerator::addMeshCoordAttribute(int quadX, int quadY)
-{
- // vec2 a_meshCoord
- m_vertices.append(m_tileSizeInDeviceSpace.width() * quadX);
- m_vertices.append(m_tileSizeInDeviceSpace.height() * quadY);
-}
-
-void CustomFilterMeshGenerator::addTriangleCoordAttribute(int quadX, int quadY, int triangle)
-{
- // vec3 a_triangleCoord
- m_vertices.append(quadX);
- m_vertices.append(quadY);
- m_vertices.append(triangle);
-}
-
-void CustomFilterMeshGenerator::addAttachedMeshVertexAttributes(int quadX, int quadY)
-{
- addPositionAttribute(quadX, quadY);
- addTexCoordAttribute(quadX, quadY);
- addMeshCoordAttribute(quadX, quadY);
-}
-
-void CustomFilterMeshGenerator::addDetachedMeshVertexAttributes(int quadX, int quadY, int triangleX, int triangleY, int triangle)
-{
- addAttachedMeshVertexAttributes(quadX + triangleX, quadY + triangleY);
- addTriangleCoordAttribute(quadX, quadY, triangle);
-}
-
-#ifndef NDEBUG
-void CustomFilterMeshGenerator::dumpBuffers() const
-{
- printf("Mesh buffers: Points.width(): %d, Points.height(): %d meshBox: %f, %f, %f, %f, type: %s\n",
- m_points.width(), m_points.height(), m_meshBox.x(), m_meshBox.y(), m_meshBox.width(), m_meshBox.height(),
- (m_meshType == MeshTypeAttached) ? "Attached" : "Detached");
- printf("---Vertex:\n\t");
- for (unsigned i = 0; i < m_vertices.size(); ++i) {
- printf("%f ", m_vertices.at(i));
- if (!((i + 1) % floatsPerVertex()))
- printf("\n\t");
- }
- printf("\n---Indices: ");
- for (unsigned i = 0; i < m_indices.size(); ++i)
- printf("%d ", m_indices.at(i));
- printf("\n");
-}
-#endif
-
-} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterMeshGenerator.h b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterMeshGenerator.h
deleted file mode 100644
index d4fc6441611..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterMeshGenerator.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (C) 2011 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER “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 HOLDER 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 CustomFilterMeshGenerator_h
-#define CustomFilterMeshGenerator_h
-
-#include "platform/PlatformExport.h"
-#include "platform/geometry/FloatRect.h"
-#include "platform/graphics/filters/custom/CustomFilterConstants.h"
-
-namespace WebCore {
-
-class PLATFORM_EXPORT CustomFilterMeshGenerator {
-public:
- // Lines and columns are the values passed in CSS. The result is vertex mesh that has 'rows' numbers of rows
- // and 'columns' number of columns with a total of 'rows + 1' * 'columns + 1' vertices.
- // MeshBox is the filtered area calculated defined using the border-box, padding-box, content-box or filter-box
- // attributes. A value of (0, 0, 1, 1) will cover the entire output surface.
- CustomFilterMeshGenerator(unsigned columns, unsigned rows, const FloatRect& meshBox, CustomFilterMeshType);
-
- const Vector<float>& vertices() const { return m_vertices; }
- const Vector<uint16_t>& indices() const { return m_indices; }
-
- const IntSize& points() const { return m_points; }
- unsigned pointsCount() const { return m_points.width() * m_points.height(); }
-
- const IntSize& tiles() const { return m_tiles; }
- unsigned tilesCount() const { return m_tiles.width() * m_tiles.height(); }
-
- unsigned indicesCount() const
- {
- const unsigned trianglesPerTile = 2;
- const unsigned indicesPerTriangle = 3;
- return tilesCount() * trianglesPerTile * indicesPerTriangle;
- }
-
- unsigned floatsPerVertex() const
- {
- static const unsigned AttachedMeshVertexSize = PositionAttribSize + TexAttribSize + MeshAttribSize;
- static const unsigned DetachedMeshVertexSize = AttachedMeshVertexSize + TriangleAttribSize;
- return m_meshType == MeshTypeAttached ? AttachedMeshVertexSize : DetachedMeshVertexSize;
- }
-
- unsigned verticesCount() const
- {
- return m_meshType == MeshTypeAttached ? pointsCount() : indicesCount();
- }
-
-private:
- typedef void (CustomFilterMeshGenerator::*AddTriangleVertexFunction)(int quadX, int quadY, int triangleX, int triangleY, int triangle);
-
- template <AddTriangleVertexFunction addTriangleVertex>
- void addTile(int quadX, int quadY)
- {
- ((*this).*(addTriangleVertex))(quadX, quadY, 0, 0, 1);
- ((*this).*(addTriangleVertex))(quadX, quadY, 1, 0, 2);
- ((*this).*(addTriangleVertex))(quadX, quadY, 1, 1, 3);
- ((*this).*(addTriangleVertex))(quadX, quadY, 0, 0, 4);
- ((*this).*(addTriangleVertex))(quadX, quadY, 1, 1, 5);
- ((*this).*(addTriangleVertex))(quadX, quadY, 0, 1, 6);
- }
-
- void addAttachedMeshIndex(int quadX, int quadY, int triangleX, int triangleY, int triangle);
-
- void generateAttachedMesh();
-
- void addDetachedMeshVertexAndIndex(int quadX, int quadY, int triangleX, int triangleY, int triangle);
-
- void generateDetachedMesh();
- void addPositionAttribute(int quadX, int quadY);
- void addTexCoordAttribute(int quadX, int quadY);
- void addMeshCoordAttribute(int quadX, int quadY);
- void addTriangleCoordAttribute(int quadX, int quadY, int triangle);
- void addAttachedMeshVertexAttributes(int quadX, int quadY);
- void addDetachedMeshVertexAttributes(int quadX, int quadY, int triangleX, int triangleY, int triangle);
-
-#ifndef NDEBUG
- void dumpBuffers() const;
-#endif
-
-private:
- Vector<float> m_vertices;
- Vector<uint16_t> m_indices;
-
- CustomFilterMeshType m_meshType;
- IntSize m_points;
- IntSize m_tiles;
- FloatSize m_tileSizeInPixels;
- FloatSize m_tileSizeInDeviceSpace;
- FloatRect m_meshBox;
-};
-
-} // namespace WebCore
-
-#endif // CustomFilterMeshGenerator_h
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterNumberParameter.cpp b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterNumberParameter.cpp
deleted file mode 100644
index 1fbfa58f6a9..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterNumberParameter.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER “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 HOLDER 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"
-#include "platform/graphics/filters/custom/CustomFilterNumberParameter.h"
-
-#include "platform/animation/AnimationUtilities.h"
-
-namespace WebCore {
-
-PassRefPtr<CustomFilterParameter> CustomFilterNumberParameter::blend(const CustomFilterParameter* from, double progress)
-{
- if (!from || !isSameType(*from))
- return this;
- const CustomFilterNumberParameter* fromNumber = static_cast<const CustomFilterNumberParameter*>(from);
- if (size() != fromNumber->size())
- return this;
- RefPtr<CustomFilterNumberParameter> result = CustomFilterNumberParameter::create(name());
- for (size_t i = 0; i < size(); ++i)
- result->addValue(WebCore::blend(fromNumber->valueAt(i), valueAt(i), progress));
- return result.release();
-}
-
-} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterNumberParameter.h b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterNumberParameter.h
deleted file mode 100644
index ed2e838fcd9..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterNumberParameter.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER “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 HOLDER 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 CustomFilterNumberParameter_h
-#define CustomFilterNumberParameter_h
-
-#include "platform/PlatformExport.h"
-#include "platform/graphics/filters/custom/CustomFilterParameter.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-class PLATFORM_EXPORT CustomFilterNumberParameter : public CustomFilterParameter {
-public:
- static PassRefPtr<CustomFilterNumberParameter> create(const String& name)
- {
- return adoptRef(new CustomFilterNumberParameter(name));
- }
-
- unsigned size() const { return m_data.size(); }
- double valueAt(unsigned index) const { return m_data.at(index); }
-
- void addValue(double value) { m_data.append(value); }
-
- virtual PassRefPtr<CustomFilterParameter> blend(const CustomFilterParameter* from, double progress);
-
- virtual bool operator==(const CustomFilterParameter& o) const
- {
- if (!isSameType(o))
- return false;
- const CustomFilterNumberParameter* other = static_cast<const CustomFilterNumberParameter*>(&o);
- return m_data == other->m_data;
- }
-
-private:
- CustomFilterNumberParameter(const String& name)
- : CustomFilterParameter(Number, name)
- {
- }
-
- Vector<double, 4> m_data;
-};
-
-} // namespace WebCore
-
-
-#endif // CustomFilterNumberParameter_h
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterOperation.cpp b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterOperation.cpp
deleted file mode 100644
index cf13a4998a3..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterOperation.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER “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 HOLDER 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"
-#include "platform/graphics/filters/custom/CustomFilterOperation.h"
-
-#include "platform/graphics/filters/custom/CustomFilterParameter.h"
-
-namespace WebCore {
-
-CustomFilterOperation::CustomFilterOperation(PassRefPtr<CustomFilterProgram> program, const CustomFilterParameterList& sortedParameters, unsigned meshRows, unsigned meshColumns, CustomFilterMeshType meshType)
- : FilterOperation(CUSTOM)
- , m_program(program)
- , m_parameters(sortedParameters)
- , m_meshRows(meshRows)
- , m_meshColumns(meshColumns)
- , m_meshType(meshType)
-{
-}
-
-CustomFilterOperation::~CustomFilterOperation()
-{
-}
-
-PassRefPtr<FilterOperation> CustomFilterOperation::blend(const FilterOperation* from, double progress) const
-{
- if (!from) {
- // FIXME: There's no way to decide what is the "passthrough filter" for shaders using the current CSS Syntax.
- // https://bugs.webkit.org/show_bug.cgi?id=84903
- // https://www.w3.org/Bugs/Public/show_bug.cgi?id=16861
- return const_cast<CustomFilterOperation*>(this);
- }
-
- ASSERT_WITH_SECURITY_IMPLICATION(from->isSameType(*this));
- const CustomFilterOperation* fromOp = toCustomFilterOperation(from);
- if (m_program.get() != fromOp->m_program.get()
- || m_meshRows != fromOp->m_meshRows
- || m_meshColumns != fromOp->m_meshColumns
- || m_meshType != fromOp->m_meshType)
- return const_cast<CustomFilterOperation*>(this);
-
- CustomFilterParameterList animatedParameters;
- m_parameters.blend(fromOp->m_parameters, progress, animatedParameters);
- return CustomFilterOperation::create(m_program, animatedParameters, m_meshRows, m_meshColumns, m_meshType);
-}
-
-} // namespace WebCore
-
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterOperation.h b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterOperation.h
deleted file mode 100644
index 945a534b108..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterOperation.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER “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 HOLDER 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 CustomFilterOperation_h
-#define CustomFilterOperation_h
-
-#include "platform/geometry/LayoutSize.h"
-#include "platform/graphics/filters/FilterOperation.h"
-#include "platform/graphics/filters/custom/CustomFilterConstants.h"
-#include "platform/graphics/filters/custom/CustomFilterParameterList.h"
-#include "platform/graphics/filters/custom/CustomFilterProgram.h"
-
-namespace WebCore {
-
-// CSS Shaders
-
-class PLATFORM_EXPORT CustomFilterOperation : public FilterOperation {
-public:
- static PassRefPtr<CustomFilterOperation> create(PassRefPtr<CustomFilterProgram> program, const CustomFilterParameterList& sortedParameters, unsigned meshRows, unsigned meshColumns, CustomFilterMeshType meshType)
- {
- return adoptRef(new CustomFilterOperation(program, sortedParameters, meshRows, meshColumns, meshType));
- }
-
- CustomFilterProgram* program() const { return m_program.get(); }
- void setProgram(PassRefPtr<CustomFilterProgram> program) { m_program = program; }
-
- const CustomFilterParameterList& parameters() const { return m_parameters; }
-
- unsigned meshRows() const { return m_meshRows; }
- unsigned meshColumns() const { return m_meshColumns; }
-
- CustomFilterMeshType meshType() const { return m_meshType; }
-
- virtual ~CustomFilterOperation();
-
- virtual bool affectsOpacity() const { return true; }
- virtual bool movesPixels() const { return true; }
-
-
-protected:
- CustomFilterOperation(PassRefPtr<CustomFilterProgram>, const CustomFilterParameterList&, unsigned meshRows, unsigned meshColumns, CustomFilterMeshType);
-
-private:
- virtual PassRefPtr<FilterOperation> blend(const FilterOperation* from, double progress) const OVERRIDE;
- virtual bool operator==(const FilterOperation& o) const
- {
- if (!isSameType(o))
- return false;
-
- const CustomFilterOperation* other = static_cast<const CustomFilterOperation*>(&o);
- return m_program.get() == other->m_program.get()
- && m_meshRows == other->m_meshRows
- && m_meshColumns == other->m_meshColumns
- && m_meshType == other->m_meshType
- && m_parameters == other->m_parameters;
- }
-
- RefPtr<CustomFilterProgram> m_program;
- CustomFilterParameterList m_parameters;
-
- unsigned m_meshRows;
- unsigned m_meshColumns;
- CustomFilterMeshType m_meshType;
-};
-
-DEFINE_FILTER_OPERATION_TYPE_CASTS(CustomFilterOperation, CUSTOM);
-
-} // namespace WebCore
-
-
-#endif // CustomFilterOperation_h
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterParameter.h b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterParameter.h
deleted file mode 100644
index 13e1277528a..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterParameter.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER “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 HOLDER 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 CustomFilterParameter_h
-#define CustomFilterParameter_h
-
-#include "platform/PlatformExport.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class PLATFORM_EXPORT CustomFilterParameter : public RefCounted<CustomFilterParameter> {
-public:
- // FIXME: Implement other parameters types:
- // booleans: https://bugs.webkit.org/show_bug.cgi?id=76438
- // textures: https://bugs.webkit.org/show_bug.cgi?id=71442
- // 3d-transforms: https://bugs.webkit.org/show_bug.cgi?id=71443
- // mat2, mat3, mat4: https://bugs.webkit.org/show_bug.cgi?id=71444
- enum ParameterType {
- Array,
- Number,
- Transform
- };
-
- virtual ~CustomFilterParameter() { }
-
- ParameterType parameterType() const { return m_type; }
- const String& name() const { return m_name; }
-
- bool isSameType(const CustomFilterParameter& other) const { return parameterType() == other.parameterType(); }
-
- virtual PassRefPtr<CustomFilterParameter> blend(const CustomFilterParameter*, double progress) = 0;
- virtual bool operator==(const CustomFilterParameter&) const = 0;
- bool operator!=(const CustomFilterParameter& o) const { return !(*this == o); }
-protected:
- CustomFilterParameter(ParameterType type, const String& name)
- : m_name(name)
- , m_type(type)
- {
- }
-
-private:
- String m_name;
- ParameterType m_type;
-};
-
-} // namespace WebCore
-
-
-#endif // CustomFilterParameter_h
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterParameterList.cpp b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterParameterList.cpp
deleted file mode 100644
index d10aae8498e..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterParameterList.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER "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 HOLDER 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"
-#include "platform/graphics/filters/custom/CustomFilterParameterList.h"
-
-#include "wtf/text/StringHash.h"
-
-namespace WebCore {
-
-CustomFilterParameterList::CustomFilterParameterList()
-{
-}
-
-CustomFilterParameterList::CustomFilterParameterList(size_t size)
- : m_parameters(size)
-{
-}
-
-bool CustomFilterParameterList::operator==(const CustomFilterParameterList& other) const
-{
- if (size() != other.size())
- return false;
- for (size_t i = 0; i < size(); ++i) {
- if (at(i).get() != other.at(i).get()
- && *at(i).get() != *other.at(i).get())
- return false;
- }
- return true;
-}
-
-#ifndef NDEBUG
-bool CustomFilterParameterList::checkAlphabeticalOrder() const
-{
- for (unsigned i = 1; i < size(); ++i) {
- // Break for equal or not-sorted parameters.
- if (!codePointCompareLessThan(at(i - 1)->name(), at(i)->name()))
- return false;
- }
- return true;
-}
-#endif
-
-void CustomFilterParameterList::blend(const CustomFilterParameterList& fromList,
- double progress, CustomFilterParameterList& resultList) const
-{
-#ifndef NDEBUG
- // This method expects both lists to be sorted by parameter name and the result list is also sorted.
- ASSERT(checkAlphabeticalOrder());
- ASSERT(fromList.checkAlphabeticalOrder());
-#endif
- size_t fromListIndex = 0, toListIndex = 0;
- while (fromListIndex < fromList.size() && toListIndex < size()) {
- CustomFilterParameter* paramFrom = fromList.at(fromListIndex).get();
- CustomFilterParameter* paramTo = at(toListIndex).get();
- if (paramFrom->name() == paramTo->name()) {
- resultList.append(paramTo->blend(paramFrom, progress));
- ++fromListIndex;
- ++toListIndex;
- continue;
- }
- if (codePointCompareLessThan(paramFrom->name(), paramTo->name())) {
- resultList.append(paramFrom);
- ++fromListIndex;
- continue;
- }
- resultList.append(paramTo);
- ++toListIndex;
- }
- for (; fromListIndex < fromList.size(); ++fromListIndex)
- resultList.append(fromList.at(fromListIndex));
- for (; toListIndex < size(); ++toListIndex)
- resultList.append(at(toListIndex));
-#ifndef NDEBUG
- ASSERT(resultList.checkAlphabeticalOrder());
-#endif
-}
-
-static bool sortParametersByNameComparator(const RefPtr<CustomFilterParameter>& a, const RefPtr<CustomFilterParameter>& b)
-{
- return codePointCompareLessThan(a->name(), b->name());
-}
-
-void CustomFilterParameterList::sortParametersByName()
-{
- std::sort(m_parameters.begin(), m_parameters.end(), sortParametersByNameComparator);
-}
-
-} // namespace WebCore
-
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterParameterList.h b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterParameterList.h
deleted file mode 100644
index 0dd3dcd9a0e..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterParameterList.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER "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 HOLDER 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 CustomFilterParameterList_h
-#define CustomFilterParameterList_h
-
-#include "platform/PlatformExport.h"
-#include "platform/geometry/LayoutSize.h"
-#include "platform/graphics/filters/custom/CustomFilterParameter.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-class PLATFORM_EXPORT CustomFilterParameterList {
-public:
- CustomFilterParameterList();
- explicit CustomFilterParameterList(size_t);
-
- void blend(const CustomFilterParameterList& from, double progress, CustomFilterParameterList& resultList) const;
- bool operator==(const CustomFilterParameterList&) const;
-
- PassRefPtr<CustomFilterParameter> at(size_t index) const { return m_parameters.at(index); }
- size_t size() const { return m_parameters.size(); }
- void append(const PassRefPtr<CustomFilterParameter>& parameter) { m_parameters.append(parameter); }
- void sortParametersByName();
-private:
-#ifndef NDEBUG
- bool checkAlphabeticalOrder() const;
-#endif
- typedef Vector<RefPtr<CustomFilterParameter> > CustomFilterParameterVector;
- CustomFilterParameterVector m_parameters;
-};
-
-} // namespace WebCore
-
-
-#endif // CustomFilterParameterList_h
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterProgram.cpp b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterProgram.cpp
deleted file mode 100644
index ebaff283493..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterProgram.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER “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 HOLDER 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"
-#include "platform/graphics/filters/custom/CustomFilterProgram.h"
-
-#include "platform/graphics/filters/custom/CustomFilterProgramClient.h"
-
-namespace WebCore {
-
-CustomFilterProgram::CustomFilterProgram(CustomFilterProgramType programType, const CustomFilterProgramMixSettings& mixSettings, CustomFilterMeshType meshType)
- : m_programType(programType)
- , m_mixSettings(mixSettings)
- , m_meshType(meshType)
-{
- // Keep the constructor protected to prevent creating this object directly.
-}
-
-CustomFilterProgram::~CustomFilterProgram()
-{
- // All the clients should keep a reference to this object.
- ASSERT(m_clients.isEmpty());
-}
-
-void CustomFilterProgram::addClient(CustomFilterProgramClient* client)
-{
- if (m_clients.isEmpty()) {
- // Notify the StyleCustomFilterProgram that we now have at least a client
- // and the loading can begin.
- // Note: If the shader is already cached the first client will be notified,
- // even if the filter was already built. Add the client only after notifying
- // the cache about them, so that we avoid a useless recreation of the filters chain.
- willHaveClients();
- }
- m_clients.add(client);
-}
-
-void CustomFilterProgram::removeClient(CustomFilterProgramClient* client)
-{
- m_clients.remove(client);
- if (m_clients.isEmpty()) {
- // We have no clients anymore, the cached resources can be purged from memory.
- didRemoveLastClient();
- }
-}
-
-void CustomFilterProgram::notifyClients()
-{
- for (CustomFilterProgramClientList::iterator iter = m_clients.begin(), end = m_clients.end(); iter != end; ++iter)
- iter->key->notifyCustomFilterProgramLoaded(this);
-}
-
-CustomFilterProgramInfo CustomFilterProgram::programInfo() const
-{
- ASSERT(isLoaded());
- return CustomFilterProgramInfo(vertexShaderString(), fragmentShaderString(), m_programType, m_mixSettings, m_meshType);
-}
-
-} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterProgram.h b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterProgram.h
deleted file mode 100644
index 1b949786d8e..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterProgram.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER “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 HOLDER 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 CustomFilterProgram_h
-#define CustomFilterProgram_h
-
-#include "platform/graphics/filters/custom/CustomFilterProgramInfo.h"
-
-#include "wtf/HashCountedSet.h"
-#include "wtf/RefCounted.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class GraphicsContext3D;
-class CustomFilterCompiledProgram;
-class CustomFilterProgramClient;
-
-// This is the base class for the StyleCustomFilterProgram class which knows how to keep
-// references to the cached shaders.
-class PLATFORM_EXPORT CustomFilterProgram: public RefCounted<CustomFilterProgram> {
-public:
- virtual ~CustomFilterProgram();
-
- virtual bool isLoaded() const = 0;
-
- void addClient(CustomFilterProgramClient*);
- void removeClient(CustomFilterProgramClient*);
-
- CustomFilterProgramInfo programInfo() const;
-
- virtual String vertexShaderString() const = 0;
- virtual String fragmentShaderString() const = 0;
- CustomFilterProgramType programType() const { return m_programType; }
- CustomFilterProgramMixSettings mixSettings() const { return m_mixSettings; }
- CustomFilterMeshType meshType() const { return m_meshType; }
-
-protected:
- // StyleCustomFilterProgram can notify the clients that the cached resources are
- // loaded and it is ready to create CustomFilterCompiledProgram objects.
- void notifyClients();
-
- virtual void willHaveClients() = 0;
- virtual void didRemoveLastClient() = 0;
-
- // Keep the constructor protected to prevent creating this object directly.
- CustomFilterProgram(CustomFilterProgramType, const CustomFilterProgramMixSettings&, CustomFilterMeshType);
-
-private:
- // CustomFilterPrograms are unique combinations of shaders and can be
- // compared using just the pointer value instead.
- // These will catch anyone doing a value equal comparison.
- bool operator==(const CustomFilterProgram&) const;
- bool operator!=(const CustomFilterProgram&) const;
-
- typedef HashCountedSet<CustomFilterProgramClient*> CustomFilterProgramClientList;
- CustomFilterProgramClientList m_clients;
- CustomFilterProgramType m_programType;
- CustomFilterProgramMixSettings m_mixSettings;
- CustomFilterMeshType m_meshType;
-};
-
-}
-
-
-#endif
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterProgramClient.cpp b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterProgramClient.cpp
deleted file mode 100644
index 85a378f6bac..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterProgramClient.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER “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 HOLDER 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"
-#include "platform/graphics/filters/custom/CustomFilterProgramClient.h"
-
-namespace WebCore {
-
-CustomFilterProgramClient::~CustomFilterProgramClient()
-{
-}
-
-} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterProgramClient.h b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterProgramClient.h
deleted file mode 100644
index b13098b9ab8..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterProgramClient.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER “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 HOLDER 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 CustomFilterProgramClient_h
-#define CustomFilterProgramClient_h
-
-#include "platform/PlatformExport.h"
-
-namespace WebCore {
-
-class CustomFilterProgram;
-
-class PLATFORM_EXPORT CustomFilterProgramClient {
-public:
- virtual ~CustomFilterProgramClient();
-
- virtual void notifyCustomFilterProgramLoaded(CustomFilterProgram*) = 0;
-};
-
-}
-
-
-#endif // CustomFilterProgramClient_h
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterProgramInfo.cpp b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterProgramInfo.cpp
deleted file mode 100644
index a767e6edb90..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterProgramInfo.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER “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 HOLDER 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"
-#include "platform/graphics/filters/custom/CustomFilterProgramInfo.h"
-
-#include "wtf/HashFunctions.h"
-#include "wtf/text/StringHash.h"
-
-namespace WebCore {
-
-static unsigned hashPossiblyNullString(const String& string)
-{
- return string.isNull() ? 0 : DefaultHash<String>::Hash::hash(string);
-}
-
-CustomFilterProgramInfo::CustomFilterProgramInfo()
-{
-}
-
-bool CustomFilterProgramInfo::isEmptyValue() const
-{
- return m_vertexShaderString.isNull()
- && m_fragmentShaderString.isNull();
-}
-
-CustomFilterProgramInfo::CustomFilterProgramInfo(WTF::HashTableDeletedValueType)
- : m_vertexShaderString(WTF::HashTableDeletedValue)
- , m_fragmentShaderString(WTF::HashTableDeletedValue)
-{
-}
-
-bool CustomFilterProgramInfo::isHashTableDeletedValue() const
-{
- return m_vertexShaderString.isHashTableDeletedValue()
- && m_fragmentShaderString.isHashTableDeletedValue();
-}
-
-CustomFilterProgramInfo::CustomFilterProgramInfo(const String& vertexShader, const String& fragmentShader, CustomFilterProgramType programType, const CustomFilterProgramMixSettings& mixSettings, CustomFilterMeshType meshType)
- : m_vertexShaderString(vertexShader)
- , m_fragmentShaderString(fragmentShader)
- , m_programType(programType)
- , m_mixSettings(mixSettings)
- , m_meshType(meshType)
-{
- // At least one of the shaders needs to be non-null.
- ASSERT(!m_vertexShaderString.isNull() || !m_fragmentShaderString.isNull());
-}
-
-unsigned CustomFilterProgramInfo::hash() const
-{
- // At least one of the shaders needs to be non-null.
- ASSERT(!m_vertexShaderString.isNull() || !m_fragmentShaderString.isNull());
-
- bool blendsElementTexture = (m_programType == ProgramTypeBlendsElementTexture);
- uintptr_t hashCodes[6] = {
- hashPossiblyNullString(m_vertexShaderString),
- hashPossiblyNullString(m_fragmentShaderString),
- blendsElementTexture,
- static_cast<uintptr_t>(blendsElementTexture ? m_mixSettings.blendMode : 0),
- static_cast<uintptr_t>(blendsElementTexture ? m_mixSettings.compositeOperator : 0),
- m_meshType
- };
- return StringHasher::hashMemory<sizeof(hashCodes)>(&hashCodes);
-}
-
-bool CustomFilterProgramInfo::operator==(const CustomFilterProgramInfo& o) const
-{
- ASSERT(!isHashTableDeletedValue());
- ASSERT(!o.isHashTableDeletedValue());
-
- return m_programType == o.m_programType
- && (m_programType != ProgramTypeBlendsElementTexture || m_mixSettings == o.m_mixSettings)
- && m_meshType == o.m_meshType
- && m_vertexShaderString == o.m_vertexShaderString
- && m_fragmentShaderString == o.m_fragmentShaderString;
-}
-
-} // namespace WebCore
-
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterProgramInfo.h b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterProgramInfo.h
deleted file mode 100644
index 079cd402ede..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterProgramInfo.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER “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 HOLDER 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 CustomFilterProgramInfo_h
-#define CustomFilterProgramInfo_h
-
-#include "platform/PlatformExport.h"
-#include "platform/graphics/GraphicsTypes.h"
-#include "platform/graphics/filters/custom/CustomFilterConstants.h"
-#include "wtf/HashTableDeletedValueType.h"
-#include "wtf/HashTraits.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-
-struct CustomFilterProgramMixSettings {
- CustomFilterProgramMixSettings()
- : blendMode(blink::WebBlendModeNormal)
- , compositeOperator(CompositeSourceAtop)
- {
- }
-
- bool operator==(const CustomFilterProgramMixSettings& o) const
- {
- return blendMode == o.blendMode && compositeOperator == o.compositeOperator;
- }
-
- blink::WebBlendMode blendMode;
- CompositeOperator compositeOperator;
-};
-
-// CustomFilterProgramInfo is the key used to link CustomFilterProgram with CustomFilterCompiledProgram.
-// It can be used as a key in a HashMap, with the note that at least one of Strings needs to be non-null.
-// Null strings are placeholders for the default shader.
-class PLATFORM_EXPORT CustomFilterProgramInfo {
-public:
- CustomFilterProgramInfo(const String&, const String&, CustomFilterProgramType, const CustomFilterProgramMixSettings&, CustomFilterMeshType);
-
- CustomFilterProgramInfo();
- bool isEmptyValue() const;
-
- CustomFilterProgramInfo(WTF::HashTableDeletedValueType);
- bool isHashTableDeletedValue() const;
-
- unsigned hash() const;
- bool operator==(const CustomFilterProgramInfo&) const;
-
- const String& vertexShaderString() const { return m_vertexShaderString; }
- const String& fragmentShaderString() const { return m_fragmentShaderString; }
- CustomFilterProgramType programType() const { return m_programType; }
- const CustomFilterProgramMixSettings& mixSettings() const { return m_mixSettings; }
- CustomFilterMeshType meshType() const { return m_meshType; }
-private:
- String m_vertexShaderString;
- String m_fragmentShaderString;
- CustomFilterProgramType m_programType;
- CustomFilterProgramMixSettings m_mixSettings;
- CustomFilterMeshType m_meshType;
-};
-
-struct CustomFilterProgramInfoHash {
- static unsigned hash(const CustomFilterProgramInfo& programInfo) { return programInfo.hash(); }
- static bool equal(const CustomFilterProgramInfo& a, const CustomFilterProgramInfo& b) { return a == b; }
- static const bool safeToCompareToEmptyOrDeleted = false;
-};
-
-struct CustomFilterProgramInfoHashTraits : WTF::SimpleClassHashTraits<CustomFilterProgramInfo> {
- static const bool hasIsEmptyValueFunction = true;
- static bool isEmptyValue(const CustomFilterProgramInfo& info) { return info.isEmptyValue(); }
-};
-
-} // namespace WebCore
-
-namespace WTF {
-
-template<> struct HashTraits<WebCore::CustomFilterProgramInfo> : WebCore::CustomFilterProgramInfoHashTraits { };
-template<> struct DefaultHash<WebCore::CustomFilterProgramInfo> {
- typedef WebCore::CustomFilterProgramInfoHash Hash;
-};
-
-}
-
-#endif // CustomFilterProgramInfo_h
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterRenderer.cpp b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterRenderer.cpp
deleted file mode 100644
index c8480321696..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterRenderer.cpp
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
- * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
- * Copyright (C) 2012 Company 100, 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 THE COPYRIGHT HOLDER “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 HOLDER 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"
-#include "platform/graphics/filters/custom/CustomFilterRenderer.h"
-
-#include "platform/graphics/GraphicsContext3D.h"
-#include "platform/graphics/filters/custom/CustomFilterArrayParameter.h"
-#include "platform/graphics/filters/custom/CustomFilterCompiledProgram.h"
-#include "platform/graphics/filters/custom/CustomFilterMesh.h"
-#include "platform/graphics/filters/custom/CustomFilterNumberParameter.h"
-#include "platform/graphics/filters/custom/CustomFilterParameter.h"
-#include "platform/graphics/filters/custom/CustomFilterTransformParameter.h"
-#include "platform/transforms/TransformationMatrix.h"
-
-namespace WebCore {
-
-static void orthogonalProjectionMatrix(TransformationMatrix& matrix, float left, float right, float bottom, float top)
-{
- ASSERT(matrix.isIdentity());
-
- float deltaX = right - left;
- float deltaY = top - bottom;
- if (!deltaX || !deltaY)
- return;
- matrix.setM11(2.0f / deltaX);
- matrix.setM41(-(right + left) / deltaX);
- matrix.setM22(2.0f / deltaY);
- matrix.setM42(-(top + bottom) / deltaY);
-
- // Use big enough near/far values, so that simple rotations of rather large objects will not
- // get clipped. 10000 should cover most of the screen resolutions.
- const float farValue = 10000;
- const float nearValue = -10000;
- matrix.setM33(-2.0f / (farValue - nearValue));
- matrix.setM43(- (farValue + nearValue) / (farValue - nearValue));
- matrix.setM44(1.0f);
-}
-
-PassRefPtr<CustomFilterRenderer> CustomFilterRenderer::create(PassRefPtr<GraphicsContext3D> context, CustomFilterProgramType programType, const CustomFilterParameterList& parameters,
- unsigned meshRows, unsigned meshColumns, CustomFilterMeshType meshType)
-{
- return adoptRef(new CustomFilterRenderer(context, programType, parameters, meshRows, meshColumns, meshType));
-}
-
-CustomFilterRenderer::CustomFilterRenderer(PassRefPtr<GraphicsContext3D> context, CustomFilterProgramType programType, const CustomFilterParameterList& parameters,
- unsigned meshRows, unsigned meshColumns, CustomFilterMeshType meshType)
- : m_context(context)
- , m_programType(programType)
- , m_parameters(parameters)
- , m_meshRows(meshRows)
- , m_meshColumns(meshColumns)
- , m_meshType(meshType)
-{
-}
-
-CustomFilterRenderer::~CustomFilterRenderer()
-{
-}
-
-bool CustomFilterRenderer::premultipliedAlpha() const
-{
- return m_programType == ProgramTypeBlendsElementTexture;
-}
-
-bool CustomFilterRenderer::programNeedsInputTexture() const
-{
- ASSERT(m_compiledProgram.get());
- return m_compiledProgram->samplerLocation() != -1;
-}
-
-void CustomFilterRenderer::draw(Platform3DObject inputTexture, const IntSize& size)
-{
- // FIXME: We would need something like CustomFilterRendererState that will contain the size and other parameters in the future. We should pass that to bindProgramBuffers instead of storing it.
- // https://bugs.webkit.org/show_bug.cgi?id=100107
- m_contextSize = size;
-
- bindProgramAndBuffers(inputTexture);
- m_context->drawElements(GL_TRIANGLES, m_mesh->indicesCount(), GL_UNSIGNED_SHORT, 0);
- unbindVertexAttributes();
-}
-
-void CustomFilterRenderer::setCompiledProgram(PassRefPtr<CustomFilterCompiledProgram> compiledProgram)
-{
- m_compiledProgram = compiledProgram;
-}
-
-bool CustomFilterRenderer::prepareForDrawing()
-{
- m_context->makeContextCurrent();
- if (!m_compiledProgram || !m_compiledProgram->isInitialized())
- return false;
- initializeMeshIfNeeded();
- return true;
-}
-
-void CustomFilterRenderer::initializeMeshIfNeeded()
-{
- if (m_mesh.get())
- return;
-
- // FIXME: Sharing the mesh would just save the time needed to upload it to the GPU, so I assume we could
- // benchmark that for performance.
- // https://bugs.webkit.org/show_bug.cgi?id=88429
- m_mesh = CustomFilterMesh::create(m_context.get(), m_meshColumns, m_meshRows, FloatRect(0, 0, 1, 1), m_meshType);
-}
-
-void CustomFilterRenderer::bindVertexAttribute(int attributeLocation, unsigned size, unsigned offset)
-{
- if (attributeLocation != -1) {
- m_context->vertexAttribPointer(attributeLocation, size, GL_FLOAT, false, m_mesh->bytesPerVertex(), offset);
- m_context->enableVertexAttribArray(attributeLocation);
- }
-}
-
-void CustomFilterRenderer::unbindVertexAttribute(int attributeLocation)
-{
- if (attributeLocation != -1)
- m_context->disableVertexAttribArray(attributeLocation);
-}
-
-void CustomFilterRenderer::bindProgramArrayParameters(int uniformLocation, CustomFilterArrayParameter* arrayParameter)
-{
- unsigned parameterSize = arrayParameter->size();
- Vector<GC3Dfloat> floatVector;
-
- for (unsigned i = 0; i < parameterSize; ++i)
- floatVector.append(arrayParameter->valueAt(i));
-
- m_context->uniform1fv(uniformLocation, parameterSize, floatVector.data());
-}
-
-void CustomFilterRenderer::bindProgramNumberParameters(int uniformLocation, CustomFilterNumberParameter* numberParameter)
-{
- switch (numberParameter->size()) {
- case 1:
- m_context->uniform1f(uniformLocation, numberParameter->valueAt(0));
- break;
- case 2:
- m_context->uniform2f(uniformLocation, numberParameter->valueAt(0), numberParameter->valueAt(1));
- break;
- case 3:
- m_context->uniform3f(uniformLocation, numberParameter->valueAt(0), numberParameter->valueAt(1), numberParameter->valueAt(2));
- break;
- case 4:
- m_context->uniform4f(uniformLocation, numberParameter->valueAt(0), numberParameter->valueAt(1), numberParameter->valueAt(2), numberParameter->valueAt(3));
- break;
- default:
- ASSERT_NOT_REACHED();
- }
-}
-
-void CustomFilterRenderer::bindProgramTransformParameter(int uniformLocation, CustomFilterTransformParameter* transformParameter)
-{
- TransformationMatrix matrix;
- if (m_contextSize.width() && m_contextSize.height()) {
- // The viewport is a box with the size of 1 unit, so we are scaling up here to make sure that translations happen using real pixel
- // units. At the end we scale back down in order to map it back to the original box. Note that transforms come in reverse order, because it is
- // supposed to multiply to the left of the coordinates of the vertices.
- // Note that the origin (0, 0) of the viewport is in the middle of the context, so there's no need to change the origin of the transform
- // in order to rotate around the middle of mesh.
- matrix.scale3d(1.0 / m_contextSize.width(), 1.0 / m_contextSize.height(), 1);
- transformParameter->applyTransform(matrix, m_contextSize);
- matrix.scale3d(m_contextSize.width(), m_contextSize.height(), 1);
- }
- float glMatrix[16];
- matrix.toColumnMajorFloatArray(glMatrix);
- m_context->uniformMatrix4fv(uniformLocation, 1, false, &glMatrix[0]);
-}
-
-void CustomFilterRenderer::bindProgramParameters()
-{
- // FIXME: Find a way to reset uniforms that are not specified in CSS. This is needed to avoid using values
- // set by other previous rendered filters.
- // https://bugs.webkit.org/show_bug.cgi?id=76440
-
- size_t parametersSize = m_parameters.size();
- for (size_t i = 0; i < parametersSize; ++i) {
- CustomFilterParameter* parameter = m_parameters.at(i).get();
- int uniformLocation = m_compiledProgram->uniformLocationByName(parameter->name());
- if (uniformLocation == -1)
- continue;
- switch (parameter->parameterType()) {
- case CustomFilterParameter::Array:
- bindProgramArrayParameters(uniformLocation, static_cast<CustomFilterArrayParameter*>(parameter));
- break;
- case CustomFilterParameter::Number:
- bindProgramNumberParameters(uniformLocation, static_cast<CustomFilterNumberParameter*>(parameter));
- break;
- case CustomFilterParameter::Transform:
- bindProgramTransformParameter(uniformLocation, static_cast<CustomFilterTransformParameter*>(parameter));
- break;
- }
- }
-}
-
-void CustomFilterRenderer::bindProgramAndBuffers(Platform3DObject inputTexture)
-{
- ASSERT(m_compiledProgram->isInitialized());
-
- m_context->useProgram(m_compiledProgram->program());
-
- if (programNeedsInputTexture()) {
- // We should be binding the DOM element texture sampler only if the author is using the CSS mix function.
- ASSERT(m_programType == ProgramTypeBlendsElementTexture);
- ASSERT(m_compiledProgram->samplerLocation() != -1);
-
- m_context->activeTexture(GL_TEXTURE0);
- m_context->uniform1i(m_compiledProgram->samplerLocation(), 0);
- m_context->bindTexture(GL_TEXTURE_2D, inputTexture);
- m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- }
-
- if (m_compiledProgram->projectionMatrixLocation() != -1) {
- TransformationMatrix projectionMatrix;
- orthogonalProjectionMatrix(projectionMatrix, -0.5, 0.5, -0.5, 0.5);
- float glProjectionMatrix[16];
- projectionMatrix.toColumnMajorFloatArray(glProjectionMatrix);
- m_context->uniformMatrix4fv(m_compiledProgram->projectionMatrixLocation(), 1, false, &glProjectionMatrix[0]);
- }
-
- ASSERT(m_meshColumns);
- ASSERT(m_meshRows);
-
- if (m_compiledProgram->meshSizeLocation() != -1)
- m_context->uniform2f(m_compiledProgram->meshSizeLocation(), m_meshColumns, m_meshRows);
-
- if (m_compiledProgram->tileSizeLocation() != -1)
- m_context->uniform2f(m_compiledProgram->tileSizeLocation(), 1.0 / m_meshColumns, 1.0 / m_meshRows);
-
- if (m_compiledProgram->meshBoxLocation() != -1) {
- // FIXME: This will change when filter margins will be implemented,
- // see https://bugs.webkit.org/show_bug.cgi?id=71400
- m_context->uniform4f(m_compiledProgram->meshBoxLocation(), -0.5, -0.5, 1.0, 1.0);
- }
-
- if (m_compiledProgram->samplerSizeLocation() != -1)
- m_context->uniform2f(m_compiledProgram->samplerSizeLocation(), m_contextSize.width(), m_contextSize.height());
-
- m_context->bindBuffer(GL_ARRAY_BUFFER, m_mesh->verticesBufferObject());
- m_context->bindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_mesh->elementsBufferObject());
-
- bindVertexAttribute(m_compiledProgram->positionAttribLocation(), PositionAttribSize, PositionAttribOffset);
- bindVertexAttribute(m_compiledProgram->texAttribLocation(), TexAttribSize, TexAttribOffset);
- bindVertexAttribute(m_compiledProgram->meshAttribLocation(), MeshAttribSize, MeshAttribOffset);
- if (m_meshType == MeshTypeDetached)
- bindVertexAttribute(m_compiledProgram->triangleAttribLocation(), TriangleAttribSize, TriangleAttribOffset);
-
- bindProgramParameters();
-}
-
-void CustomFilterRenderer::unbindVertexAttributes()
-{
- unbindVertexAttribute(m_compiledProgram->positionAttribLocation());
- unbindVertexAttribute(m_compiledProgram->texAttribLocation());
- unbindVertexAttribute(m_compiledProgram->meshAttribLocation());
- if (m_meshType == MeshTypeDetached)
- unbindVertexAttribute(m_compiledProgram->triangleAttribLocation());
-}
-
-} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterRenderer.h b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterRenderer.h
deleted file mode 100644
index 059fc42a448..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterRenderer.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
- * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
- * Copyright (C) 2012 Company 100, 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 THE COPYRIGHT HOLDER “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 HOLDER 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 CustomFilterRenderer_h
-#define CustomFilterRenderer_h
-
-#include "platform/geometry/IntSize.h"
-#include "platform/graphics/GraphicsTypes3D.h"
-#include "platform/graphics/filters/custom/CustomFilterConstants.h"
-#include "platform/graphics/filters/custom/CustomFilterParameterList.h"
-#include "wtf/RefCounted.h"
-#include "wtf/RefPtr.h"
-
-namespace WebCore {
-
-class CustomFilterArrayParameter;
-class CustomFilterCompiledProgram;
-class CustomFilterMesh;
-class CustomFilterNumberParameter;
-class CustomFilterTransformParameter;
-class GraphicsContext3D;
-
-class CustomFilterRenderer : public RefCounted<CustomFilterRenderer> {
-public:
- static PassRefPtr<CustomFilterRenderer> create(PassRefPtr<GraphicsContext3D>, CustomFilterProgramType, const CustomFilterParameterList&,
- unsigned meshRows, unsigned meshColumns, CustomFilterMeshType);
- ~CustomFilterRenderer();
-
- bool premultipliedAlpha() const;
- bool programNeedsInputTexture() const;
-
- bool prepareForDrawing();
-
- void draw(Platform3DObject, const IntSize&);
-
- CustomFilterCompiledProgram* compiledProgram() const { return m_compiledProgram.get(); }
- void setCompiledProgram(PassRefPtr<CustomFilterCompiledProgram>);
-
-private:
- CustomFilterRenderer(PassRefPtr<GraphicsContext3D>, CustomFilterProgramType, const CustomFilterParameterList&,
- unsigned meshRows, unsigned meshColumns, CustomFilterMeshType);
-
- void initializeCompiledProgramIfNeeded();
- void initializeMeshIfNeeded();
-
- void bindVertexAttribute(int attributeLocation, unsigned size, unsigned offset);
- void unbindVertexAttribute(int attributeLocation);
- void bindProgramArrayParameters(int uniformLocation, CustomFilterArrayParameter*);
- void bindProgramNumberParameters(int uniformLocation, CustomFilterNumberParameter*);
- void bindProgramTransformParameter(int uniformLocation, CustomFilterTransformParameter*);
- void bindProgramParameters();
- void bindProgramAndBuffers(Platform3DObject inputTexture);
- void unbindVertexAttributes();
-
- RefPtr<GraphicsContext3D> m_context;
- RefPtr<CustomFilterCompiledProgram> m_compiledProgram;
- CustomFilterProgramType m_programType;
- RefPtr<CustomFilterMesh> m_mesh;
- IntSize m_contextSize;
-
- CustomFilterParameterList m_parameters;
-
- unsigned m_meshRows;
- unsigned m_meshColumns;
- CustomFilterMeshType m_meshType;
-};
-
-} // namespace WebCore
-
-#endif // CustomFilterRenderer_h
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterTransformParameter.cpp b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterTransformParameter.cpp
deleted file mode 100644
index 317130288e1..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterTransformParameter.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER “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 HOLDER 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"
-#include "platform/graphics/filters/custom/CustomFilterTransformParameter.h"
-
-#include "platform/geometry/FloatSize.h"
-
-namespace WebCore {
-
-PassRefPtr<CustomFilterParameter> CustomFilterTransformParameter::blend(const CustomFilterParameter* fromParameter, double progress)
-{
- if (!fromParameter || !isSameType(*fromParameter))
- return this;
-
- const CustomFilterTransformParameter* fromTransformParameter = static_cast<const CustomFilterTransformParameter*>(fromParameter);
- const TransformOperations& from = fromTransformParameter->operations();
- const TransformOperations& to = operations();
- if (from == to)
- return this;
-
- RefPtr<CustomFilterTransformParameter> result = CustomFilterTransformParameter::create(name());
- if (from.size() && to.size())
- result->setOperations(to.blend(from, progress));
- else
- result->setOperations(progress > 0.5 ? to : from);
- return result;
-}
-
-bool CustomFilterTransformParameter::operator==(const CustomFilterParameter& o) const
-{
- if (!isSameType(o))
- return false;
- const CustomFilterTransformParameter* other = static_cast<const CustomFilterTransformParameter*>(&o);
- return m_operations == other->m_operations;
-}
-
-void CustomFilterTransformParameter::applyTransform(TransformationMatrix& transform, const FloatSize& boxSize) const
-{
- for (unsigned i = 0, size = m_operations.size(); i < size; ++i)
- m_operations.at(i)->apply(transform, boxSize);
-}
-
-} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterTransformParameter.h b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterTransformParameter.h
deleted file mode 100644
index 62dc58e05ea..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterTransformParameter.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER “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 HOLDER 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 CustomFilterTransformParameter_h
-#define CustomFilterTransformParameter_h
-
-#include "platform/PlatformExport.h"
-#include "platform/graphics/filters/custom/CustomFilterParameter.h"
-#include "platform/transforms/TransformOperations.h"
-
-namespace WebCore {
-
-class FloatSize;
-class TransformationMatrix;
-
-class PLATFORM_EXPORT CustomFilterTransformParameter : public CustomFilterParameter {
-public:
- static PassRefPtr<CustomFilterTransformParameter> create(const String& name)
- {
- return adoptRef(new CustomFilterTransformParameter(name));
- }
-
- virtual PassRefPtr<CustomFilterParameter> blend(const CustomFilterParameter* fromParameter, double progress);
-
- virtual bool operator==(const CustomFilterParameter&) const;
-
- void applyTransform(TransformationMatrix&, const FloatSize& boxSize) const;
-
- const TransformOperations& operations() const { return m_operations; }
- void setOperations(const TransformOperations& value) { m_operations = value; }
-
-private:
- CustomFilterTransformParameter(const String& name)
- : CustomFilterParameter(Transform, name)
- {
- }
- virtual ~CustomFilterTransformParameter()
- {
- }
-
- TransformOperations m_operations;
-};
-
-} // namespace WebCore
-
-#endif // CustomFilterTransformParameter_h
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterValidatedProgram.cpp b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterValidatedProgram.cpp
deleted file mode 100644
index 63e384383be..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterValidatedProgram.cpp
+++ /dev/null
@@ -1,617 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER “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 HOLDER 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"
-#include "platform/graphics/filters/custom/CustomFilterValidatedProgram.h"
-
-#include "platform/NotImplemented.h"
-#include "platform/graphics/angle/ANGLEPlatformBridge.h"
-#include "platform/graphics/filters/custom/CustomFilterConstants.h"
-#include "platform/graphics/filters/custom/CustomFilterGlobalContext.h"
-#include "wtf/HashMap.h"
-#include "wtf/Vector.h"
-#include "wtf/text/StringBuilder.h"
-#include "wtf/text/StringHash.h"
-
-namespace WebCore {
-
-#define SHADER(Src) (#Src)
-
-typedef HashMap<String, ShDataType> SymbolNameToTypeMap;
-
-static SymbolNameToTypeMap* builtInAttributeNameToTypeMap()
-{
- static SymbolNameToTypeMap* nameToTypeMap = 0;
- if (!nameToTypeMap) {
- nameToTypeMap = new SymbolNameToTypeMap;
- nameToTypeMap->set("a_meshCoord", SH_FLOAT_VEC2);
- nameToTypeMap->set("a_position", SH_FLOAT_VEC4);
- nameToTypeMap->set("a_texCoord", SH_FLOAT_VEC2);
- nameToTypeMap->set("a_triangleCoord", SH_FLOAT_VEC3);
- }
- return nameToTypeMap;
-}
-
-static SymbolNameToTypeMap* builtInUniformNameToTypeMap()
-{
- static SymbolNameToTypeMap* nameToTypeMap = 0;
- if (!nameToTypeMap) {
- nameToTypeMap = new SymbolNameToTypeMap;
- nameToTypeMap->set("u_meshBox", SH_FLOAT_VEC4);
- nameToTypeMap->set("u_meshSize", SH_FLOAT_VEC2);
- nameToTypeMap->set("u_projectionMatrix", SH_FLOAT_MAT4);
- nameToTypeMap->set("u_textureSize", SH_FLOAT_VEC2);
- nameToTypeMap->set("u_tileSize", SH_FLOAT_VEC2);
- }
- return nameToTypeMap;
-}
-
-static bool validateSymbols(const Vector<ANGLEShaderSymbol>& symbols, CustomFilterMeshType meshType)
-{
- for (size_t i = 0; i < symbols.size(); ++i) {
- const ANGLEShaderSymbol& symbol = symbols[i];
- switch (symbol.symbolType) {
- case SHADER_SYMBOL_TYPE_ATTRIBUTE: {
- SymbolNameToTypeMap* attributeNameToTypeMap = builtInAttributeNameToTypeMap();
- SymbolNameToTypeMap::iterator builtInAttribute = attributeNameToTypeMap->find(symbol.name);
- if (builtInAttribute == attributeNameToTypeMap->end()) {
- // The author defined a custom attribute.
- // FIXME: Report the validation error.
- // https://bugs.webkit.org/show_bug.cgi?id=74416
- return false;
- }
- if (meshType == MeshTypeAttached && symbol.name == "a_triangleCoord") {
- // a_triangleCoord is only available for detached meshes.
- // FIXME: Report the validation error.
- // https://bugs.webkit.org/show_bug.cgi?id=74416
- return false;
- }
- if (symbol.dataType != builtInAttribute->value) {
- // The author defined one of the built-in attributes with the wrong type.
- // FIXME: Report the validation error.
- // https://bugs.webkit.org/show_bug.cgi?id=74416
- return false;
- }
- break;
- }
- case SHADER_SYMBOL_TYPE_UNIFORM: {
- if (symbol.isSampler()) {
- // FIXME: For now, we restrict shaders with any sampler defined.
- // When we implement texture parameters, we will allow shaders whose samplers are bound to valid textures.
- // We must not allow OpenGL to give unbound samplers a default value of 0 because that references the element texture,
- // which should be inaccessible to the author's shader code.
- // https://bugs.webkit.org/show_bug.cgi?id=96230
- return false;
- }
-
- SymbolNameToTypeMap* uniformNameToTypeMap = builtInUniformNameToTypeMap();
- SymbolNameToTypeMap::iterator builtInUniform = uniformNameToTypeMap->find(symbol.name);
- if (builtInUniform != uniformNameToTypeMap->end() && (symbol.isArray || symbol.dataType != builtInUniform->value)) {
- // The author defined one of the built-in uniforms with the wrong type.
- // FIXME: Report the validation error.
- // https://bugs.webkit.org/show_bug.cgi?id=74416
- return false;
- }
- break;
- }
- default:
- ASSERT_NOT_REACHED();
- break;
- }
- }
-
- return true;
-}
-
-String CustomFilterValidatedProgram::defaultVertexShaderString()
-{
- DEFINE_STATIC_LOCAL(String, vertexShaderString, (SHADER(
- attribute mediump vec4 a_position;
- uniform mediump mat4 u_projectionMatrix;
-
- void main()
- {
- gl_Position = u_projectionMatrix * a_position;
- }
- )));
- return vertexShaderString;
-}
-
-String CustomFilterValidatedProgram::defaultFragmentShaderString()
-{
- DEFINE_STATIC_LOCAL(String, fragmentShaderString, (SHADER(
- void main()
- {
- }
- )));
- return fragmentShaderString;
-}
-
-CustomFilterValidatedProgram::CustomFilterValidatedProgram(CustomFilterGlobalContext* globalContext, const CustomFilterProgramInfo& programInfo)
- : m_globalContext(globalContext)
- , m_programInfo(programInfo)
- , m_isInitialized(false)
-{
- platformInit();
-
- String originalVertexShader = programInfo.vertexShaderString();
- if (originalVertexShader.isNull())
- originalVertexShader = defaultVertexShaderString();
-
- String originalFragmentShader = programInfo.fragmentShaderString();
- if (originalFragmentShader.isNull())
- originalFragmentShader = defaultFragmentShaderString();
-
- // Shaders referenced from the CSS mix function use a different validator than regular WebGL shaders. See core/platform/graphics/filters/custom/CustomFilterGlobalContext.h for more details.
- bool blendsElementTexture = (programInfo.programType() == ProgramTypeBlendsElementTexture);
- ANGLEPlatformBridge* validator = blendsElementTexture ? m_globalContext->mixShaderValidator() : m_globalContext->webglShaderValidator();
- String vertexShaderLog, fragmentShaderLog;
- Vector<ANGLEShaderSymbol> symbols;
- bool vertexShaderValid = validator->compileShaderSource(originalVertexShader.utf8().data(), SHADER_TYPE_VERTEX, m_validatedVertexShader, vertexShaderLog, symbols);
- bool fragmentShaderValid = validator->compileShaderSource(originalFragmentShader.utf8().data(), SHADER_TYPE_FRAGMENT, m_validatedFragmentShader, fragmentShaderLog, symbols);
- if (!vertexShaderValid || !fragmentShaderValid) {
- // FIXME: Report the validation errors.
- // https://bugs.webkit.org/show_bug.cgi?id=74416
- return;
- }
-
- if (!validateSymbols(symbols, m_programInfo.meshType())) {
- // FIXME: Report validation errors.
- // https://bugs.webkit.org/show_bug.cgi?id=74416
- return;
- }
-
- // We need to add texture access, blending, and compositing code to shaders that are referenced from the CSS mix function.
- if (blendsElementTexture) {
- rewriteMixVertexShader(symbols);
- rewriteMixFragmentShader();
- }
-
- m_isInitialized = true;
-}
-
-PassRefPtr<CustomFilterCompiledProgram> CustomFilterValidatedProgram::compiledProgram()
-{
- ASSERT(m_isInitialized && m_globalContext && !m_validatedVertexShader.isNull() && !m_validatedFragmentShader.isNull());
- if (!m_compiledProgram) {
- m_compiledProgram = CustomFilterCompiledProgram::create(m_globalContext->context(), m_validatedVertexShader, m_validatedFragmentShader, m_programInfo.programType());
- ASSERT(m_compiledProgram->isInitialized());
- ASSERT(m_compiledProgram->samplerLocation() != -1 || !needsInputTexture());
- }
- return m_compiledProgram;
-}
-
-bool CustomFilterValidatedProgram::needsInputTexture() const
-{
- return m_programInfo.programType() == ProgramTypeBlendsElementTexture
- && m_programInfo.mixSettings().compositeOperator != CompositeClear
- && m_programInfo.mixSettings().compositeOperator != CompositeCopy;
-}
-
-void CustomFilterValidatedProgram::rewriteMixVertexShader(const Vector<ANGLEShaderSymbol>& symbols)
-{
- ASSERT(m_programInfo.programType() == ProgramTypeBlendsElementTexture);
-
- // If the author defined a_texCoord, we can use it to shuttle the texture coordinate to the fragment shader.
- // Note that vertex attributes are read-only in GLSL, so the author could not have changed a_texCoord's value.
- // Also, note that we would have already rejected the shader if the author defined a_texCoord with the wrong type.
- bool texCoordAttributeDefined = false;
- for (size_t i = 0; i < symbols.size(); ++i) {
- if (symbols[i].name == "a_texCoord")
- texCoordAttributeDefined = true;
- }
-
- if (!texCoordAttributeDefined)
- m_validatedVertexShader.append("attribute mediump vec2 a_texCoord;");
-
- // During validation, ANGLE renamed the author's "main" function to "css_main".
- // We write our own "main" function and call "css_main" from it.
- // This makes rewriting easy and ensures that our code runs after all author code.
- m_validatedVertexShader.append(SHADER(
- varying mediump vec2 css_v_texCoord;
-
- void main()
- {
- css_main();
- css_v_texCoord = a_texCoord;
- }
- ));
-}
-
-void CustomFilterValidatedProgram::rewriteMixFragmentShader()
-{
- ASSERT(m_programInfo.programType() == ProgramTypeBlendsElementTexture);
-
- StringBuilder builder;
- // ANGLE considered these symbols as built-ins during validation under the SH_CSS_SHADERS_SPEC flag.
- // Now, we have to define these symbols in order to make this shader valid GLSL.
- // We define these symbols before the author's shader code, which makes them accessible to author code.
- builder.append(SHADER(
- mediump vec4 css_MixColor = vec4(0.0);
- mediump mat4 css_ColorMatrix = mat4(1.0);
- ));
- builder.append(m_validatedFragmentShader);
- builder.append(blendFunctionString(m_programInfo.mixSettings().blendMode));
- builder.append(compositeFunctionString(m_programInfo.mixSettings().compositeOperator));
- // We define symbols like "css_u_texture" after the author's shader code, which makes them inaccessible to author code.
- // In particular, "css_u_texture" represents the DOM element texture, so it's important to keep it inaccessible to
- // author code for security reasons.
- builder.append(SHADER(
- uniform sampler2D css_u_texture;
- varying mediump vec2 css_v_texCoord;
-
- void main()
- {
- css_main();
- mediump vec4 originalColor = texture2D(css_u_texture, css_v_texCoord);
- mediump vec4 multipliedColor = clamp(css_ColorMatrix * originalColor, 0.0, 1.0);
- mediump vec4 clampedMixColor = clamp(css_MixColor, 0.0, 1.0);
- mediump vec3 blendedColor = css_BlendColor(multipliedColor.rgb, clampedMixColor.rgb);
- mediump vec3 weightedColor = (1.0 - multipliedColor.a) * clampedMixColor.rgb + multipliedColor.a * blendedColor;
- gl_FragColor = css_Composite(multipliedColor.rgb, multipliedColor.a, weightedColor.rgb, clampedMixColor.a);
- }
- ));
- m_validatedFragmentShader = builder.toString();
-}
-
-String CustomFilterValidatedProgram::blendFunctionString(blink::WebBlendMode blendMode)
-{
- // Implemented using the same symbol names as the Compositing and Blending spec:
- // https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#blendingnormal
- // Cs: is the source color in css_BlendColor() and the source color component in css_BlendComponent()
- // Cb: is the backdrop color in css_BlendColor() and the backdrop color component in css_BlendComponent()
- const char* blendColorExpression = "vec3(css_BlendComponent(Cb.r, Cs.r), css_BlendComponent(Cb.g, Cs.g), css_BlendComponent(Cb.b, Cs.b))";
- const char* blendComponentExpression = "Co = 0.0;";
- bool needsLuminosityHelperFunctions = false;
- bool needsSaturationHelperFunctions = false;
- String blendFunctionString;
- switch (blendMode) {
- case blink::WebBlendModeNormal:
- blendColorExpression = "Cs";
- break;
- case blink::WebBlendModeMultiply:
- blendColorExpression = "Cs * Cb";
- break;
- case blink::WebBlendModeScreen:
- blendColorExpression = "Cb + Cs - (Cb * Cs)";
- break;
- case blink::WebBlendModeDarken:
- blendColorExpression = "min(Cb, Cs)";
- break;
- case blink::WebBlendModeLighten:
- blendColorExpression = "max(Cb, Cs)";
- break;
- case blink::WebBlendModeDifference:
- blendColorExpression = "abs(Cb - Cs)";
- break;
- case blink::WebBlendModeExclusion:
- blendColorExpression = "Cb + Cs - 2.0 * Cb * Cs";
- break;
- case blink::WebBlendModeOverlay:
- /*
- Co = HardLight(Cs, Cb)
- = if(Cb <= 0.5)
- Multiply(Cs, 2 x Cb)
- else
- Screen(Cs, 2 x Cb - 1)
- = if(Cb <= 0.5)
- Cs x (2 x Cb)
- else
- Cs + (2 x Cb - 1) - (Cs x (2 x Cb - 1))
- */
- blendComponentExpression = SHADER(
- if (Cb <= 0.5)
- Co = Cs * (2.0 * Cb);
- else
- Co = Cs + (2.0 * Cb - 1.0) - (Cs * (2.0 * Cb - 1.0));
- );
- break;
- case blink::WebBlendModeColorDodge:
- /*
- Co = if(Cs < 1)
- min(1, Cb / (1 - Cs))
- else
- 1
- */
- blendComponentExpression = SHADER(
- if (Cs < 1.0)
- Co = min(1.0, Cb / (1.0 - Cs));
- else
- Co = 1.0;
- );
- break;
- case blink::WebBlendModeColorBurn:
- /*
- Co = if(Cs > 0)
- 1 - min(1, (1 - Cb) / Cs)
- else
- 0
- */
- blendComponentExpression = SHADER(
- if (Cs > 0.0)
- Co = 1.0 - min(1.0, (1.0 - Cb) / Cs);
- else
- Co = 0.0;
- );
- break;
- case blink::WebBlendModeHardLight:
- /*
- Co = if(Cs <= 0.5)
- Multiply(Cb, 2 x Cs)
- else
- Screen(Cb, 2 x Cs -1)
- = if(Cs <= 0.5)
- Cb x (2 x Cs)
- else
- Cb + (2 x Cs - 1) - (Cb x (2 x Cs - 1))
- */
- blendComponentExpression = SHADER(
- if (Cs <= 0.5)
- Co = Cb * (2.0 * Cs);
- else
- Co = Cb + (2.0 * Cs - 1.0) - (Cb * (2.0 * Cs - 1.0));
- );
- break;
- case blink::WebBlendModeSoftLight:
- /*
- Co = if(Cs <= 0.5)
- Cb - (1 - 2 x Cs) x Cb x (1 - Cb)
- else
- Cb + (2 x Cs - 1) x (D(Cb) - Cb)
-
- with
-
- D(Cb) = if(Cb <= 0.25)
- (16 * Cb - 12) x Cb + 4) x Cb
- else
- sqrt(Cb)
- */
- blendComponentExpression = SHADER(
- mediump float D;
- if (Cb <= 0.25)
- D = ((16.0 * Cb - 12.0) * Cb + 4.0) * Cb;
- else
- D = sqrt(Cb);
-
- if (Cs <= 0.5)
- Co = Cb - (1.0 - 2.0 * Cs) * Cb * (1.0 - Cb);
- else
- Co = Cb + (2.0 * Cs - 1.0) * (D - Cb);
- );
- break;
- case blink::WebBlendModeColor:
- needsLuminosityHelperFunctions = true;
- blendColorExpression = "css_SetLum(Cs, css_Lum(Cb))";
- break;
- case blink::WebBlendModeLuminosity:
- needsLuminosityHelperFunctions = true;
- blendColorExpression = "css_SetLum(Cb, css_Lum(Cs))";
- break;
- case blink::WebBlendModeHue:
- needsLuminosityHelperFunctions = true;
- needsSaturationHelperFunctions = true;
- blendColorExpression = "css_SetLum(css_SetSat(Cs, css_Sat(Cb)), css_Lum(Cb))";
- break;
- case blink::WebBlendModeSaturation:
- needsLuminosityHelperFunctions = true;
- needsSaturationHelperFunctions = true;
- blendColorExpression = "css_SetLum(css_SetSat(Cb, css_Sat(Cs)), css_Lum(Cb))";
- break;
- default:
- ASSERT_NOT_REACHED();
- }
-
- if (needsLuminosityHelperFunctions) {
- blendFunctionString.append(SHADER(
- mediump float css_Lum(mediump vec3 C)
- {
- return 0.3 * C.r + 0.59 * C.g + 0.11 * C.b;
- }
- mediump vec3 css_ClipColor(mediump vec3 C)
- {
- mediump float L = css_Lum(C);
- mediump float n = min(min(C.r, C.g), C.b);
- mediump float x = max(max(C.r, C.g), C.b);
- if (n < 0.0)
- C = L + (((C - L) * L) / (L - n));
- if (x > 1.0)
- C = L + (((C - L) * (1.0 - L) / (x - L)));
- return C;
- }
- mediump vec3 css_SetLum(mediump vec3 C, mediump float l)
- {
- C += l - css_Lum(C);
- return css_ClipColor(C);
- }
- ));
- }
-
- if (needsSaturationHelperFunctions) {
- blendFunctionString.append(SHADER(
- mediump float css_Sat(mediump vec3 C)
- {
- mediump float cMin = min(min(C.r, C.g), C.b);
- mediump float cMax = max(max(C.r, C.g), C.b);
- return cMax - cMin;
- }
- void css_SetSatHelper(inout mediump float cMin, inout mediump float cMid, inout mediump float cMax, mediump float s)
- {
- if (cMax > cMin) {
- cMid = (((cMid - cMin) * s) / (cMax - cMin));
- cMax = s;
- } else {
- cMid = cMax = 0.0;
- }
- cMin = 0.0;
- }
- mediump vec3 css_SetSat(mediump vec3 C, mediump float s)
- {
- if (C.r <= C.g) {
- if (C.g <= C.b) {
- css_SetSatHelper(C.r, C.g, C.b, s);
- } else {
- if (C.r <= C.b)
- css_SetSatHelper(C.r, C.b, C.g, s);
- else
- css_SetSatHelper(C.b, C.r, C.g, s);
- }
- } else {
- if (C.r <= C.b) {
- css_SetSatHelper(C.g, C.r, C.b, s);
- } else {
- if (C.g <= C.b)
- css_SetSatHelper(C.g, C.b, C.r, s);
- else
- css_SetSatHelper(C.b, C.g, C.r, s);
- }
- }
- return C;
- }
- ));
- }
-
- blendFunctionString.append(String::format(SHADER(
- mediump float css_BlendComponent(mediump float Cb, mediump float Cs)
- {
- mediump float Co;
- %s
- return Co;
- }
- mediump vec3 css_BlendColor(mediump vec3 Cb, mediump vec3 Cs)
- {
- return %s;
- }
- ), blendComponentExpression, blendColorExpression));
-
- return blendFunctionString;
-}
-
-String CustomFilterValidatedProgram::compositeFunctionString(CompositeOperator compositeOperator)
-{
- // Use the same symbol names as the Compositing and Blending spec:
- // https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#blendingnormal
- // Cs: is the source color
- // Cb: is the backdrop color
- // as: is the source alpha
- // ab: is the backdrop alpha
- // Fa: is defined by the Porter Duff operator in use
- // Fb: is defined by the Porter Duff operator in use
- const char* Fa = 0;
- const char* Fb = 0;
- switch (compositeOperator) {
- case CompositeSourceAtop:
- Fa = "ab";
- Fb = "1.0 - as";
- break;
- case CompositeClear:
- Fa = "0.0";
- Fb = "0.0";
- break;
- case CompositeCopy:
- Fa = "1.0";
- Fb = "0.0";
- break;
- case CompositeSourceOver:
- Fa = "1.0";
- Fb = "1.0 - as";
- break;
- case CompositeSourceIn:
- Fa = "ab";
- Fb = "0.0";
- break;
- case CompositeSourceOut:
- Fa = "1.0 - ab";
- Fb = "0.0";
- break;
- case CompositeDestinationOver:
- Fa = "1.0 - ab";
- Fb = "1.0";
- break;
- case CompositeDestinationIn:
- Fa = "0.0";
- Fb = "as";
- break;
- case CompositeDestinationOut:
- Fa = "0.0";
- Fb = "1.0 - as";
- break;
- case CompositeDestinationAtop:
- Fa = "1.0 - ab";
- Fb = "as";
- break;
- case CompositeXOR:
- Fa = "1.0 - ab";
- Fb = "1.0 - as";
- break;
- case CompositePlusLighter:
- notImplemented();
- return String();
- default:
- // The CSS parser should not have accepted any other composite operators.
- ASSERT_NOT_REACHED();
- return String();
- }
-
- ASSERT(Fa && Fb);
- // Use the general formula for compositing, lifted from the spec:
- // https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#generalformula
- return String::format(SHADER(
- mediump vec4 css_Composite(mediump vec3 Cb, mediump float ab, mediump vec3 Cs, mediump float as)
- {
- mediump float Fa = %s;
- mediump float Fb = %s;
- return vec4(as * Fa * Cs + ab * Fb * Cb, as * Fa + ab * Fb);
- }
- ), Fa, Fb);
-}
-
-CustomFilterValidatedProgram::~CustomFilterValidatedProgram()
-{
- platformDestroy();
-
- if (m_globalContext)
- m_globalContext->removeValidatedProgram(this);
-}
-
-CustomFilterProgramInfo CustomFilterValidatedProgram::validatedProgramInfo() const
-{
- ASSERT(m_isInitialized);
- return CustomFilterProgramInfo(m_validatedVertexShader, m_validatedFragmentShader, m_programInfo.programType(), m_programInfo.mixSettings(), m_programInfo.meshType());
-}
-
-void CustomFilterValidatedProgram::platformInit()
-{
-}
-
-void CustomFilterValidatedProgram::platformDestroy()
-{
-}
-
-} // namespace WebCore
-
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterValidatedProgram.h b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterValidatedProgram.h
deleted file mode 100644
index fed78481ae8..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/CustomFilterValidatedProgram.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER “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 HOLDER 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 CustomFilterValidatedProgram_h
-#define CustomFilterValidatedProgram_h
-
-#include "platform/graphics/filters/custom/CustomFilterCompiledProgram.h"
-#include "platform/graphics/filters/custom/CustomFilterProgramInfo.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-#include "wtf/RefPtr.h"
-#include "wtf/text/WTFString.h"
-
-// PlatformCompiledProgram defines a type that is compatible with the framework used to implement accelerated compositing on a particular platform.
-namespace WebCore {
-
-struct ANGLEShaderSymbol;
-class CustomFilterCompiledProgram;
-class CustomFilterGlobalContext;
-
-//
-// A unique combination of vertex shader and fragment shader is only validated and compiled once.
-// All shaders are validated through ANGLE in CustomFilterValidatedProgram before being compiled by the GraphicsContext3D in CustomFilterCompiledProgram.
-// For shaders that use the CSS mix function, CustomFilterValidatedProgram adds shader code to perform DOM texture access, blending, and compositing.
-//
-// The CustomFilterGlobalContext caches the validated programs.
-// CustomFilterValidatedProgram owns a CustomFilterCompiledProgram if validation and compilation succeeds.
-// Thus, compiled programs are cached via their validated program owners.
-//
-// CustomFilterGlobalContext has a weak reference to the CustomFilterValidatedProgram.
-// Thus, the CustomFilterValidatedProgram destructor needs to notify the CustomFilterGlobalContext to remove the program from the cache.
-// FECustomFilter is the reference owner of the CustomFilterValidatedProgram.
-// Thus, a validated and compiled shader is only kept alive as long as there is at least one visible layer that applies the shader.
-//
-class PLATFORM_EXPORT CustomFilterValidatedProgram : public RefCounted<CustomFilterValidatedProgram> {
-public:
- static PassRefPtr<CustomFilterValidatedProgram> create(CustomFilterGlobalContext* globalContext, const CustomFilterProgramInfo& programInfo)
- {
- return adoptRef(new CustomFilterValidatedProgram(globalContext, programInfo));
- }
-
- ~CustomFilterValidatedProgram();
-
- const CustomFilterProgramInfo& programInfo() const { return m_programInfo; }
- CustomFilterProgramInfo validatedProgramInfo() const;
-
- PassRefPtr<CustomFilterCompiledProgram> compiledProgram();
-
- const String& validatedVertexShader() const
- {
- ASSERT(m_isInitialized);
- return m_validatedVertexShader;
- }
-
- const String& validatedFragmentShader() const
- {
- ASSERT(m_isInitialized);
- return m_validatedFragmentShader;
- }
-
- bool isInitialized() const { return m_isInitialized; }
-
- // 'detachFromGlobalContext' is called when the CustomFilterGlobalContext is deleted, and there's no need for the callback anymore.
- // Note that CustomFilterGlobalContext does not keep a strong reference to the CustomFilterValidatedProgram.
- void detachFromGlobalContext() { m_globalContext = 0; }
-private:
- CustomFilterValidatedProgram(CustomFilterGlobalContext*, const CustomFilterProgramInfo&);
-
- void platformInit();
- void platformDestroy();
-
- static String defaultVertexShaderString();
- static String defaultFragmentShaderString();
-
- static String blendFunctionString(blink::WebBlendMode);
- static String compositeFunctionString(CompositeOperator);
-
- void rewriteMixVertexShader(const Vector<ANGLEShaderSymbol>& symbols);
- void rewriteMixFragmentShader();
-
- bool needsInputTexture() const;
-
- CustomFilterGlobalContext* m_globalContext;
- CustomFilterProgramInfo m_programInfo;
-
- String m_validatedVertexShader;
- String m_validatedFragmentShader;
-
- RefPtr<CustomFilterCompiledProgram> m_compiledProgram;
-
- bool m_isInitialized;
-};
-
-}
-
-
-#endif
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/FECustomFilter.cpp b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/FECustomFilter.cpp
deleted file mode 100644
index bcce901401a..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/FECustomFilter.cpp
+++ /dev/null
@@ -1,367 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
- * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
- * Copyright (C) 2013 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:
- *
- * 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 COPYRIGHT HOLDER “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 HOLDER 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"
-#include "platform/graphics/filters/custom/FECustomFilter.h"
-
-#include "platform/graphics/Extensions3D.h"
-#include "platform/graphics/GraphicsContext3D.h"
-#include "platform/graphics/filters/custom/CustomFilterRenderer.h"
-#include "platform/graphics/filters/custom/CustomFilterValidatedProgram.h"
-#include "platform/text/TextStream.h"
-#include "wtf/Uint8ClampedArray.h"
-
-namespace WebCore {
-
-FECustomFilter::FECustomFilter(Filter* filter, PassRefPtr<GraphicsContext3D> context, PassRefPtr<CustomFilterValidatedProgram> validatedProgram, const CustomFilterParameterList& parameters,
- unsigned meshRows, unsigned meshColumns, CustomFilterMeshType meshType)
- : FilterEffect(filter)
- , m_context(context)
- , m_validatedProgram(validatedProgram)
- , m_inputTexture(0)
- , m_frameBuffer(0)
- , m_depthBuffer(0)
- , m_destTexture(0)
- , m_triedMultisampleBuffer(false)
- , m_multisampleFrameBuffer(0)
- , m_multisampleRenderBuffer(0)
- , m_multisampleDepthBuffer(0)
-{
- // We will not pass a CustomFilterCompiledProgram here, as we only want to compile it when we actually need it in the first paint.
- m_customFilterRenderer = CustomFilterRenderer::create(m_context, m_validatedProgram->programInfo().programType(), parameters, meshRows, meshColumns, meshType);
-}
-
-PassRefPtr<FECustomFilter> FECustomFilter::create(Filter* filter, PassRefPtr<GraphicsContext3D> context, PassRefPtr<CustomFilterValidatedProgram> validatedProgram, const CustomFilterParameterList& parameters,
- unsigned meshRows, unsigned meshColumns, CustomFilterMeshType meshType)
-{
- return adoptRef(new FECustomFilter(filter, context, validatedProgram, parameters, meshRows, meshColumns, meshType));
-}
-
-FECustomFilter::~FECustomFilter()
-{
- deleteRenderBuffers();
-}
-
-void FECustomFilter::deleteRenderBuffers()
-{
- ASSERT(m_context);
- m_context->makeContextCurrent();
- if (m_inputTexture) {
- m_context->deleteTexture(m_inputTexture);
- m_inputTexture = 0;
- }
- if (m_frameBuffer) {
- // Make sure to unbind any framebuffer from the context first, otherwise
- // some platforms might refuse to bind the same buffer id again.
- m_context->bindFramebuffer(GL_FRAMEBUFFER, 0);
- m_context->deleteFramebuffer(m_frameBuffer);
- m_frameBuffer = 0;
- }
- if (m_depthBuffer) {
- m_context->deleteRenderbuffer(m_depthBuffer);
- m_depthBuffer = 0;
- }
- if (m_destTexture) {
- m_context->deleteTexture(m_destTexture);
- m_destTexture = 0;
- }
- deleteMultisampleRenderBuffers();
-}
-
-void FECustomFilter::deleteMultisampleRenderBuffers()
-{
- if (m_multisampleFrameBuffer) {
- // Make sure to unbind any framebuffer from the context first, otherwise
- // some platforms might refuse to bind the same buffer id again.
- m_context->bindFramebuffer(GL_FRAMEBUFFER, 0);
- m_context->deleteFramebuffer(m_multisampleFrameBuffer);
- m_multisampleFrameBuffer = 0;
- }
- if (m_multisampleRenderBuffer) {
- m_context->deleteRenderbuffer(m_multisampleRenderBuffer);
- m_multisampleRenderBuffer = 0;
- }
- if (m_multisampleDepthBuffer) {
- m_context->deleteRenderbuffer(m_multisampleDepthBuffer);
- m_multisampleDepthBuffer = 0;
- }
-}
-
-void FECustomFilter::applySoftware()
-{
- if (!applyShader())
- clearShaderResult();
-}
-
-void FECustomFilter::clearShaderResult()
-{
- clearResult();
- Uint8ClampedArray* dstPixelArray = createUnmultipliedImageResult();
- if (!dstPixelArray)
- return;
-
- FilterEffect* in = inputEffect(0);
- setIsAlphaImage(in->isAlphaImage());
- IntRect effectDrawingRect = requestedRegionOfInputImageData(in->absolutePaintRect());
- in->copyUnmultipliedImage(dstPixelArray, effectDrawingRect);
-}
-
-void FECustomFilter::drawFilterMesh(Platform3DObject inputTexture)
-{
- bool multisample = canUseMultisampleBuffers();
- m_context->bindFramebuffer(GL_FRAMEBUFFER, multisample ? m_multisampleFrameBuffer : m_frameBuffer);
- m_context->viewport(0, 0, m_contextSize.width(), m_contextSize.height());
-
- m_context->clearColor(0, 0, 0, 0);
- m_context->clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- m_customFilterRenderer->draw(inputTexture, m_contextSize);
-
- if (multisample)
- resolveMultisampleBuffer();
-}
-
-bool FECustomFilter::prepareForDrawing()
-{
- m_context->makeContextCurrent();
-
- // Lazily inject the compiled program into the CustomFilterRenderer.
- if (!m_customFilterRenderer->compiledProgram())
- m_customFilterRenderer->setCompiledProgram(m_validatedProgram->compiledProgram());
-
- if (!m_customFilterRenderer->prepareForDrawing())
- return false;
-
- // Only allocate a texture if the program needs one and the caller doesn't allocate one by itself.
- if ((m_customFilterRenderer->programNeedsInputTexture() && !ensureInputTexture()) || !ensureFrameBuffer())
- return false;
-
- return true;
-}
-
-bool FECustomFilter::applyShader()
-{
- Uint8ClampedArray* dstPixelArray = m_customFilterRenderer->premultipliedAlpha() ? createPremultipliedImageResult() : createUnmultipliedImageResult();
- if (!dstPixelArray)
- return false;
-
- if (!prepareForDrawing())
- return false;
-
- FilterEffect* in = inputEffect(0);
- IntRect effectDrawingRect = requestedRegionOfInputImageData(in->absolutePaintRect());
- IntSize newContextSize(effectDrawingRect.size());
- if (!resizeContextIfNeeded(newContextSize))
- return false;
-
- bool needsInputTexture = m_customFilterRenderer->programNeedsInputTexture();
- if (needsInputTexture) {
- RefPtr<Uint8ClampedArray> srcPixelArray = in->asUnmultipliedImage(effectDrawingRect);
- uploadInputTexture(srcPixelArray.get());
- }
- drawFilterMesh(needsInputTexture ? m_inputTexture : 0);
-
- ASSERT(static_cast<size_t>(newContextSize.width() * newContextSize.height() * 4) == dstPixelArray->length());
- m_context->readPixels(0, 0, newContextSize.width(), newContextSize.height(), GL_RGBA, GL_UNSIGNED_BYTE, dstPixelArray->data());
-
- return true;
-}
-
-bool FECustomFilter::ensureInputTexture()
-{
- if (!m_inputTexture)
- m_inputTexture = m_context->createTexture();
- return m_inputTexture;
-}
-
-void FECustomFilter::uploadInputTexture(Uint8ClampedArray* srcPixelArray)
-{
- m_context->bindTexture(GL_TEXTURE_2D, m_inputTexture);
- m_context->texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_contextSize.width(), m_contextSize.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, srcPixelArray->data());
-}
-
-bool FECustomFilter::ensureFrameBuffer()
-{
- if (!m_frameBuffer)
- m_frameBuffer = m_context->createFramebuffer();
- if (!m_depthBuffer)
- m_depthBuffer = m_context->createRenderbuffer();
- if (!m_destTexture)
- m_destTexture = m_context->createTexture();
- return m_frameBuffer && m_depthBuffer && m_destTexture;
-}
-
-bool FECustomFilter::createMultisampleBuffer()
-{
- ASSERT(!m_triedMultisampleBuffer);
- m_triedMultisampleBuffer = true;
-
- Extensions3D* extensions = m_context->extensions();
- if (!extensions
- || !extensions->supports("GL_ANGLE_framebuffer_multisample")
- || !extensions->supports("GL_ANGLE_framebuffer_blit")
- || !extensions->supports("GL_OES_rgb8_rgba8"))
- return false;
-
- extensions->ensureEnabled("GL_ANGLE_framebuffer_blit");
- extensions->ensureEnabled("GL_ANGLE_framebuffer_multisample");
- extensions->ensureEnabled("GL_OES_rgb8_rgba8");
-
- if (!m_multisampleFrameBuffer)
- m_multisampleFrameBuffer = m_context->createFramebuffer();
- if (!m_multisampleRenderBuffer)
- m_multisampleRenderBuffer = m_context->createRenderbuffer();
- if (!m_multisampleDepthBuffer)
- m_multisampleDepthBuffer = m_context->createRenderbuffer();
-
- return true;
-}
-
-void FECustomFilter::resolveMultisampleBuffer()
-{
- ASSERT(m_triedMultisampleBuffer && m_multisampleFrameBuffer && m_multisampleRenderBuffer && m_multisampleDepthBuffer);
- m_context->bindFramebuffer(Extensions3D::READ_FRAMEBUFFER, m_multisampleFrameBuffer);
- m_context->bindFramebuffer(Extensions3D::DRAW_FRAMEBUFFER, m_frameBuffer);
-
- ASSERT(m_context->extensions());
- m_context->extensions()->blitFramebuffer(0, 0, m_contextSize.width(), m_contextSize.height(), 0, 0, m_contextSize.width(), m_contextSize.height(), GL_COLOR_BUFFER_BIT, GL_NEAREST);
-
- m_context->bindFramebuffer(Extensions3D::READ_FRAMEBUFFER, 0);
- m_context->bindFramebuffer(Extensions3D::DRAW_FRAMEBUFFER, 0);
-
- m_context->bindFramebuffer(GL_FRAMEBUFFER, m_frameBuffer);
-}
-
-bool FECustomFilter::canUseMultisampleBuffers() const
-{
- return m_triedMultisampleBuffer && m_multisampleFrameBuffer && m_multisampleRenderBuffer && m_multisampleDepthBuffer;
-}
-
-bool FECustomFilter::resizeMultisampleBuffers(const IntSize& newContextSize)
-{
- if (!m_triedMultisampleBuffer && !createMultisampleBuffer())
- return false;
-
- if (!canUseMultisampleBuffers())
- return false;
-
- static const int kMaxSampleCount = 4;
- int maxSupportedSampleCount = 0;
- m_context->getIntegerv(Extensions3D::MAX_SAMPLES, &maxSupportedSampleCount);
- int sampleCount = std::min(kMaxSampleCount, maxSupportedSampleCount);
- if (!sampleCount) {
- deleteMultisampleRenderBuffers();
- return false;
- }
-
- Extensions3D* extensions = m_context->extensions();
- ASSERT(extensions);
-
- m_context->bindFramebuffer(GL_FRAMEBUFFER, m_multisampleFrameBuffer);
-
- m_context->bindRenderbuffer(GL_RENDERBUFFER, m_multisampleRenderBuffer);
- extensions->renderbufferStorageMultisample(GL_RENDERBUFFER, sampleCount, Extensions3D::RGBA8_OES, newContextSize.width(), newContextSize.height());
- m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, m_multisampleRenderBuffer);
-
- m_context->bindRenderbuffer(GL_RENDERBUFFER, m_multisampleDepthBuffer);
- extensions->renderbufferStorageMultisample(GL_RENDERBUFFER, sampleCount, GL_DEPTH_COMPONENT16, newContextSize.width(), newContextSize.height());
- m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_multisampleDepthBuffer);
-
- m_context->bindRenderbuffer(GL_RENDERBUFFER, 0);
-
- if (m_context->checkFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
- deleteMultisampleRenderBuffers();
- return false;
- }
-
- return true;
-}
-
-bool FECustomFilter::resizeContextIfNeeded(const IntSize& newContextSize)
-{
- if (newContextSize.isEmpty())
- return false;
- if (m_contextSize == newContextSize)
- return true;
-
- int maxTextureSize = 0;
- m_context->getIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
- if (newContextSize.height() > maxTextureSize || newContextSize.width() > maxTextureSize)
- return false;
-
- return resizeContext(newContextSize);
-}
-
-bool FECustomFilter::resizeContext(const IntSize& newContextSize)
-{
- bool multisample = resizeMultisampleBuffers(newContextSize);
-
- m_context->bindFramebuffer(GL_FRAMEBUFFER, m_frameBuffer);
- m_context->bindTexture(GL_TEXTURE_2D, m_destTexture);
- // We are going to clear the output buffer anyway, so we can safely initialize the destination texture with garbage data.
- // FIXME: GraphicsContext3D::texImage2DDirect is not implemented on Chromium.
- m_context->texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, newContextSize.width(), newContextSize.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
- m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_destTexture, 0);
-
- // We don't need the depth buffer for the texture framebuffer, if we already
- // have a multisample buffer.
- if (!multisample) {
- m_context->bindRenderbuffer(GL_RENDERBUFFER, m_depthBuffer);
- m_context->renderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, newContextSize.width(), newContextSize.height());
- m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthBuffer);
- }
-
- if (m_context->checkFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
- return false;
-
- if (multisample) {
- // Clear the framebuffer first, otherwise the first blit will fail.
- m_context->clearColor(0, 0, 0, 0);
- m_context->clear(GL_COLOR_BUFFER_BIT);
- }
-
- m_context->bindRenderbuffer(GL_RENDERBUFFER, 0);
-
- m_contextSize = newContextSize;
- return true;
-}
-
-TextStream& FECustomFilter::externalRepresentation(TextStream& ts, int indent) const
-{
- writeIndent(ts, indent);
- ts << "[feCustomFilter";
- FilterEffect::externalRepresentation(ts);
- ts << "]\n";
- inputEffect(0)->externalRepresentation(ts, indent + 1);
- return ts;
-}
-
-} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/FECustomFilter.h b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/FECustomFilter.h
deleted file mode 100644
index b2fb50b9d45..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/FECustomFilter.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
- * Copyright (C) 2013 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:
- *
- * 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 COPYRIGHT HOLDER “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 HOLDER 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 FECustomFilter_h
-#define FECustomFilter_h
-
-#include "platform/graphics/GraphicsTypes3D.h"
-#include "platform/graphics/filters/Filter.h"
-#include "platform/graphics/filters/FilterEffect.h"
-#include "platform/graphics/filters/custom/CustomFilterConstants.h"
-#include "platform/graphics/filters/custom/CustomFilterOperation.h"
-#include "wtf/RefPtr.h"
-
-namespace WebCore {
-
-class CustomFilterRenderer;
-class CustomFilterValidatedProgram;
-class GraphicsContext3D;
-class IntSize;
-
-class PLATFORM_EXPORT FECustomFilter : public FilterEffect {
-public:
- static PassRefPtr<FECustomFilter> create(Filter*, PassRefPtr<GraphicsContext3D>, PassRefPtr<CustomFilterValidatedProgram>, const CustomFilterParameterList&,
- unsigned meshRows, unsigned meshColumns, CustomFilterMeshType);
-
- virtual TextStream& externalRepresentation(TextStream&, int indention) const;
-
-private:
- FECustomFilter(Filter*, PassRefPtr<GraphicsContext3D>, PassRefPtr<CustomFilterValidatedProgram>, const CustomFilterParameterList&,
- unsigned meshRows, unsigned meshColumns, CustomFilterMeshType);
- ~FECustomFilter();
-
- virtual void applySoftware() OVERRIDE;
-
- bool applyShader();
- void clearShaderResult();
- bool initializeContext();
-
- bool prepareForDrawing();
-
- void drawFilterMesh(Platform3DObject inputTexture);
- bool ensureInputTexture();
- void uploadInputTexture(Uint8ClampedArray* srcPixelArray);
- bool resizeContextIfNeeded(const IntSize&);
- bool resizeContext(const IntSize&);
-
- bool canUseMultisampleBuffers() const;
- bool createMultisampleBuffer();
- bool resizeMultisampleBuffers(const IntSize&);
- void resolveMultisampleBuffer();
- void deleteMultisampleRenderBuffers();
-
- bool ensureFrameBuffer();
- void deleteRenderBuffers();
-
- RefPtr<GraphicsContext3D> m_context;
- RefPtr<CustomFilterValidatedProgram> m_validatedProgram;
- RefPtr<CustomFilterRenderer> m_customFilterRenderer;
- IntSize m_contextSize;
-
- Platform3DObject m_inputTexture;
- Platform3DObject m_frameBuffer;
- Platform3DObject m_depthBuffer;
- Platform3DObject m_destTexture;
-
- bool m_triedMultisampleBuffer;
- Platform3DObject m_multisampleFrameBuffer;
- Platform3DObject m_multisampleRenderBuffer;
- Platform3DObject m_multisampleDepthBuffer;
-};
-
-} // namespace WebCore
-
-#endif // FECustomFilter_h
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/ValidatedCustomFilterOperation.cpp b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/ValidatedCustomFilterOperation.cpp
deleted file mode 100644
index c01b3af9e67..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/ValidatedCustomFilterOperation.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER "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 HOLDER 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"
-#include "platform/graphics/filters/custom/ValidatedCustomFilterOperation.h"
-
-#include "platform/graphics/filters/custom/CustomFilterParameter.h"
-#include "platform/graphics/filters/custom/CustomFilterValidatedProgram.h"
-
-namespace WebCore {
-
-ValidatedCustomFilterOperation::ValidatedCustomFilterOperation(PassRefPtr<CustomFilterValidatedProgram> validatedProgram,
- const CustomFilterParameterList& sortedParameters, unsigned meshRows, unsigned meshColumns, CustomFilterMeshType meshType)
- : FilterOperation(VALIDATED_CUSTOM)
- , m_validatedProgram(validatedProgram)
- , m_parameters(sortedParameters)
- , m_meshRows(meshRows)
- , m_meshColumns(meshColumns)
- , m_meshType(meshType)
-{
-}
-
-ValidatedCustomFilterOperation::~ValidatedCustomFilterOperation()
-{
-}
-
-PassRefPtr<FilterOperation> ValidatedCustomFilterOperation::blend(const FilterOperation*, double) const
-{
- ASSERT_NOT_REACHED();
- return const_cast<ValidatedCustomFilterOperation*>(this);
-}
-
-} // namespace WebCore
-
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/ValidatedCustomFilterOperation.h b/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/ValidatedCustomFilterOperation.h
deleted file mode 100644
index 9542914869d..00000000000
--- a/chromium/third_party/WebKit/Source/platform/graphics/filters/custom/ValidatedCustomFilterOperation.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 COPYRIGHT HOLDER "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 HOLDER 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 ValidatedCustomFilterOperation_h
-#define ValidatedCustomFilterOperation_h
-
-#include "platform/graphics/filters/FilterOperation.h"
-#include "platform/graphics/filters/custom/CustomFilterConstants.h"
-#include "platform/graphics/filters/custom/CustomFilterParameterList.h"
-
-namespace WebCore {
-
-class CustomFilterValidatedProgram;
-
-class PLATFORM_EXPORT ValidatedCustomFilterOperation : public FilterOperation {
-public:
- static PassRefPtr<ValidatedCustomFilterOperation> create(PassRefPtr<CustomFilterValidatedProgram> validatedProgram,
- const CustomFilterParameterList& sortedParameters, unsigned meshRows, unsigned meshColumns, CustomFilterMeshType meshType)
- {
- return adoptRef(new ValidatedCustomFilterOperation(validatedProgram, sortedParameters, meshRows, meshColumns, meshType));
- }
-
- virtual ~ValidatedCustomFilterOperation();
-
- virtual bool affectsOpacity() const { return true; }
- virtual bool movesPixels() const { return true; }
-
-
- CustomFilterValidatedProgram* validatedProgram() const { return m_validatedProgram.get(); }
- const CustomFilterParameterList& parameters() const { return m_parameters; }
-
- unsigned meshRows() const { return m_meshRows; }
- unsigned meshColumns() const { return m_meshColumns; }
-
- CustomFilterMeshType meshType() const { return m_meshType; }
-
-private:
- virtual PassRefPtr<FilterOperation> blend(const FilterOperation* from, double progress) const OVERRIDE;
- virtual bool operator==(const FilterOperation& o) const
- {
- if (!isSameType(o))
- return false;
-
- const ValidatedCustomFilterOperation* other = static_cast<const ValidatedCustomFilterOperation*>(&o);
- return m_validatedProgram.get() == other->m_validatedProgram.get()
- && m_meshRows == other->m_meshRows
- && m_meshColumns == other->m_meshColumns
- && m_meshType == other->m_meshType
- && m_parameters == other->m_parameters;
- }
-
- ValidatedCustomFilterOperation(PassRefPtr<CustomFilterValidatedProgram>, const CustomFilterParameterList&, unsigned meshRows, unsigned meshColumns, CustomFilterMeshType);
-
- RefPtr<CustomFilterValidatedProgram> m_validatedProgram;
-
- CustomFilterParameterList m_parameters;
- unsigned m_meshRows;
- unsigned m_meshColumns;
- CustomFilterMeshType m_meshType;
-};
-
-DEFINE_FILTER_OPERATION_TYPE_CASTS(ValidatedCustomFilterOperation, VALIDATED_CUSTOM);
-
-} // namespace WebCore
-
-
-#endif // ValidatedCustomFilterOperation_h