Changeset 67929 in webkit


Ignore:
Timestamp:
Sep 21, 2010 12:36:13 AM (14 years ago)
Author:
krit@webkit.org
Message:

2010-09-21 Dirk Schulze <krit@webkit.org>

Reviewed by Nikolas Zimmermann.

SVG Filter cleanup
https://bugs.webkit.org/show_bug.cgi?id=45612

Second cleanup patch. Modified files to follow webkit style. Removed dependencies
to SVG of most of the filter effects and prepared them to move from WebCore/svg/graphics/filters
to WebCore/platform/graphics/filters/.
Renamed calculateDrawingIntRect and calculateDrawingRect to requestedRegionOfInputImageData and
drawingRegionOfInputImage to clarify the functionality and make both functions distinguishable.

  • platform/graphics/filters/FEBlend.cpp: (WebCore::FEBlend::apply):
  • platform/graphics/filters/FEBlend.h:
  • platform/graphics/filters/FEColorMatrix.cpp: (WebCore::FEColorMatrix::apply):
  • platform/graphics/filters/FEColorMatrix.h:
  • platform/graphics/filters/FEComponentTransfer.cpp: (WebCore::FEComponentTransfer::apply):
  • platform/graphics/filters/FEComponentTransfer.h: (WebCore::ComponentTransferFunction::ComponentTransferFunction):
  • platform/graphics/filters/FEComposite.cpp: (WebCore::FEComposite::apply):
  • platform/graphics/filters/FEComposite.h:
  • platform/graphics/filters/FEGaussianBlur.cpp: (WebCore::FEGaussianBlur::apply):
  • platform/graphics/filters/FEGaussianBlur.h:
  • platform/graphics/filters/Filter.h:
  • platform/graphics/filters/FilterEffect.cpp: (WebCore::FilterEffect::requestedRegionOfInputImageData): (WebCore::FilterEffect::drawingRegionOfInputImage): (WebCore::FilterEffect::effectContext):
  • platform/graphics/filters/FilterEffect.h:
  • platform/graphics/filters/ImageBufferFilter.cpp:
  • platform/graphics/filters/ImageBufferFilter.h:
  • platform/graphics/filters/SourceAlpha.cpp: (WebCore::SourceAlpha::apply):
  • platform/graphics/filters/SourceAlpha.h: (WebCore::SourceAlpha::isSourceInput): (WebCore::SourceAlpha::SourceAlpha):
  • platform/graphics/filters/SourceGraphic.cpp: (WebCore::SourceGraphic::apply):
  • platform/graphics/filters/SourceGraphic.h: (WebCore::SourceGraphic::isSourceInput): (WebCore::SourceGraphic::SourceGraphic):
  • rendering/RenderTreeAsText.cpp: (WebCore::hasFractions): (WebCore::operator<<):
  • rendering/RenderTreeAsText.h: (WebCore::operator<<):
  • rendering/SVGRenderTreeAsText.cpp:
  • rendering/SVGRenderTreeAsText.h:
  • svg/graphics/filters/SVGFEConvolveMatrix.cpp: (WebCore::FEConvolveMatrix::apply):
  • svg/graphics/filters/SVGFEConvolveMatrix.h:
  • svg/graphics/filters/SVGFEDiffuseLighting.cpp:
  • svg/graphics/filters/SVGFEDiffuseLighting.h:
  • svg/graphics/filters/SVGFEDisplacementMap.cpp: (WebCore::FEDisplacementMap::apply):
  • svg/graphics/filters/SVGFEDisplacementMap.h:
  • svg/graphics/filters/SVGFEFlood.cpp: (WebCore::FEFlood::apply): (WebCore::FEFlood::externalRepresentation):
  • svg/graphics/filters/SVGFEFlood.h:
  • svg/graphics/filters/SVGFEImage.cpp: (WebCore::FEImage::apply):
  • svg/graphics/filters/SVGFEImage.h:
  • svg/graphics/filters/SVGFELighting.cpp: (WebCore::FELighting::apply):
  • svg/graphics/filters/SVGFELighting.h:
  • svg/graphics/filters/SVGFEMerge.cpp: (WebCore::FEMerge::apply):
  • svg/graphics/filters/SVGFEMerge.h:
  • svg/graphics/filters/SVGFEMorphology.cpp: (WebCore::FEMorphology::apply):
  • svg/graphics/filters/SVGFEMorphology.h:
  • svg/graphics/filters/SVGFEOffset.cpp: (WebCore::FEOffset::apply):
  • svg/graphics/filters/SVGFEOffset.h:
  • svg/graphics/filters/SVGFESpecularLighting.cpp:
  • svg/graphics/filters/SVGFESpecularLighting.h:
  • svg/graphics/filters/SVGFETile.cpp: (WebCore::FETile::apply):
  • svg/graphics/filters/SVGFETile.h:
  • svg/graphics/filters/SVGFETurbulence.cpp: (WebCore::FETurbulence::apply):
  • svg/graphics/filters/SVGFETurbulence.h:
Location:
trunk/WebCore
Files:
48 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r67928 r67929  
     12010-09-21  Dirk Schulze  <krit@webkit.org>
     2
     3        Reviewed by Nikolas Zimmermann.
     4
     5        SVG Filter cleanup
     6        https://bugs.webkit.org/show_bug.cgi?id=45612
     7
     8        Second cleanup patch. Modified files to follow webkit style. Removed dependencies
     9        to SVG of most of the filter effects and prepared them to move from WebCore/svg/graphics/filters
     10        to WebCore/platform/graphics/filters/.
     11        Renamed calculateDrawingIntRect and calculateDrawingRect to requestedRegionOfInputImageData and
     12        drawingRegionOfInputImage to clarify the functionality and make both functions distinguishable.
     13
     14        * platform/graphics/filters/FEBlend.cpp:
     15        (WebCore::FEBlend::apply):
     16        * platform/graphics/filters/FEBlend.h:
     17        * platform/graphics/filters/FEColorMatrix.cpp:
     18        (WebCore::FEColorMatrix::apply):
     19        * platform/graphics/filters/FEColorMatrix.h:
     20        * platform/graphics/filters/FEComponentTransfer.cpp:
     21        (WebCore::FEComponentTransfer::apply):
     22        * platform/graphics/filters/FEComponentTransfer.h:
     23        (WebCore::ComponentTransferFunction::ComponentTransferFunction):
     24        * platform/graphics/filters/FEComposite.cpp:
     25        (WebCore::FEComposite::apply):
     26        * platform/graphics/filters/FEComposite.h:
     27        * platform/graphics/filters/FEGaussianBlur.cpp:
     28        (WebCore::FEGaussianBlur::apply):
     29        * platform/graphics/filters/FEGaussianBlur.h:
     30        * platform/graphics/filters/Filter.h:
     31        * platform/graphics/filters/FilterEffect.cpp:
     32        (WebCore::FilterEffect::requestedRegionOfInputImageData):
     33        (WebCore::FilterEffect::drawingRegionOfInputImage):
     34        (WebCore::FilterEffect::effectContext):
     35        * platform/graphics/filters/FilterEffect.h:
     36        * platform/graphics/filters/ImageBufferFilter.cpp:
     37        * platform/graphics/filters/ImageBufferFilter.h:
     38        * platform/graphics/filters/SourceAlpha.cpp:
     39        (WebCore::SourceAlpha::apply):
     40        * platform/graphics/filters/SourceAlpha.h:
     41        (WebCore::SourceAlpha::isSourceInput):
     42        (WebCore::SourceAlpha::SourceAlpha):
     43        * platform/graphics/filters/SourceGraphic.cpp:
     44        (WebCore::SourceGraphic::apply):
     45        * platform/graphics/filters/SourceGraphic.h:
     46        (WebCore::SourceGraphic::isSourceInput):
     47        (WebCore::SourceGraphic::SourceGraphic):
     48        * rendering/RenderTreeAsText.cpp:
     49        (WebCore::hasFractions):
     50        (WebCore::operator<<):
     51        * rendering/RenderTreeAsText.h:
     52        (WebCore::operator<<):
     53        * rendering/SVGRenderTreeAsText.cpp:
     54        * rendering/SVGRenderTreeAsText.h:
     55        * svg/graphics/filters/SVGFEConvolveMatrix.cpp:
     56        (WebCore::FEConvolveMatrix::apply):
     57        * svg/graphics/filters/SVGFEConvolveMatrix.h:
     58        * svg/graphics/filters/SVGFEDiffuseLighting.cpp:
     59        * svg/graphics/filters/SVGFEDiffuseLighting.h:
     60        * svg/graphics/filters/SVGFEDisplacementMap.cpp:
     61        (WebCore::FEDisplacementMap::apply):
     62        * svg/graphics/filters/SVGFEDisplacementMap.h:
     63        * svg/graphics/filters/SVGFEFlood.cpp:
     64        (WebCore::FEFlood::apply):
     65        (WebCore::FEFlood::externalRepresentation):
     66        * svg/graphics/filters/SVGFEFlood.h:
     67        * svg/graphics/filters/SVGFEImage.cpp:
     68        (WebCore::FEImage::apply):
     69        * svg/graphics/filters/SVGFEImage.h:
     70        * svg/graphics/filters/SVGFELighting.cpp:
     71        (WebCore::FELighting::apply):
     72        * svg/graphics/filters/SVGFELighting.h:
     73        * svg/graphics/filters/SVGFEMerge.cpp:
     74        (WebCore::FEMerge::apply):
     75        * svg/graphics/filters/SVGFEMerge.h:
     76        * svg/graphics/filters/SVGFEMorphology.cpp:
     77        (WebCore::FEMorphology::apply):
     78        * svg/graphics/filters/SVGFEMorphology.h:
     79        * svg/graphics/filters/SVGFEOffset.cpp:
     80        (WebCore::FEOffset::apply):
     81        * svg/graphics/filters/SVGFEOffset.h:
     82        * svg/graphics/filters/SVGFESpecularLighting.cpp:
     83        * svg/graphics/filters/SVGFESpecularLighting.h:
     84        * svg/graphics/filters/SVGFETile.cpp:
     85        (WebCore::FETile::apply):
     86        * svg/graphics/filters/SVGFETile.h:
     87        * svg/graphics/filters/SVGFETurbulence.cpp:
     88        (WebCore::FETurbulence::apply):
     89        * svg/graphics/filters/SVGFETurbulence.h:
     90
    1912010-09-20  Philippe Normand  <pnormand@igalia.com>
    292
  • trunk/WebCore/platform/graphics/filters/FEBlend.cpp

    r67847 r67929  
    11/*
    2    Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    3                  2004, 2005 Rob Buis <buis@kde.org>
    4                  2005 Eric Seidel <eric@webkit.org>
    5                  2009 Dirk Schulze <krit@webkit.org>
    6 
    7    This library is free software; you can redistribute it and/or
    8    modify it under the terms of the GNU Library General Public
    9    License as published by the Free Software Foundation; either
    10    version 2 of the License, or (at your option) any later version.
    11 
    12    This library is distributed in the hope that it will be useful,
    13    but WITHOUT ANY WARRANTY; without even the implied warranty of
    14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    15    Library General Public License for more details.
    16 
    17    You should have received a copy of the GNU Library General Public License
    18     aint with this library; see the file COPYING.LIB.  If not, write to
    19    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    20    Boston, MA 02110-1301, USA.
    21 */
     2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
     3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
     5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
     6 *
     7 * This library is free software; you can redistribute it and/or
     8 * modify it under the terms of the GNU Library General Public
     9 * License as published by the Free Software Foundation; either
     10 * version 2 of the License, or (at your option) any later version.
     11 *
     12 * This library is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     15 * Library General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU Library General Public License
     18 * along with this library; see the file COPYING.LIB.  If not, write to
     19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     20 * Boston, MA 02110-1301, USA.
     21 */
    2222
    2323#include "config.h"
     
    9999        return;
    100100
    101     if (!getEffectContext())
     101    if (!effectContext())
    102102        return;
    103103
    104     IntRect effectADrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates());
     104    IntRect effectADrawingRect = requestedRegionOfInputImageData(in->repaintRectInLocalCoordinates());
    105105    RefPtr<CanvasPixelArray> srcPixelArrayA(in->resultImage()->getPremultipliedImageData(effectADrawingRect)->data());
    106106
    107     IntRect effectBDrawingRect = calculateDrawingIntRect(in2->repaintRectInLocalCoordinates());
     107    IntRect effectBDrawingRect = requestedRegionOfInputImageData(in2->repaintRectInLocalCoordinates());
    108108    RefPtr<CanvasPixelArray> srcPixelArrayB(in2->resultImage()->getPremultipliedImageData(effectBDrawingRect)->data());
    109109
  • trunk/WebCore/platform/graphics/filters/FEBlend.h

    r67847 r67929  
    11/*
    2    Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    3                  2004, 2005 Rob Buis <buis@kde.org>
    4                  2005 Eric Seidel <eric@webkit.org>
    5 
    6    This library is free software; you can redistribute it and/or
    7    modify it under the terms of the GNU Library General Public
    8    License as published by the Free Software Foundation; either
    9    version 2 of the License, or (at your option) any later version.
    10 
    11    This library is distributed in the hope that it will be useful,
    12    but WITHOUT ANY WARRANTY; without even the implied warranty of
    13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    14    Library General Public License for more details.
    15 
    16    You should have received a copy of the GNU Library General Public License
    17     aint with this library; see the file COPYING.LIB.  If not, write to
    18    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    19    Boston, MA 02110-1301, USA.
    20 */
     2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
     3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
     5 *
     6 * This library is free software; you can redistribute it and/or
     7 * modify it under the terms of the GNU Library General Public
     8 * License as published by the Free Software Foundation; either
     9 * version 2 of the License, or (at your option) any later version.
     10 *
     11 * This library is distributed in the hope that it will be useful,
     12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     14 * Library General Public License for more details.
     15 *
     16 * You should have received a copy of the GNU Library General Public License
     17 * along with this library; see the file COPYING.LIB.  If not, write to
     18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     19 * Boston, MA 02110-1301, USA.
     20 */
    2121
    2222#ifndef FEBlend_h
     
    3030namespace WebCore {
    3131
    32     enum BlendModeType {
    33         FEBLEND_MODE_UNKNOWN = 0,
    34         FEBLEND_MODE_NORMAL  = 1,
    35         FEBLEND_MODE_MULTIPLY = 2,
    36         FEBLEND_MODE_SCREEN  = 3,
    37         FEBLEND_MODE_DARKEN  = 4,
    38         FEBLEND_MODE_LIGHTEN = 5
    39     };
     32enum BlendModeType {
     33    FEBLEND_MODE_UNKNOWN = 0,
     34    FEBLEND_MODE_NORMAL = 1,
     35    FEBLEND_MODE_MULTIPLY = 2,
     36    FEBLEND_MODE_SCREEN = 3,
     37    FEBLEND_MODE_DARKEN = 4,
     38    FEBLEND_MODE_LIGHTEN = 5
     39};
    4040
    41     class FEBlend : public FilterEffect {
    42     public:
    43         static PassRefPtr<FEBlend> create(BlendModeType);
     41class FEBlend : public FilterEffect {
     42public:
     43    static PassRefPtr<FEBlend> create(BlendModeType);
    4444
    45         BlendModeType blendMode() const;
    46         void setBlendMode(BlendModeType);
     45    BlendModeType blendMode() const;
     46    void setBlendMode(BlendModeType);
    4747
    48         void apply(Filter*);
    49         void dump();
    50         TextStream& externalRepresentation(TextStream&, int indent) const;
     48    virtual void apply(Filter*);
     49    virtual void dump();
    5150
    52     private:
    53         FEBlend(BlendModeType);
     51    virtual TextStream& externalRepresentation(TextStream&, int indention) const;
    5452
    55         BlendModeType m_mode;
    56     };
     53private:
     54    FEBlend(BlendModeType);
     55
     56    BlendModeType m_mode;
     57};
    5758
    5859} // namespace WebCore
  • trunk/WebCore/platform/graphics/filters/FEColorMatrix.cpp

    r67847 r67929  
    11/*
    2    Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    3                  2004, 2005 Rob Buis <buis@kde.org>
    4                  2005 Eric Seidel <eric@webkit.org>
    5                  2009 Dirk Schulze <krit@webkit.org>
    6 
    7    This library is free software; you can redistribute it and/or
    8    modify it under the terms of the GNU Library General Public
    9    License as published by the Free Software Foundation; either
    10    version 2 of the License, or (at your option) any later version.
    11 
    12    This library is distributed in the hope that it will be useful,
    13    but WITHOUT ANY WARRANTY; without even the implied warranty of
    14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    15    Library General Public License for more details.
    16 
    17    You should have received a copy of the GNU Library General Public License
    18     aint with this library; see the file COPYING.LIB.  If not, write to
    19    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    20    Boston, MA 02110-1301, USA.
    21 */
     2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
     3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
     5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
     6 *
     7 * This library is free software; you can redistribute it and/or
     8 * modify it under the terms of the GNU Library General Public
     9 * License as published by the Free Software Foundation; either
     10 * version 2 of the License, or (at your option) any later version.
     11 *
     12 * This library is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     15 * Library General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU Library General Public License
     18 * along with this library; see the file COPYING.LIB.  If not, write to
     19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     20 * Boston, MA 02110-1301, USA.
     21 */
    2222
    2323#include "config.h"
     
    161161        return;
    162162
    163     GraphicsContext* filterContext = getEffectContext();
     163    GraphicsContext* filterContext = effectContext();
    164164    if (!filterContext)
    165165        return;
    166166
    167     filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, calculateDrawingRect(in->repaintRectInLocalCoordinates()));
     167    filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, drawingRegionOfInputImage(in->repaintRectInLocalCoordinates()));
    168168
    169169    IntRect imageRect(IntPoint(), resultImage()->size());
  • trunk/WebCore/platform/graphics/filters/FEColorMatrix.h

    r67847 r67929  
    11/*
    2    Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    3                  2004, 2005 Rob Buis <buis@kde.org>
    4                  2005 Eric Seidel <eric@webkit.org>
    5 
    6    This library is free software; you can redistribute it and/or
    7    modify it under the terms of the GNU Library General Public
    8    License as published by the Free Software Foundation; either
    9    version 2 of the License, or (at your option) any later version.
    10 
    11    This library is distributed in the hope that it will be useful,
    12    but WITHOUT ANY WARRANTY; without even the implied warranty of
    13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    14    Library General Public License for more details.
    15 
    16    You should have received a copy of the GNU Library General Public License
    17     aint with this library; see the file COPYING.LIB.  If not, write to
    18    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    19    Boston, MA 02110-1301, USA.
    20 */
     2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
     3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
     5 *
     6 * This library is free software; you can redistribute it and/or
     7 * modify it under the terms of the GNU Library General Public
     8 * License as published by the Free Software Foundation; either
     9 * version 2 of the License, or (at your option) any later version.
     10 *
     11 * This library is distributed in the hope that it will be useful,
     12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     14 * Library General Public License for more details.
     15 *
     16 * You should have received a copy of the GNU Library General Public License
     17 * along with this library; see the file COPYING.LIB.  If not, write to
     18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     19 * Boston, MA 02110-1301, USA.
     20 */
    2121
    2222#ifndef FEColorMatrix_h
     
    3131namespace WebCore {
    3232
    33     enum ColorMatrixType {
    34         FECOLORMATRIX_TYPE_UNKNOWN          = 0,
    35         FECOLORMATRIX_TYPE_MATRIX           = 1,
    36         FECOLORMATRIX_TYPE_SATURATE         = 2,
    37         FECOLORMATRIX_TYPE_HUEROTATE        = 3,
    38         FECOLORMATRIX_TYPE_LUMINANCETOALPHA = 4
    39     };
     33enum ColorMatrixType {
     34    FECOLORMATRIX_TYPE_UNKNOWN          = 0,
     35    FECOLORMATRIX_TYPE_MATRIX           = 1,
     36    FECOLORMATRIX_TYPE_SATURATE         = 2,
     37    FECOLORMATRIX_TYPE_HUEROTATE        = 3,
     38    FECOLORMATRIX_TYPE_LUMINANCETOALPHA = 4
     39};
    4040
    41     class FEColorMatrix : public FilterEffect {
    42     public:
    43         static PassRefPtr<FEColorMatrix> create(ColorMatrixType, const Vector<float>&);
     41class FEColorMatrix : public FilterEffect {
     42public:
     43    static PassRefPtr<FEColorMatrix> create(ColorMatrixType, const Vector<float>&);
    4444
    45         ColorMatrixType type() const;
    46         void setType(ColorMatrixType);
     45    ColorMatrixType type() const;
     46    void setType(ColorMatrixType);
    4747
    48         const Vector<float>& values() const;
    49         void setValues(const Vector<float>&);
     48    const Vector<float>& values() const;
     49    void setValues(const Vector<float>&);
    5050
    51         void apply(Filter*);
    52         void dump();
    53         TextStream& externalRepresentation(TextStream&, int indent) const;
     51    virtual void apply(Filter*);
     52    virtual void dump();
    5453
    55     private:
    56         FEColorMatrix(ColorMatrixType, const Vector<float>&);
     54    virtual TextStream& externalRepresentation(TextStream&, int indention) const;
    5755
    58         ColorMatrixType m_type;
    59         Vector<float> m_values;
    60     };
     56private:
     57    FEColorMatrix(ColorMatrixType, const Vector<float>&);
     58
     59    ColorMatrixType m_type;
     60    Vector<float> m_values;
     61};
    6162
    6263} // namespace WebCore
  • trunk/WebCore/platform/graphics/filters/FEComponentTransfer.cpp

    r67847 r67929  
    11/*
    2    Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    3                  2004, 2005 Rob Buis <buis@kde.org>
    4                  2005 Eric Seidel <eric@webkit.org>
    5                  2009 Dirk Schulze <krit@webkit.org>
    6    Copyright (C) Research In Motion Limited 2010. All rights reserved.
    7 
    8    This library is free software; you can redistribute it and/or
    9    modify it under the terms of the GNU Library General Public
    10    License as published by the Free Software Foundation; either
    11    version 2 of the License, or (at your option) any later version.
    12 
    13    This library is distributed in the hope that it will be useful,
    14    but WITHOUT ANY WARRANTY; without even the implied warranty of
    15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    16    Library General Public License for more details.
    17 
    18    You should have received a copy of the GNU Library General Public License
    19     aint with this library; see the file COPYING.LIB.  If not, write to
    20    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    21    Boston, MA 02110-1301, USA.
    22 */
     2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
     3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
     5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
     6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
     7 *
     8 * This library is free software; you can redistribute it and/or
     9 * modify it under the terms of the GNU Library General Public
     10 * License as published by the Free Software Foundation; either
     11 * version 2 of the License, or (at your option) any later version.
     12 *
     13 * This library is distributed in the hope that it will be useful,
     14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     16 * Library General Public License for more details.
     17 *
     18 * You should have received a copy of the GNU Library General Public License
     19 * along with this library; see the file COPYING.LIB.  If not, write to
     20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     21 * Boston, MA 02110-1301, USA.
     22 */
    2323
    2424#include "config.h"
     
    3737typedef void (*TransferType)(unsigned char*, const ComponentTransferFunction&);
    3838
    39 FEComponentTransfer::FEComponentTransfer(const ComponentTransferFunction& redFunc,
    40     const ComponentTransferFunction& greenFunc, const ComponentTransferFunction& blueFunc, const ComponentTransferFunction& alphaFunc)
     39FEComponentTransfer::FEComponentTransfer(const ComponentTransferFunction& redFunc, const ComponentTransferFunction& greenFunc,
     40                                        const ComponentTransferFunction& blueFunc, const ComponentTransferFunction& alphaFunc)
    4141    : FilterEffect()
    4242    , m_redFunc(redFunc)
     
    155155        return;
    156156
    157     if (!getEffectContext())
     157    if (!effectContext())
    158158        return;
    159159
     
    168168        (*callEffect[transferFunction[channel].type])(tables[channel], transferFunction[channel]);
    169169
    170     IntRect drawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates());
     170    IntRect drawingRect = requestedRegionOfInputImageData(in->repaintRectInLocalCoordinates());
    171171    RefPtr<ImageData> imageData(in->resultImage()->getUnmultipliedImageData(drawingRect));
    172172    CanvasPixelArray* srcPixelArray(imageData->data());
  • trunk/WebCore/platform/graphics/filters/FEComponentTransfer.h

    r67847 r67929  
    11/*
    2    Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    3                  2004, 2005 Rob Buis <buis@kde.org>
    4                  2005 Eric Seidel <eric@webkit.org>
    5 
    6    This library is free software; you can redistribute it and/or
    7    modify it under the terms of the GNU Library General Public
    8    License as published by the Free Software Foundation; either
    9    version 2 of the License, or (at your option) any later version.
    10 
    11    This library is distributed in the hope that it will be useful,
    12    but WITHOUT ANY WARRANTY; without even the implied warranty of
    13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    14    Library General Public License for more details.
    15 
    16    You should have received a copy of the GNU Library General Public License
    17     aint with this library; see the file COPYING.LIB.  If not, write to
    18    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    19    Boston, MA 02110-1301, USA.
    20 */
     2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
     3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
     5 *
     6 * This library is free software; you can redistribute it and/or
     7 * modify it under the terms of the GNU Library General Public
     8 * License as published by the Free Software Foundation; either
     9 * version 2 of the License, or (at your option) any later version.
     10 *
     11 * This library is distributed in the hope that it will be useful,
     12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     14 * Library General Public License for more details.
     15 *
     16 * You should have received a copy of the GNU Library General Public License
     17 * along with this library; see the file COPYING.LIB.  If not, write to
     18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     19 * Boston, MA 02110-1301, USA.
     20 */
    2121
    2222#ifndef FEComponentTransfer_h
     
    3131namespace WebCore {
    3232
    33     enum ComponentTransferType {
    34         FECOMPONENTTRANSFER_TYPE_UNKNOWN  = 0,
    35         FECOMPONENTTRANSFER_TYPE_IDENTITY = 1,
    36         FECOMPONENTTRANSFER_TYPE_TABLE    = 2,
    37         FECOMPONENTTRANSFER_TYPE_DISCRETE = 3,
    38         FECOMPONENTTRANSFER_TYPE_LINEAR   = 4,
    39         FECOMPONENTTRANSFER_TYPE_GAMMA    = 5
    40     };
     33enum ComponentTransferType {
     34    FECOMPONENTTRANSFER_TYPE_UNKNOWN  = 0,
     35    FECOMPONENTTRANSFER_TYPE_IDENTITY = 1,
     36    FECOMPONENTTRANSFER_TYPE_TABLE    = 2,
     37    FECOMPONENTTRANSFER_TYPE_DISCRETE = 3,
     38    FECOMPONENTTRANSFER_TYPE_LINEAR   = 4,
     39    FECOMPONENTTRANSFER_TYPE_GAMMA    = 5
     40};
    4141
    42     struct ComponentTransferFunction {
    43         ComponentTransferFunction()
    44             : type(FECOMPONENTTRANSFER_TYPE_UNKNOWN)
    45             , slope(0.0f)
    46             , intercept(0.0f)
    47             , amplitude(0.0f)
    48             , exponent(0.0f)
    49             , offset(0.0f)
    50         {
    51         }
     42struct ComponentTransferFunction {
     43    ComponentTransferFunction()
     44        : type(FECOMPONENTTRANSFER_TYPE_UNKNOWN)
     45        , slope(0)
     46        , intercept(0)
     47        , amplitude(0)
     48        , exponent(0)
     49        , offset(0)
     50    {
     51    }
    5252
    53         ComponentTransferType type;
     53    ComponentTransferType type;
    5454
    55         float slope;
    56         float intercept;
    57         float amplitude;
    58         float exponent;
    59         float offset;
     55    float slope;
     56    float intercept;
     57    float amplitude;
     58    float exponent;
     59    float offset;
    6060
    61         Vector<float> tableValues;
    62     };
     61    Vector<float> tableValues;
     62};
    6363
    64     class FEComponentTransfer : public FilterEffect {
    65     public:
    66         static PassRefPtr<FEComponentTransfer> create(const ComponentTransferFunction&,
    67                 const ComponentTransferFunction&, const ComponentTransferFunction&, const ComponentTransferFunction&);
     64class FEComponentTransfer : public FilterEffect {
     65public:
     66    static PassRefPtr<FEComponentTransfer> create(const ComponentTransferFunction& redFunc, const ComponentTransferFunction& greenFunc,
     67                                                  const ComponentTransferFunction& blueFunc, const ComponentTransferFunction& alphaFunc);
    6868
    69         ComponentTransferFunction redFunction() const;
    70         void setRedFunction(const ComponentTransferFunction&);
     69    ComponentTransferFunction redFunction() const;
     70    void setRedFunction(const ComponentTransferFunction&);
    7171
    72         ComponentTransferFunction greenFunction() const;
    73         void setGreenFunction(const ComponentTransferFunction&);
     72    ComponentTransferFunction greenFunction() const;
     73    void setGreenFunction(const ComponentTransferFunction&);
    7474
    75         ComponentTransferFunction blueFunction() const;
    76         void setBlueFunction(const ComponentTransferFunction&);
     75    ComponentTransferFunction blueFunction() const;
     76    void setBlueFunction(const ComponentTransferFunction&);
    7777
    78         ComponentTransferFunction alphaFunction() const;
    79         void setAlphaFunction(const ComponentTransferFunction&);
     78    ComponentTransferFunction alphaFunction() const;
     79    void setAlphaFunction(const ComponentTransferFunction&);
    8080
    81         void apply(Filter*);
    82         void dump();
    83         TextStream& externalRepresentation(TextStream&, int indent) const;
     81    virtual void apply(Filter*);
     82    virtual void dump();
    8483
    85     private:
    86         FEComponentTransfer(const ComponentTransferFunction&, const ComponentTransferFunction&,
    87                             const ComponentTransferFunction&, const ComponentTransferFunction&);
     84    virtual TextStream& externalRepresentation(TextStream&, int indention) const;
    8885
    89         ComponentTransferFunction m_redFunc;
    90         ComponentTransferFunction m_greenFunc;
    91         ComponentTransferFunction m_blueFunc;
    92         ComponentTransferFunction m_alphaFunc;
    93     };
     86private:
     87    FEComponentTransfer(const ComponentTransferFunction& redFunc, const ComponentTransferFunction& greenFunc,
     88                        const ComponentTransferFunction& blueFunc, const ComponentTransferFunction& alphaFunc);
     89
     90    ComponentTransferFunction m_redFunc;
     91    ComponentTransferFunction m_greenFunc;
     92    ComponentTransferFunction m_blueFunc;
     93    ComponentTransferFunction m_alphaFunc;
     94};
    9495
    9596} // namespace WebCore
  • trunk/WebCore/platform/graphics/filters/FEComposite.cpp

    r67847 r67929  
    11/*
    2    Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    3                  2004, 2005 Rob Buis <buis@kde.org>
    4                  2005 Eric Seidel <eric@webkit.org>
    5                  2009 Dirk Schulze <krit@webkit.org>
    6 
    7    This library is free software; you can redistribute it and/or
    8    modify it under the terms of the GNU Library General Public
    9    License as published by the Free Software Foundation; either
    10    version 2 of the License, or (at your option) any later version.
    11 
    12    This library is distributed in the hope that it will be useful,
    13    but WITHOUT ANY WARRANTY; without even the implied warranty of
    14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    15    Library General Public License for more details.
    16 
    17    You should have received a copy of the GNU Library General Public License
    18     aint with this library; see the file COPYING.LIB.  If not, write to
    19    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    20    Boston, MA 02110-1301, USA.
    21 */
     2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
     3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
     5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
     6 *
     7 * This library is free software; you can redistribute it and/or
     8 * modify it under the terms of the GNU Library General Public
     9 * License as published by the Free Software Foundation; either
     10 * version 2 of the License, or (at your option) any later version.
     11 *
     12 * This library is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     15 * Library General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU Library General Public License
     18 * along with this library; see the file COPYING.LIB.  If not, write to
     19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     20 * Boston, MA 02110-1301, USA.
     21 */
    2222
    2323#include "config.h"
     
    123123        return;
    124124
    125     GraphicsContext* filterContext = getEffectContext();
     125    GraphicsContext* filterContext = effectContext();
    126126    if (!filterContext)
    127127        return;
    128128
    129     FloatRect srcRect = FloatRect(0.f, 0.f, -1.f, -1.f);
     129    FloatRect srcRect = FloatRect(0, 0, -1, -1);
    130130    switch (m_type) {
    131131    case FECOMPOSITE_OPERATOR_OVER:
    132         filterContext->drawImageBuffer(in2->resultImage(), DeviceColorSpace, calculateDrawingRect(in2->repaintRectInLocalCoordinates()));
    133         filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, calculateDrawingRect(in->repaintRectInLocalCoordinates()));
     132        filterContext->drawImageBuffer(in2->resultImage(), DeviceColorSpace, drawingRegionOfInputImage(in2->repaintRectInLocalCoordinates()));
     133        filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, drawingRegionOfInputImage(in->repaintRectInLocalCoordinates()));
    134134        break;
    135135    case FECOMPOSITE_OPERATOR_IN:
    136136        filterContext->save();
    137         filterContext->clipToImageBuffer(in2->resultImage(), calculateDrawingRect(in2->repaintRectInLocalCoordinates()));
    138         filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, calculateDrawingRect(in->repaintRectInLocalCoordinates()));
     137        filterContext->clipToImageBuffer(in2->resultImage(), drawingRegionOfInputImage(in2->repaintRectInLocalCoordinates()));
     138        filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, drawingRegionOfInputImage(in->repaintRectInLocalCoordinates()));
    139139        filterContext->restore();
    140140        break;
    141141    case FECOMPOSITE_OPERATOR_OUT:
    142         filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, calculateDrawingRect(in->repaintRectInLocalCoordinates()));
    143         filterContext->drawImageBuffer(in2->resultImage(), DeviceColorSpace, calculateDrawingRect(in2->repaintRectInLocalCoordinates()), srcRect, CompositeDestinationOut);
     142        filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, drawingRegionOfInputImage(in->repaintRectInLocalCoordinates()));
     143        filterContext->drawImageBuffer(in2->resultImage(), DeviceColorSpace, drawingRegionOfInputImage(in2->repaintRectInLocalCoordinates()), srcRect, CompositeDestinationOut);
    144144        break;
    145145    case FECOMPOSITE_OPERATOR_ATOP:
    146         filterContext->drawImageBuffer(in2->resultImage(), DeviceColorSpace, calculateDrawingRect(in2->repaintRectInLocalCoordinates()));
    147         filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, calculateDrawingRect(in->repaintRectInLocalCoordinates()), srcRect, CompositeSourceAtop);
     146        filterContext->drawImageBuffer(in2->resultImage(), DeviceColorSpace, drawingRegionOfInputImage(in2->repaintRectInLocalCoordinates()));
     147        filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, drawingRegionOfInputImage(in->repaintRectInLocalCoordinates()), srcRect, CompositeSourceAtop);
    148148        break;
    149149    case FECOMPOSITE_OPERATOR_XOR:
    150         filterContext->drawImageBuffer(in2->resultImage(), DeviceColorSpace, calculateDrawingRect(in2->repaintRectInLocalCoordinates()));
    151         filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, calculateDrawingRect(in->repaintRectInLocalCoordinates()), srcRect, CompositeXOR);
     150        filterContext->drawImageBuffer(in2->resultImage(), DeviceColorSpace, drawingRegionOfInputImage(in2->repaintRectInLocalCoordinates()));
     151        filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, drawingRegionOfInputImage(in->repaintRectInLocalCoordinates()), srcRect, CompositeXOR);
    152152        break;
    153153    case FECOMPOSITE_OPERATOR_ARITHMETIC: {
    154         IntRect effectADrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates());
     154        IntRect effectADrawingRect = requestedRegionOfInputImageData(in->repaintRectInLocalCoordinates());
    155155        RefPtr<CanvasPixelArray> srcPixelArrayA(in->resultImage()->getPremultipliedImageData(effectADrawingRect)->data());
    156156
    157         IntRect effectBDrawingRect = calculateDrawingIntRect(in2->repaintRectInLocalCoordinates());
     157        IntRect effectBDrawingRect = requestedRegionOfInputImageData(in2->repaintRectInLocalCoordinates());
    158158        RefPtr<ImageData> imageData(in2->resultImage()->getPremultipliedImageData(effectBDrawingRect));
    159159        CanvasPixelArray* srcPixelArrayB(imageData->data());
  • trunk/WebCore/platform/graphics/filters/FEComposite.h

    r67847 r67929  
    11/*
    2    Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    3                  2004, 2005 Rob Buis <buis@kde.org>
    4                  2005 Eric Seidel <eric@webkit.org>
    5 
    6    This library is free software; you can redistribute it and/or
    7    modify it under the terms of the GNU Library General Public
    8    License as published by the Free Software Foundation; either
    9    version 2 of the License, or (at your option) any later version.
    10 
    11    This library is distributed in the hope that it will be useful,
    12    but WITHOUT ANY WARRANTY; without even the implied warranty of
    13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    14    Library General Public License for more details.
    15 
    16    You should have received a copy of the GNU Library General Public License
    17     aint with this library; see the file COPYING.LIB.  If not, write to
    18    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    19    Boston, MA 02110-1301, USA.
    20 */
     2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
     3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
     5 *
     6 * This library is free software; you can redistribute it and/or
     7 * modify it under the terms of the GNU Library General Public
     8 * License as published by the Free Software Foundation; either
     9 * version 2 of the License, or (at your option) any later version.
     10 *
     11 * This library is distributed in the hope that it will be useful,
     12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     14 * Library General Public License for more details.
     15 *
     16 * You should have received a copy of the GNU Library General Public License
     17 * along with this library; see the file COPYING.LIB.  If not, write to
     18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     19 * Boston, MA 02110-1301, USA.
     20 */
    2121
    2222#ifndef FEComposite_h
     
    6060    void setK4(float);
    6161
    62     void apply(Filter*);
    63     void dump();
    64     TextStream& externalRepresentation(TextStream&, int indent) const;
     62    virtual void apply(Filter*);
     63    virtual void dump();
     64
     65    virtual TextStream& externalRepresentation(TextStream&, int indention) const;
    6566
    6667private:
  • trunk/WebCore/platform/graphics/filters/FEGaussianBlur.cpp

    r67847 r67929  
    11/*
    2    Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    3                  2004, 2005 Rob Buis <buis@kde.org>
    4                  2005 Eric Seidel <eric@webkit.org>
    5                  2009 Dirk Schulze <krit@webkit.org>
    6                  2010 Igalia, S.L.
    7 
    8    This library is free software; you can redistribute it and/or
    9    modify it under the terms of the GNU Library General Public
    10    License as published by the Free Software Foundation; either
    11    version 2 of the License, or (at your option) any later version.
    12 
    13    This library is distributed in the hope that it will be useful,
    14    but WITHOUT ANY WARRANTY; without even the implied warranty of
    15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    16    Library General Public License for more details.
    17 
    18    You should have received a copy of the GNU Library General Public License
    19     aint with this library; see the file COPYING.LIB.  If not, write to
    20    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    21    Boston, MA 02110-1301, USA.
    22 */
     2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
     3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
     5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
     6 * Copyright (C) 2010 Igalia, S.L.
     7 *
     8 * This library is free software; you can redistribute it and/or
     9 * modify it under the terms of the GNU Library General Public
     10 * License as published by the Free Software Foundation; either
     11 * version 2 of the License, or (at your option) any later version.
     12 *
     13 * This library is distributed in the hope that it will be useful,
     14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     16 * Library General Public License for more details.
     17 *
     18 * You should have received a copy of the GNU Library General Public License
     19 * along with this library; see the file COPYING.LIB.  If not, write to
     20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     21 * Boston, MA 02110-1301, USA.
     22 */
    2323
    2424#include "config.h"
     
    133133        return;
    134134
    135     if (!getEffectContext())
     135    if (!effectContext())
    136136        return;
    137137
    138138    setIsAlphaImage(in->isAlphaImage());
    139139
    140     IntRect effectDrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates());
     140    IntRect effectDrawingRect = requestedRegionOfInputImageData(in->repaintRectInLocalCoordinates());
    141141    RefPtr<ImageData> srcImageData(in->resultImage()->getPremultipliedImageData(effectDrawingRect));
    142142    IntRect imageRect(IntPoint(), resultImage()->size());
  • trunk/WebCore/platform/graphics/filters/FEGaussianBlur.h

    r67847 r67929  
    11/*
    2    Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    3                  2004, 2005 Rob Buis <buis@kde.org>
    4                  2005 Eric Seidel <eric@webkit.org>
    5 
    6    This library is free software; you can redistribute it and/or
    7    modify it under the terms of the GNU Library General Public
    8    License as published by the Free Software Foundation; either
    9    version 2 of the License, or (at your option) any later version.
    10 
    11    This library is distributed in the hope that it will be useful,
    12    but WITHOUT ANY WARRANTY; without even the implied warranty of
    13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    14    Library General Public License for more details.
    15 
    16    You should have received a copy of the GNU Library General Public License
    17     aint with this library; see the file COPYING.LIB.  If not, write to
    18    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    19    Boston, MA 02110-1301, USA.
    20 */
     2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
     3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
     5 *
     6 * This library is free software; you can redistribute it and/or
     7 * modify it under the terms of the GNU Library General Public
     8 * License as published by the Free Software Foundation; either
     9 * version 2 of the License, or (at your option) any later version.
     10 *
     11 * This library is distributed in the hope that it will be useful,
     12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     14 * Library General Public License for more details.
     15 *
     16 * You should have received a copy of the GNU Library General Public License
     17 * along with this library; see the file COPYING.LIB.  If not, write to
     18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     19 * Boston, MA 02110-1301, USA.
     20 */
    2121
    2222#ifndef FEGaussianBlur_h
     
    3939    void setStdDeviationY(float);
    4040
    41     void apply(Filter*);
    42     void dump();
    43     TextStream& externalRepresentation(TextStream&, int indent) const;
     41    static float calculateStdDeviation(float);
    4442
    45     static float calculateStdDeviation(float);
     43    virtual void apply(Filter*);
     44    virtual void dump();
     45
     46    virtual TextStream& externalRepresentation(TextStream&, int indention) const;
    4647
    4748private:
  • trunk/WebCore/platform/graphics/filters/Filter.h

    r67847 r67929  
    11/*
    2  *  Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
     2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
    33 *
    4  *   This library is free software; you can redistribute it and/or
    5  *  modify it under the terms of the GNU Library General Public
    6  *  License as published by the Free Software Foundation; either
    7  *  version 2 of the License, or (at your option) any later version.
     4 * This library is free software; you can redistribute it and/or
     5 * modify it under the terms of the GNU Library General Public
     6 * License as published by the Free Software Foundation; either
     7 * version 2 of the License, or (at your option) any later version.
    88 *
    9  *  This library is distributed in the hope that it will be useful,
    10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    12  *  Library General Public License for more details.
     9 * This library is distributed in the hope that it will be useful,
     10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     12 * Library General Public License for more details.
    1313 *
    14  *  You should have received a copy of the GNU Library General Public License
    15  *  aint with this library; see the file COPYING.LIB.  If not, write to
    16  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    17  *  Boston, MA 02110-1301, USA.
     14 * You should have received a copy of the GNU Library General Public License
     15 * along with this library; see the file COPYING.LIB.  If not, write to
     16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     17 * Boston, MA 02110-1301, USA.
    1818 */
    1919
  • trunk/WebCore/platform/graphics/filters/FilterEffect.cpp

    r67847 r67929  
    5757}
    5858
    59 IntRect FilterEffect::calculateDrawingIntRect(const FloatRect& effectRect) const
     59IntRect FilterEffect::requestedRegionOfInputImageData(const FloatRect& effectRect) const
    6060{
    6161    ASSERT(m_effectBuffer);
     
    6565}
    6666
    67 FloatRect FilterEffect::calculateDrawingRect(const FloatRect& srcRect) const
     67FloatRect FilterEffect::drawingRegionOfInputImage(const FloatRect& srcRect) const
    6868{
    6969    return FloatRect(FloatPoint(srcRect.x() - m_repaintRectInLocalCoordinates.x(),
     
    7777}
    7878
    79 GraphicsContext* FilterEffect::getEffectContext()
     79GraphicsContext* FilterEffect::effectContext()
    8080{
    8181    IntRect bufferRect = enclosingIntRect(m_repaintRectInLocalCoordinates);
  • trunk/WebCore/platform/graphics/filters/FilterEffect.h

    r67847 r67929  
    5050    // Creates the ImageBuffer for the current filter primitive result in the size of the
    5151    // repaintRect. Gives back the GraphicsContext of the own ImageBuffer.
    52     GraphicsContext* getEffectContext();
     52    GraphicsContext* effectContext();
    5353
    5454    FilterEffectVector& inputEffects() { return m_inputEffects; }
     
    5656    unsigned numberOfEffectInputs() const { return m_inputEffects.size(); }
    5757
    58     FloatRect calculateDrawingRect(const FloatRect&) const;
    59     IntRect calculateDrawingIntRect(const FloatRect&) const;
     58    FloatRect drawingRegionOfInputImage(const FloatRect&) const;
     59    IntRect requestedRegionOfInputImageData(const FloatRect&) const;
    6060
    6161    // Solid black image with different alpha values.
  • trunk/WebCore/platform/graphics/filters/ImageBufferFilter.cpp

    r51310 r67929  
    11/*
    2  *  Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
    3  *  Copyright (C) 2009 Brent Fulgham <bfulgham@webkit.org>
     2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
     3 * Copyright (C) 2009 Brent Fulgham <bfulgham@webkit.org>
    44 *
    5  *   This library is free software; you can redistribute it and/or
    6  *  modify it under the terms of the GNU Library General Public
    7  *  License as published by the Free Software Foundation; either
    8  *  version 2 of the License, or (at your option) any later version.
     5 * This library is free software; you can redistribute it and/or
     6 * modify it under the terms of the GNU Library General Public
     7 * License as published by the Free Software Foundation; either
     8 * version 2 of the License, or (at your option) any later version.
    99 *
    10  *  This library is distributed in the hope that it will be useful,
    11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13  *  Library General Public License for more details.
     10 * This library is distributed in the hope that it will be useful,
     11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13 * Library General Public License for more details.
    1414 *
    15  *  You should have received a copy of the GNU Library General Public License
    16  *  aint with this library; see the file COPYING.LIB.  If not, write to
    17  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    18  *  Boston, MA 02110-1301, USA.
     15 * You should have received a copy of the GNU Library General Public License
     16 * along with this library; see the file COPYING.LIB.  If not, write to
     17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     18 * Boston, MA 02110-1301, USA.
    1919 */
    2020
  • trunk/WebCore/platform/graphics/filters/ImageBufferFilter.h

    r51310 r67929  
    11/*
    2  *  Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
    3  *  Copyright (C) 2009 Brent Fulgham <bfulgham@webkit.org>
     2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
     3 * Copyright (C) 2009 Brent Fulgham <bfulgham@webkit.org>
    44 *
    5  *   This library is free software; you can redistribute it and/or
    6  *  modify it under the terms of the GNU Library General Public
    7  *  License as published by the Free Software Foundation; either
    8  *  version 2 of the License, or (at your option) any later version.
     5 * This library is free software; you can redistribute it and/or
     6 * modify it under the terms of the GNU Library General Public
     7 * License as published by the Free Software Foundation; either
     8 * version 2 of the License, or (at your option) any later version.
    99 *
    10  *  This library is distributed in the hope that it will be useful,
    11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13  *  Library General Public License for more details.
     10 * This library is distributed in the hope that it will be useful,
     11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13 * Library General Public License for more details.
    1414 *
    15  *  You should have received a copy of the GNU Library General Public License
    16  *  aint with this library; see the file COPYING.LIB.  If not, write to
    17  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    18  *  Boston, MA 02110-1301, USA.
     15 * You should have received a copy of the GNU Library General Public License
     16 * along with this library; see the file COPYING.LIB.  If not, write to
     17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     18 * Boston, MA 02110-1301, USA.
    1919 */
    2020
  • trunk/WebCore/platform/graphics/filters/SourceAlpha.cpp

    r67847 r67929  
    11/*
    2  *  Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
     2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
    33 *
    4  *  This library is free software; you can redistribute it and/or
    5  *  modify it under the terms of the GNU Library General Public
    6  *  License as published by the Free Software Foundation; either
    7  *  version 2 of the License, or (at your option) any later version.
     4 * This library is free software; you can redistribute it and/or
     5 * modify it under the terms of the GNU Library General Public
     6 * License as published by the Free Software Foundation; either
     7 * version 2 of the License, or (at your option) any later version.
    88 *
    9  *  This library is distributed in the hope that it will be useful,
    10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    12  *  Library General Public License for more details.
     9 * This library is distributed in the hope that it will be useful,
     10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     12 * Library General Public License for more details.
    1313 *
    14  *  You should have received a copy of the GNU Library General Public License
    15  *  aint with this library; see the file COPYING.LIB.  If not, write to
    16  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    17  *  Boston, MA 02110-1301, USA.
     14 * You should have received a copy of the GNU Library General Public License
     15 * along with this library; see the file COPYING.LIB.  If not, write to
     16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     17 * Boston, MA 02110-1301, USA.
    1818 */
    1919
     
    5858void SourceAlpha::apply(Filter* filter)
    5959{
    60     GraphicsContext* filterContext = getEffectContext();
     60    GraphicsContext* filterContext = effectContext();
    6161    if (!filterContext)
    6262        return;
  • trunk/WebCore/platform/graphics/filters/SourceAlpha.h

    r67847 r67929  
    11/*
    2    Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
    3 
    4    This library is free software; you can redistribute it and/or
    5    modify it under the terms of the GNU Library General Public
    6    License as published by the Free Software Foundation; either
    7    version 2 of the License, or (at your option) any later version.
    8 
    9    This library is distributed in the hope that it will be useful,
    10    but WITHOUT ANY WARRANTY; without even the implied warranty of
    11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    12    Library General Public License for more details.
    13 
    14    You should have received a copy of the GNU Library General Public License
    15     aint with this library; see the file COPYING.LIB.  If not, write to
    16    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    17    Boston, MA 02110-1301, USA.
    18 */
     2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
     3 *
     4 * This library is free software; you can redistribute it and/or
     5 * modify it under the terms of the GNU Library General Public
     6 * License as published by the Free Software Foundation; either
     7 * version 2 of the License, or (at your option) any later version.
     8 *
     9 * This library is distributed in the hope that it will be useful,
     10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     12 * Library General Public License for more details.
     13 *
     14 * You should have received a copy of the GNU Library General Public License
     15 * along with this library; see the file COPYING.LIB.  If not, write to
     16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     17 * Boston, MA 02110-1301, USA.
     18 */
    1919
    2020#ifndef SourceAlpha_h
     
    2929namespace WebCore {
    3030
    31     class SourceAlpha : public FilterEffect {
    32     public:       
    33         static PassRefPtr<SourceAlpha> create();
     31class SourceAlpha : public FilterEffect {
     32public:       
     33    static PassRefPtr<SourceAlpha> create();
    3434
    35         static const AtomicString& effectName();
     35    static const AtomicString& effectName();
    3636
    37         void apply(Filter*);
    38         void dump();
    39         TextStream& externalRepresentation(TextStream&, int indent) const;
     37    virtual FloatRect determineFilterPrimitiveSubregion(Filter*);
    4038
    41         virtual bool isSourceInput() const { return true; }
    42         virtual FloatRect determineFilterPrimitiveSubregion(Filter*);
    43    
    44     private:
    45         SourceAlpha() { }
    46     };
     39    virtual void apply(Filter*);
     40    virtual void dump();
     41
     42    virtual bool isSourceInput() const { return true; }
     43
     44    virtual TextStream& externalRepresentation(TextStream&, int indention) const;
     45
     46private:
     47    SourceAlpha() { }
     48};
     49
    4750} //namespace WebCore
    4851
  • trunk/WebCore/platform/graphics/filters/SourceGraphic.cpp

    r67847 r67929  
    11/*
    2  *  Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
     2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
    33 *
    4  *  This library is free software; you can redistribute it and/or
    5  *  modify it under the terms of the GNU Library General Public
    6  *  License as published by the Free Software Foundation; either
    7  *  version 2 of the License, or (at your option) any later version.
     4 * This library is free software; you can redistribute it and/or
     5 * modify it under the terms of the GNU Library General Public
     6 * License as published by the Free Software Foundation; either
     7 * version 2 of the License, or (at your option) any later version.
    88 *
    9  *  This library is distributed in the hope that it will be useful,
    10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    12  *  Library General Public License for more details.
     9 * This library is distributed in the hope that it will be useful,
     10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     12 * Library General Public License for more details.
    1313 *
    14  *  You should have received a copy of the GNU Library General Public License
    15  *  aint with this library; see the file COPYING.LIB.  If not, write to
    16  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    17  *  Boston, MA 02110-1301, USA.
     14 * You should have received a copy of the GNU Library General Public License
     15 * along with this library; see the file COPYING.LIB.  If not, write to
     16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     17 * Boston, MA 02110-1301, USA.
    1818 */
    1919
     
    5757void SourceGraphic::apply(Filter* filter)
    5858{
    59     GraphicsContext* filterContext = getEffectContext();
     59    GraphicsContext* filterContext = effectContext();
    6060    if (!filterContext)
    6161        return;
  • trunk/WebCore/platform/graphics/filters/SourceGraphic.h

    r67847 r67929  
    11/*
    2    Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com>
    3                  2009 Dirk Schulze <krit@webkit.org>
    4 
    5    This library is free software; you can redistribute it and/or
    6    modify it under the terms of the GNU Library General Public
    7    License as published by the Free Software Foundation; either
    8    version 2 of the License, or (at your option) any later version.
    9 
    10    This library is distributed in the hope that it will be useful,
    11    but WITHOUT ANY WARRANTY; without even the implied warranty of
    12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13    Library General Public License for more details.
    14 
    15    You should have received a copy of the GNU Library General Public License
    16     aint with this library; see the file COPYING.LIB.  If not, write to
    17    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    18    Boston, MA 02110-1301, USA.
    19 */
     2 * Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com>
     3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
     4 *
     5 * This library is free software; you can redistribute it and/or
     6 * modify it under the terms of the GNU Library General Public
     7 * License as published by the Free Software Foundation; either
     8 * version 2 of the License, or (at your option) any later version.
     9 *
     10 * This library is distributed in the hope that it will be useful,
     11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13 * Library General Public License for more details.
     14 *
     15 * You should have received a copy of the GNU Library General Public License
     16 * along with this library; see the file COPYING.LIB.  If not, write to
     17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     18 * Boston, MA 02110-1301, USA.
     19 */
    2020
    2121#ifndef SourceGraphic_h
     
    3030namespace WebCore {
    3131
    32     class SourceGraphic : public FilterEffect {
    33     public:       
    34         static PassRefPtr<SourceGraphic> create();
     32class SourceGraphic : public FilterEffect {
     33public:       
     34    static PassRefPtr<SourceGraphic> create();
    3535
    36         static const AtomicString& effectName();
     36    static const AtomicString& effectName();
    3737
    38         void apply(Filter*);
    39         void dump();
    40         TextStream& externalRepresentation(TextStream&, int indent) const;
     38    virtual FloatRect determineFilterPrimitiveSubregion(Filter*);
    4139
    42         virtual bool isSourceInput() const { return true; }
    43         virtual FloatRect determineFilterPrimitiveSubregion(Filter*);
     40    virtual void apply(Filter*);
     41    virtual void dump();
    4442
    45     private:
    46         SourceGraphic() { }
    47     };
     43    virtual bool isSourceInput() const { return true; }
     44
     45    virtual TextStream& externalRepresentation(TextStream&, int indention) const;
     46
     47private:
     48    SourceGraphic() { }
     49};
     50
    4851} //namespace WebCore
    4952
  • trunk/WebCore/rendering/RenderTreeAsText.cpp

    r65116 r67929  
    4747#include "RenderWidget.h"
    4848#include "SelectionController.h"
    49 #include "TextStream.h"
    5049#include <wtf/UnusedParam.h>
    5150#include <wtf/Vector.h>
     
    7675static void writeLayers(TextStream&, const RenderLayer* rootLayer, RenderLayer*, const IntRect& paintDirtyRect, int indent = 0, RenderAsTextBehavior behavior = RenderAsTextBehaviorNormal);
    7776
    78 #if !ENABLE(SVG)
    79 static TextStream &operator<<(TextStream& ts, const IntRect& r)
     77bool hasFractions(double val)
     78{
     79    int ival = static_cast<int>(val);
     80    double dval = static_cast<double>(ival);
     81    return fabs(val - dval) > std::numeric_limits<double>::epsilon();
     82}
     83
     84TextStream& operator<<(TextStream& ts, const IntRect& r)
    8085{
    8186    return ts << "at (" << r.x() << "," << r.y() << ") size " << r.width() << "x" << r.height();
    8287}
    83 #endif
     88
     89TextStream& operator<<(TextStream& ts, const IntPoint& p)
     90{
     91    return ts << "(" << p.x() << "," << p.y() << ")";
     92}
     93
     94TextStream& operator<<(TextStream& ts, const FloatPoint& p)
     95{
     96    ts << "(";   
     97    if (hasFractions(p.x()))
     98        ts << p.x();
     99    else
     100        ts << int(p.x());   
     101    ts << ",";
     102    if (hasFractions(p.y()))
     103        ts << p.y();
     104    else
     105        ts << int(p.y());   
     106    return ts << ")";
     107}
     108
     109TextStream& operator<<(TextStream& ts, const FloatSize& s)
     110{
     111    ts << "width=";
     112    if (hasFractions(s.width()))
     113        ts << s.width();
     114    else
     115        ts << int(s.width());
     116    ts << " height=";
     117    if (hasFractions(s.height()))
     118        ts << s.height();
     119    else
     120        ts << int(s.height());
     121    return ts;
     122}
    84123
    85124void writeIndent(TextStream& ts, int indent)
  • trunk/WebCore/rendering/RenderTreeAsText.h

    r65021 r67929  
    2626#ifndef RenderTreeAsText_h
    2727#define RenderTreeAsText_h
     28#include "TextStream.h"
    2829
    2930#include <wtf/Forward.h>
     31#include <wtf/MathExtras.h>
    3032
    3133namespace WebCore {
    3234
    3335class Element;
     36class FloatPoint;
     37class FloatSize;
    3438class Frame;
     39class IntPoint;
     40class IntRect;
    3541class RenderObject;
    3642class TextStream;
     
    6066};
    6167
     68TextStream& operator<<(TextStream&, const IntPoint&);
     69TextStream& operator<<(TextStream&, const IntRect&);
     70TextStream& operator<<(TextStream&, const FloatPoint&);
     71TextStream& operator<<(TextStream&, const FloatSize&);
     72
     73template<typename Item>
     74TextStream& operator<<(TextStream& ts, const Vector<Item>& vector)
     75{
     76    ts << "[";
     77
     78    unsigned size = vector.size();
     79    for (unsigned i = 0; i < size; ++i) {
     80        ts << vector[i];
     81        if (i < size - 1)
     82            ts << ", ";
     83    }
     84
     85    ts << "]";
     86    return ts;
     87}
     88
    6289// Helper function shared with SVGRenderTreeAsText
    6390String quoteAndEscapeNonPrintables(const String&);
     
    6794String markerTextForListItem(Element*);
    6895
     96bool hasFractions(double val);
     97
    6998} // namespace WebCore
    7099
  • trunk/WebCore/rendering/SVGRenderTreeAsText.cpp

    r66955 r67929  
    125125}
    126126
    127 TextStream& operator<<(TextStream& ts, const IntPoint& p)
    128 {
    129     return ts << "(" << p.x() << "," << p.y() << ")";
    130 }
    131 
    132 TextStream& operator<<(TextStream& ts, const IntRect& r)
    133 {
    134     return ts << "at (" << r.x() << "," << r.y() << ") size " << r.width() << "x" << r.height();
    135 }
    136 
    137 static bool hasFractions(double val)
    138 {
    139     double epsilon = 0.0001;
    140     int ival = static_cast<int>(val);
    141     double dval = static_cast<double>(ival);
    142     return fabs(val - dval) > epsilon;
    143 }
    144 
    145127TextStream& operator<<(TextStream& ts, const FloatRect &r)
    146128{
     
    165147    else
    166148        ts << int(r.height());
    167     return ts;
    168 }
    169 
    170 TextStream& operator<<(TextStream& ts, const FloatPoint& p)
    171 {
    172     ts << "(";   
    173     if (hasFractions(p.x()))
    174         ts << p.x();
    175     else
    176         ts << int(p.x());   
    177     ts << ",";
    178     if (hasFractions(p.y()))
    179         ts << p.y();
    180     else
    181         ts << int(p.y());   
    182     return ts << ")";
    183 }
    184 
    185 TextStream& operator<<(TextStream& ts, const FloatSize& s)
    186 {
    187     ts << "width=";
    188     if (hasFractions(s.width()))
    189         ts << s.width();
    190     else
    191         ts << int(s.width());
    192     ts << " height=";
    193     if (hasFractions(s.height()))
    194         ts << s.height();
    195     else
    196         ts << int(s.height());
    197149    return ts;
    198150}
  • trunk/WebCore/rendering/SVGRenderTreeAsText.h

    r65116 r67929  
    3434
    3535    class Color;
    36     class FloatPoint;
    3736    class FloatRect;
    3837    class FloatSize;
    39     class IntPoint;
    40     class IntRect;
    4138    class Node;
    4239    class RenderBlock;
     
    6461// helper operators defined used in various classes to dump the render tree.
    6562TextStream& operator<<(TextStream&, const AffineTransform&);
    66 TextStream& operator<<(TextStream&, const IntRect&);
    6763TextStream& operator<<(TextStream&, const Color&);
    68 TextStream& operator<<(TextStream&, const IntPoint&);
    69 TextStream& operator<<(TextStream&, const FloatSize&);
    7064TextStream& operator<<(TextStream&, const FloatRect&);
    71 TextStream& operator<<(TextStream&, const FloatPoint&);
    7265
    7366// helper operators specific to dumping the render tree. these are used in various classes to dump the render tree
     
    8174    for (unsigned i = 0; i < v.size(); i++) {
    8275        ts << *v[i];
    83         if (i < v.size() - 1)
    84             ts << ", ";
    85     }
    86 
    87     ts << "]";
    88     return ts;
    89 }
    90 
    91 template<typename Item>
    92 TextStream& operator<<(TextStream& ts, const Vector<Item>& v)
    93 {
    94     ts << "[";
    95 
    96     for (unsigned i = 0; i < v.size(); i++) {
    97         ts << v[i];
    9876        if (i < v.size() - 1)
    9977            ts << ", ";
  • trunk/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp

    r67847 r67929  
    3030#include "Filter.h"
    3131#include "ImageData.h"
    32 #include "SVGRenderTreeAsText.h"
    3332
    3433namespace WebCore {
     
    379378        return;
    380379
    381     if (!getEffectContext())
     380    if (!effectContext())
    382381        return;
    383382
    384383    IntRect imageRect(IntPoint(), resultImage()->size());
    385     IntRect effectDrawingRect = calculateDrawingIntRect(in->filterPrimitiveSubregion());
     384    IntRect effectDrawingRect = requestedRegionOfInputImageData(in->filterPrimitiveSubregion());
    386385
    387386    RefPtr<CanvasPixelArray> srcPixelArray;
  • trunk/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h

    r67847 r67929  
    7373    void setPreserveAlpha(bool);
    7474
    75     void apply(Filter*);
    76     void dump();
    77     TextStream& externalRepresentation(TextStream&, int indent) const;
     75    virtual void apply(Filter*);
     76    virtual void dump();
     77
     78    virtual TextStream& externalRepresentation(TextStream&, int indention) const;
    7879
    7980private:
  • trunk/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp

    r67847 r67929  
    2626
    2727#include "SVGLightSource.h"
    28 #include "SVGRenderTreeAsText.h"
    2928
    3029namespace WebCore {
  • trunk/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h

    r67847 r67929  
    5454    void setLightSource(PassRefPtr<LightSource>);
    5555
    56     void dump();
    57     TextStream& externalRepresentation(TextStream&, int indent) const;
     56    virtual void dump();
     57
     58    virtual TextStream& externalRepresentation(TextStream&, int indention) const;
    5859
    5960private:
    60     FEDiffuseLighting(const Color&, float, float,
    61         float, float, PassRefPtr<LightSource>);
     61    FEDiffuseLighting(const Color&, float, float, float, float, PassRefPtr<LightSource>);
    6262};
    6363
  • trunk/WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp

    r67847 r67929  
    3030#include "GraphicsContext.h"
    3131#include "ImageData.h"
    32 #include "SVGRenderTreeAsText.h"
    3332
    3433namespace WebCore {
     
    9089        return;
    9190
    92     if (!getEffectContext())
     91    if (!effectContext())
    9392        return;
    9493
    95     IntRect effectADrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates());
     94    IntRect effectADrawingRect = requestedRegionOfInputImageData(in->repaintRectInLocalCoordinates());
    9695    RefPtr<CanvasPixelArray> srcPixelArrayA(in->resultImage()->getPremultipliedImageData(effectADrawingRect)->data());
    9796
    98     IntRect effectBDrawingRect = calculateDrawingIntRect(in2->repaintRectInLocalCoordinates());
     97    IntRect effectBDrawingRect = requestedRegionOfInputImageData(in2->repaintRectInLocalCoordinates());
    9998    RefPtr<CanvasPixelArray> srcPixelArrayB(in2->resultImage()->getUnmultipliedImageData(effectBDrawingRect)->data());
    10099
  • trunk/WebCore/svg/graphics/filters/SVGFEDisplacementMap.h

    r67847 r67929  
    3030namespace WebCore {
    3131
    32     enum ChannelSelectorType {
    33         CHANNEL_UNKNOWN = 0,
    34         CHANNEL_R       = 1,
    35         CHANNEL_G       = 2,
    36         CHANNEL_B       = 3,
    37         CHANNEL_A       = 4
    38     };
    39    
    40     class FEDisplacementMap : public FilterEffect {
    41     public:
    42         static PassRefPtr<FEDisplacementMap> create(ChannelSelectorType, ChannelSelectorType, float);
     32enum ChannelSelectorType {
     33    CHANNEL_UNKNOWN = 0,
     34    CHANNEL_R = 1,
     35    CHANNEL_G = 2,
     36    CHANNEL_B = 3,
     37    CHANNEL_A = 4
     38};
    4339
    44         ChannelSelectorType xChannelSelector() const;
    45         void setXChannelSelector(const ChannelSelectorType);
     40class FEDisplacementMap : public FilterEffect {
     41public:
     42    static PassRefPtr<FEDisplacementMap> create(ChannelSelectorType xChannelSelector, ChannelSelectorType yChannelSelector, float);
    4643
    47         ChannelSelectorType yChannelSelector() const;
    48         void setYChannelSelector(const ChannelSelectorType);
     44    ChannelSelectorType xChannelSelector() const;
     45    void setXChannelSelector(const ChannelSelectorType);
    4946
    50         float scale() const;
    51         void setScale(float scale);
     47    ChannelSelectorType yChannelSelector() const;
     48    void setYChannelSelector(const ChannelSelectorType);
    5249
    53         void apply(Filter*);
    54         void dump();
    55         TextStream& externalRepresentation(TextStream&, int indent) const;
     50    float scale() const;
     51    void setScale(float scale);
    5652
    57     private:
    58         FEDisplacementMap(ChannelSelectorType, ChannelSelectorType, float);
     53    virtual void apply(Filter*);
     54    virtual void dump();
    5955
    60         ChannelSelectorType m_xChannelSelector;
    61         ChannelSelectorType m_yChannelSelector;
    62         float m_scale;
    63     };
     56    virtual TextStream& externalRepresentation(TextStream&, int indention) const;
     57
     58private:
     59    FEDisplacementMap(ChannelSelectorType xChannelSelector, ChannelSelectorType yChannelSelector, float);
     60
     61    ChannelSelectorType m_xChannelSelector;
     62    ChannelSelectorType m_yChannelSelector;
     63    float m_scale;
     64};
    6465
    6566} // namespace WebCore
  • trunk/WebCore/svg/graphics/filters/SVGFEFlood.cpp

    r67847 r67929  
    2828#include "Filter.h"
    2929#include "GraphicsContext.h"
    30 #include "SVGRenderTreeAsText.h"
    3130
    3231namespace WebCore {
    3332
    34 FEFlood::FEFlood(const Color& floodColor, const float& floodOpacity)
     33FEFlood::FEFlood(const Color& floodColor, float floodOpacity)
    3534    : FilterEffect()
    3635    , m_floodColor(floodColor)
     
    3938}
    4039
    41 PassRefPtr<FEFlood> FEFlood::create(const Color& floodColor, const float& floodOpacity)
     40PassRefPtr<FEFlood> FEFlood::create(const Color& floodColor, float floodOpacity)
    4241{
    4342    return adoptRef(new FEFlood(floodColor, floodOpacity));
     
    6665void FEFlood::apply(Filter*)
    6766{
    68     GraphicsContext* filterContext = getEffectContext();
     67    GraphicsContext* filterContext = effectContext();
    6968    if (!filterContext)
    7069        return;
     
    8382    ts << "[feFlood";
    8483    FilterEffect::externalRepresentation(ts);
    85     ts << " flood-color=\"" << floodColor() << "\" "
     84    ts << " flood-color=\"" << floodColor().name() << "\" "
    8685       << "flood-opacity=\"" << floodOpacity() << "\"]\n";
    8786    return ts;
  • trunk/WebCore/svg/graphics/filters/SVGFEFlood.h

    r64579 r67929  
    3030namespace WebCore {
    3131
    32     class FEFlood : public FilterEffect {
    33     public:
    34         static PassRefPtr<FEFlood> create(const Color&, const float&);
     32class FEFlood : public FilterEffect {
     33public:
     34    static PassRefPtr<FEFlood> create(const Color&, float);
    3535
    36         Color floodColor() const;
    37         void setFloodColor(const Color &);
     36    Color floodColor() const;
     37    void setFloodColor(const Color &);
    3838
    39         float floodOpacity() const;
    40         void setFloodOpacity(float);
     39    float floodOpacity() const;
     40    void setFloodOpacity(float);
    4141
    42         void apply(Filter*);
    43         void dump();
    44         TextStream& externalRepresentation(TextStream&, int indent) const;
     42    virtual void apply(Filter*);
     43    virtual void dump();
    4544
    46     private:
    47         FEFlood(const Color&, const float&);
     45    virtual TextStream& externalRepresentation(TextStream&, int indention) const;
    4846
    49         Color m_floodColor;
    50         float m_floodOpacity;
    51     };
     47private:
     48    FEFlood(const Color&, float);
     49
     50    Color m_floodColor;
     51    float m_floodOpacity;
     52};
    5253
    5354} // namespace WebCore
  • trunk/WebCore/svg/graphics/filters/SVGFEImage.cpp

    r67847 r67929  
    3030#include "GraphicsContext.h"
    3131#include "SVGPreserveAspectRatio.h"
    32 #include "SVGRenderTreeAsText.h"
    3332
    3433namespace WebCore {
    3534
    36 FEImage::FEImage(RefPtr<Image> image, SVGPreserveAspectRatio preserveAspectRatio)
     35FEImage::FEImage(RefPtr<Image> image, const SVGPreserveAspectRatio& preserveAspectRatio)
    3736    : FilterEffect()
    3837    , m_image(image)
     
    4140}
    4241
    43 PassRefPtr<FEImage> FEImage::create(RefPtr<Image> image, SVGPreserveAspectRatio preserveAspectRatio)
     42PassRefPtr<FEImage> FEImage::create(RefPtr<Image> image, const SVGPreserveAspectRatio& preserveAspectRatio)
    4443{
    4544    return adoptRef(new FEImage(image, preserveAspectRatio));
     
    5150        return;
    5251
    53     GraphicsContext* filterContext = getEffectContext();
     52    GraphicsContext* filterContext = effectContext();
    5453    if (!filterContext)
    5554        return;
  • trunk/WebCore/svg/graphics/filters/SVGFEImage.h

    r64579 r67929  
    3030namespace WebCore {
    3131
    32     class FEImage : public FilterEffect {
    33     public:
    34         static PassRefPtr<FEImage> create(RefPtr<Image>, SVGPreserveAspectRatio);
     32class FEImage : public FilterEffect {
     33public:
     34    static PassRefPtr<FEImage> create(RefPtr<Image>, const SVGPreserveAspectRatio&);
    3535
    36         void apply(Filter*);
    37         void dump();
    38         TextStream& externalRepresentation(TextStream&, int indent) const;
    39        
    40     private:
    41         FEImage(RefPtr<Image>, SVGPreserveAspectRatio);
     36    virtual void apply(Filter*);
     37    virtual void dump();
    4238
    43         RefPtr<Image> m_image;
    44         SVGPreserveAspectRatio m_preserveAspectRatio;
    45     };
     39    virtual TextStream& externalRepresentation(TextStream&, int indention) const;
     40   
     41private:
     42    FEImage(RefPtr<Image>, const SVGPreserveAspectRatio&);
     43
     44    RefPtr<Image> m_image;
     45    SVGPreserveAspectRatio m_preserveAspectRatio;
     46};
    4647
    4748} // namespace WebCore
  • trunk/WebCore/svg/graphics/filters/SVGFELighting.cpp

    r67847 r67929  
    248248        return;
    249249
    250     if (!getEffectContext())
     250    if (!effectContext())
    251251        return;
    252252
    253253    setIsAlphaImage(false);
    254254
    255     IntRect effectDrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates());
     255    IntRect effectDrawingRect = requestedRegionOfInputImageData(in->repaintRectInLocalCoordinates());
    256256    RefPtr<ImageData> srcImageData(in->resultImage()->getUnmultipliedImageData(effectDrawingRect));
    257257    CanvasPixelArray* srcPixelArray(srcImageData->data());
  • trunk/WebCore/svg/graphics/filters/SVGFELighting.h

    r67847 r67929  
    4343class FELighting : public FilterEffect {
    4444public:
    45     void apply(Filter*);
     45    virtual void apply(Filter*);
    4646
    4747protected:
  • trunk/WebCore/svg/graphics/filters/SVGFEMerge.cpp

    r67847 r67929  
    2727#include "Filter.h"
    2828#include "GraphicsContext.h"
    29 #include "SVGRenderTreeAsText.h"
    3029
    3130namespace WebCore {
     
    5251    }
    5352
    54     GraphicsContext* filterContext = getEffectContext();
     53    GraphicsContext* filterContext = effectContext();
    5554    if (!filterContext)
    5655        return;
     
    5857    for (unsigned i = 0; i < size; ++i) {
    5958        FilterEffect* in = inputEffect(i);
    60         filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, calculateDrawingRect(in->repaintRectInLocalCoordinates()));
     59        filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, drawingRegionOfInputImage(in->repaintRectInLocalCoordinates()));
    6160    }
    6261}
  • trunk/WebCore/svg/graphics/filters/SVGFEMerge.h

    r67847 r67929  
    3030namespace WebCore {
    3131
    32     class FEMerge : public FilterEffect {
    33     public:
    34         static PassRefPtr<FEMerge> create();
     32class FEMerge : public FilterEffect {
     33public:
     34    static PassRefPtr<FEMerge> create();
    3535
    36         void apply(Filter*);
    37         void dump();
    38         TextStream& externalRepresentation(TextStream&, int indent) const;
     36    virtual void apply(Filter*);
     37    virtual void dump();
    3938
    40     private:
    41         FEMerge();
    42     };
     39    virtual TextStream& externalRepresentation(TextStream&, int indention) const;
     40
     41private:
     42    FEMerge();
     43};
    4344
    4445} // namespace WebCore
  • trunk/WebCore/svg/graphics/filters/SVGFEMorphology.cpp

    r67847 r67929  
    2929#include "Filter.h"
    3030#include "ImageData.h"
    31 #include "SVGRenderTreeAsText.h"
    3231
    3332#include <wtf/Vector.h>
     
    8887        return;
    8988
    90     if (!getEffectContext())
     89    if (!effectContext())
    9190        return;
    9291
     
    9998
    10099    IntRect imageRect(IntPoint(), resultImage()->size());
    101     IntRect effectDrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates());
     100    IntRect effectDrawingRect = requestedRegionOfInputImageData(in->repaintRectInLocalCoordinates());
    102101    RefPtr<CanvasPixelArray> srcPixelArray(in->resultImage()->getPremultipliedImageData(effectDrawingRect)->data());
    103102    RefPtr<ImageData> imageData = ImageData::create(imageRect.width(), imageRect.height());
  • trunk/WebCore/svg/graphics/filters/SVGFEMorphology.h

    r67847 r67929  
    2929namespace WebCore {
    3030
    31     enum MorphologyOperatorType {
    32         FEMORPHOLOGY_OPERATOR_UNKNOWN = 0,
    33         FEMORPHOLOGY_OPERATOR_ERODE  = 1,
    34         FEMORPHOLOGY_OPERATOR_DILATE = 2
    35     };
     31enum MorphologyOperatorType {
     32    FEMORPHOLOGY_OPERATOR_UNKNOWN = 0,
     33    FEMORPHOLOGY_OPERATOR_ERODE = 1,
     34    FEMORPHOLOGY_OPERATOR_DILATE = 2
     35};
    3636
    37     class FEMorphology : public FilterEffect {
    38     public:
    39         static PassRefPtr<FEMorphology> create(MorphologyOperatorType, float radiusX, float radiusY); 
    40         MorphologyOperatorType morphologyOperator() const;
    41         void setMorphologyOperator(MorphologyOperatorType);
     37class FEMorphology : public FilterEffect {
     38public:
     39    static PassRefPtr<FEMorphology> create(MorphologyOperatorType, float radiusX, float radiusY); 
     40    MorphologyOperatorType morphologyOperator() const;
     41    void setMorphologyOperator(MorphologyOperatorType);
    4242
    43         float radiusX() const;
    44         void setRadiusX(float);
     43    float radiusX() const;
     44    void setRadiusX(float);
    4545
    46         float radiusY() const;
    47         void setRadiusY(float);
     46    float radiusY() const;
     47    void setRadiusY(float);
    4848
    49         void apply(Filter*);
    50         void dump();
    51         TextStream& externalRepresentation(TextStream&, int indent) const;
     49    virtual void apply(Filter*);
     50    virtual void dump();
    5251
    53     private:
    54         FEMorphology(MorphologyOperatorType, float radiusX, float radiusY);
    55        
    56         MorphologyOperatorType m_type;
    57         float m_radiusX;
    58         float m_radiusY;
    59     };
     52    virtual TextStream& externalRepresentation(TextStream&, int indention) const;
     53
     54private:
     55    FEMorphology(MorphologyOperatorType, float radiusX, float radiusY);
     56   
     57    MorphologyOperatorType m_type;
     58    float m_radiusX;
     59    float m_radiusY;
     60};
    6061
    6162} // namespace WebCore
  • trunk/WebCore/svg/graphics/filters/SVGFEOffset.cpp

    r67847 r67929  
    2828#include "Filter.h"
    2929#include "GraphicsContext.h"
    30 #include "SVGRenderTreeAsText.h"
    3130
    3231namespace WebCore {
     
    7170        return;
    7271
    73     GraphicsContext* filterContext = getEffectContext();
     72    GraphicsContext* filterContext = effectContext();
    7473    if (!filterContext)
    7574        return;
  • trunk/WebCore/svg/graphics/filters/SVGFEOffset.h

    r67847 r67929  
    2929namespace WebCore {
    3030
    31     class FEOffset : public FilterEffect {
    32     public:
    33         static PassRefPtr<FEOffset> create(float, float);
     31class FEOffset : public FilterEffect {
     32public:
     33    static PassRefPtr<FEOffset> create(float dx, float dy);
    3434
    35         float dx() const;
    36         void setDx(float);
     35    float dx() const;
     36    void setDx(float);
    3737
    38         float dy() const;
    39         void setDy(float);
     38    float dy() const;
     39    void setDy(float);
    4040
    41         void apply(Filter*);
    42         void dump();
    43         TextStream& externalRepresentation(TextStream&, int indent) const;
     41    virtual void apply(Filter*);
     42    virtual void dump();
    4443
    45     private:
    46         FEOffset(float, float);
     44    virtual TextStream& externalRepresentation(TextStream&, int indention) const;
    4745
    48         float m_dx;
    49         float m_dy;
    50     };
     46private:
     47    FEOffset(float dx, float dy);
     48
     49    float m_dx;
     50    float m_dy;
     51};
    5152
    5253} // namespace WebCore
  • trunk/WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp

    r67847 r67929  
    2626
    2727#include "SVGLightSource.h"
    28 #include "SVGRenderTreeAsText.h"
    2928
    3029namespace WebCore {
  • trunk/WebCore/svg/graphics/filters/SVGFESpecularLighting.h

    r67847 r67929  
    5555    void setLightSource(PassRefPtr<LightSource>);
    5656
    57     void dump();
    58     TextStream& externalRepresentation(TextStream&, int indent) const;
     57    virtual void dump();
     58
     59    virtual TextStream& externalRepresentation(TextStream&, int indention) const;
    5960
    6061private:
  • trunk/WebCore/svg/graphics/filters/SVGFETile.cpp

    r67847 r67929  
    2828#include "GraphicsContext.h"
    2929#include "Pattern.h"
    30 #include "SVGRenderTreeAsText.h"
    3130
    3231namespace WebCore {
     
    5756        return;
    5857
    59     GraphicsContext* filterContext = getEffectContext();
     58    GraphicsContext* filterContext = effectContext();
    6059    if (!filterContext)
    6160        return;
  • trunk/WebCore/svg/graphics/filters/SVGFETile.h

    r67847 r67929  
    2929namespace WebCore {
    3030   
    31     class FETile : public FilterEffect {
    32     public:
    33         static PassRefPtr<FETile> create();
     31class FETile : public FilterEffect {
     32public:
     33    static PassRefPtr<FETile> create();
    3434
    35         void apply(Filter*);
    36         void dump();
    37         TextStream& externalRepresentation(TextStream&, int indent) const;
     35    virtual void apply(Filter*);
     36    virtual void dump();
    3837
    39         virtual FloatRect determineFilterPrimitiveSubregion(Filter*);
    40        
    41     private:
    42         FETile();
    43     };
     38    virtual TextStream& externalRepresentation(TextStream&, int indention) const;
     39
     40    virtual FloatRect determineFilterPrimitiveSubregion(Filter*);
     41   
     42private:
     43    FETile();
     44};
    4445
    4546} // namespace WebCore
  • trunk/WebCore/svg/graphics/filters/SVGFETurbulence.cpp

    r65590 r67929  
    3030#include "Filter.h"
    3131#include "ImageData.h"
    32 #include "SVGRenderTreeAsText.h"
    3332
    3433#include <wtf/MathExtras.h>
     
    323322void FETurbulence::apply(Filter* filter)
    324323{
    325     if (!getEffectContext())
     324    if (!effectContext())
    326325        return;
    327326
  • trunk/WebCore/svg/graphics/filters/SVGFETurbulence.h

    r64579 r67929  
    5959    void setStitchTiles(bool);
    6060
    61     void apply(Filter*);
    62     void dump();
    63     TextStream& externalRepresentation(TextStream&, int indent) const;
     61    virtual void apply(Filter*);
     62    virtual void dump();
     63
     64    virtual TextStream& externalRepresentation(TextStream&, int indention) const;
    6465
    6566private:
Note: See TracChangeset for help on using the changeset viewer.