Changeset 67929 in webkit
- Timestamp:
- Sep 21, 2010 12:36:13 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 48 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r67928 r67929 1 2010-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 1 91 2010-09-20 Philippe Normand <pnormand@igalia.com> 2 92 -
trunk/WebCore/platform/graphics/filters/FEBlend.cpp
r67847 r67929 1 1 /* 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 aintwith this library; see the file COPYING.LIB. If not, write to19 20 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 */ 22 22 23 23 #include "config.h" … … 99 99 return; 100 100 101 if (! getEffectContext())101 if (!effectContext()) 102 102 return; 103 103 104 IntRect effectADrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates());104 IntRect effectADrawingRect = requestedRegionOfInputImageData(in->repaintRectInLocalCoordinates()); 105 105 RefPtr<CanvasPixelArray> srcPixelArrayA(in->resultImage()->getPremultipliedImageData(effectADrawingRect)->data()); 106 106 107 IntRect effectBDrawingRect = calculateDrawingIntRect(in2->repaintRectInLocalCoordinates());107 IntRect effectBDrawingRect = requestedRegionOfInputImageData(in2->repaintRectInLocalCoordinates()); 108 108 RefPtr<CanvasPixelArray> srcPixelArrayB(in2->resultImage()->getPremultipliedImageData(effectBDrawingRect)->data()); 109 109 -
trunk/WebCore/platform/graphics/filters/FEBlend.h
r67847 r67929 1 1 /* 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 aintwith this library; see the file COPYING.LIB. If not, write to18 19 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 */ 21 21 22 22 #ifndef FEBlend_h … … 30 30 namespace WebCore { 31 31 32 33 FEBLEND_MODE_UNKNOWN= 0,34 FEBLEND_MODE_NORMAL= 1,35 36 FEBLEND_MODE_SCREEN= 3,37 FEBLEND_MODE_DARKEN= 4,38 FEBLEND_MODE_LIGHTEN= 539 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 }; 40 40 41 42 43 41 class FEBlend : public FilterEffect { 42 public: 43 static PassRefPtr<FEBlend> create(BlendModeType); 44 44 45 46 45 BlendModeType blendMode() const; 46 void setBlendMode(BlendModeType); 47 47 48 void apply(Filter*); 49 void dump(); 50 TextStream& externalRepresentation(TextStream&, int indent) const; 48 virtual void apply(Filter*); 49 virtual void dump(); 51 50 52 private: 53 FEBlend(BlendModeType); 51 virtual TextStream& externalRepresentation(TextStream&, int indention) const; 54 52 55 BlendModeType m_mode; 56 }; 53 private: 54 FEBlend(BlendModeType); 55 56 BlendModeType m_mode; 57 }; 57 58 58 59 } // namespace WebCore -
trunk/WebCore/platform/graphics/filters/FEColorMatrix.cpp
r67847 r67929 1 1 /* 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 aintwith this library; see the file COPYING.LIB. If not, write to19 20 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 */ 22 22 23 23 #include "config.h" … … 161 161 return; 162 162 163 GraphicsContext* filterContext = getEffectContext();163 GraphicsContext* filterContext = effectContext(); 164 164 if (!filterContext) 165 165 return; 166 166 167 filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, calculateDrawingRect(in->repaintRectInLocalCoordinates()));167 filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, drawingRegionOfInputImage(in->repaintRectInLocalCoordinates())); 168 168 169 169 IntRect imageRect(IntPoint(), resultImage()->size()); -
trunk/WebCore/platform/graphics/filters/FEColorMatrix.h
r67847 r67929 1 1 /* 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 aintwith this library; see the file COPYING.LIB. If not, write to18 19 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 */ 21 21 22 22 #ifndef FEColorMatrix_h … … 31 31 namespace WebCore { 32 32 33 34 35 36 37 38 39 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 }; 40 40 41 42 43 41 class FEColorMatrix : public FilterEffect { 42 public: 43 static PassRefPtr<FEColorMatrix> create(ColorMatrixType, const Vector<float>&); 44 44 45 46 45 ColorMatrixType type() const; 46 void setType(ColorMatrixType); 47 47 48 49 48 const Vector<float>& values() const; 49 void setValues(const Vector<float>&); 50 50 51 void apply(Filter*); 52 void dump(); 53 TextStream& externalRepresentation(TextStream&, int indent) const; 51 virtual void apply(Filter*); 52 virtual void dump(); 54 53 55 private: 56 FEColorMatrix(ColorMatrixType, const Vector<float>&); 54 virtual TextStream& externalRepresentation(TextStream&, int indention) const; 57 55 58 ColorMatrixType m_type; 59 Vector<float> m_values; 60 }; 56 private: 57 FEColorMatrix(ColorMatrixType, const Vector<float>&); 58 59 ColorMatrixType m_type; 60 Vector<float> m_values; 61 }; 61 62 62 63 } // namespace WebCore -
trunk/WebCore/platform/graphics/filters/FEComponentTransfer.cpp
r67847 r67929 1 1 /* 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 aintwith this library; see the file COPYING.LIB. If not, write to20 21 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 */ 23 23 24 24 #include "config.h" … … 37 37 typedef void (*TransferType)(unsigned char*, const ComponentTransferFunction&); 38 38 39 FEComponentTransfer::FEComponentTransfer(const ComponentTransferFunction& redFunc, 40 const ComponentTransferFunction& greenFunc,const ComponentTransferFunction& blueFunc, const ComponentTransferFunction& alphaFunc)39 FEComponentTransfer::FEComponentTransfer(const ComponentTransferFunction& redFunc, const ComponentTransferFunction& greenFunc, 40 const ComponentTransferFunction& blueFunc, const ComponentTransferFunction& alphaFunc) 41 41 : FilterEffect() 42 42 , m_redFunc(redFunc) … … 155 155 return; 156 156 157 if (! getEffectContext())157 if (!effectContext()) 158 158 return; 159 159 … … 168 168 (*callEffect[transferFunction[channel].type])(tables[channel], transferFunction[channel]); 169 169 170 IntRect drawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates());170 IntRect drawingRect = requestedRegionOfInputImageData(in->repaintRectInLocalCoordinates()); 171 171 RefPtr<ImageData> imageData(in->resultImage()->getUnmultipliedImageData(drawingRect)); 172 172 CanvasPixelArray* srcPixelArray(imageData->data()); -
trunk/WebCore/platform/graphics/filters/FEComponentTransfer.h
r67847 r67929 1 1 /* 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 aintwith this library; see the file COPYING.LIB. If not, write to18 19 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 */ 21 21 22 22 #ifndef FEComponentTransfer_h … … 31 31 namespace WebCore { 32 32 33 34 35 36 37 38 39 40 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 }; 41 41 42 43 44 45 , slope(0.0f)46 , intercept(0.0f)47 , amplitude(0.0f)48 , exponent(0.0f)49 , offset(0.0f)50 51 42 struct 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 } 52 52 53 53 ComponentTransferType type; 54 54 55 56 57 58 59 55 float slope; 56 float intercept; 57 float amplitude; 58 float exponent; 59 float offset; 60 60 61 62 61 Vector<float> tableValues; 62 }; 63 63 64 65 66 static PassRefPtr<FEComponentTransfer> create(const ComponentTransferFunction&,67 const ComponentTransferFunction&, const ComponentTransferFunction&, const ComponentTransferFunction&);64 class FEComponentTransfer : public FilterEffect { 65 public: 66 static PassRefPtr<FEComponentTransfer> create(const ComponentTransferFunction& redFunc, const ComponentTransferFunction& greenFunc, 67 const ComponentTransferFunction& blueFunc, const ComponentTransferFunction& alphaFunc); 68 68 69 70 69 ComponentTransferFunction redFunction() const; 70 void setRedFunction(const ComponentTransferFunction&); 71 71 72 73 72 ComponentTransferFunction greenFunction() const; 73 void setGreenFunction(const ComponentTransferFunction&); 74 74 75 76 75 ComponentTransferFunction blueFunction() const; 76 void setBlueFunction(const ComponentTransferFunction&); 77 77 78 79 78 ComponentTransferFunction alphaFunction() const; 79 void setAlphaFunction(const ComponentTransferFunction&); 80 80 81 void apply(Filter*); 82 void dump(); 83 TextStream& externalRepresentation(TextStream&, int indent) const; 81 virtual void apply(Filter*); 82 virtual void dump(); 84 83 85 private: 86 FEComponentTransfer(const ComponentTransferFunction&, const ComponentTransferFunction&, 87 const ComponentTransferFunction&, const ComponentTransferFunction&); 84 virtual TextStream& externalRepresentation(TextStream&, int indention) const; 88 85 89 ComponentTransferFunction m_redFunc; 90 ComponentTransferFunction m_greenFunc; 91 ComponentTransferFunction m_blueFunc; 92 ComponentTransferFunction m_alphaFunc; 93 }; 86 private: 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 }; 94 95 95 96 } // namespace WebCore -
trunk/WebCore/platform/graphics/filters/FEComposite.cpp
r67847 r67929 1 1 /* 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 aintwith this library; see the file COPYING.LIB. If not, write to19 20 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 */ 22 22 23 23 #include "config.h" … … 123 123 return; 124 124 125 GraphicsContext* filterContext = getEffectContext();125 GraphicsContext* filterContext = effectContext(); 126 126 if (!filterContext) 127 127 return; 128 128 129 FloatRect srcRect = FloatRect(0 .f, 0.f, -1.f, -1.f);129 FloatRect srcRect = FloatRect(0, 0, -1, -1); 130 130 switch (m_type) { 131 131 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())); 134 134 break; 135 135 case FECOMPOSITE_OPERATOR_IN: 136 136 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())); 139 139 filterContext->restore(); 140 140 break; 141 141 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); 144 144 break; 145 145 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); 148 148 break; 149 149 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); 152 152 break; 153 153 case FECOMPOSITE_OPERATOR_ARITHMETIC: { 154 IntRect effectADrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates());154 IntRect effectADrawingRect = requestedRegionOfInputImageData(in->repaintRectInLocalCoordinates()); 155 155 RefPtr<CanvasPixelArray> srcPixelArrayA(in->resultImage()->getPremultipliedImageData(effectADrawingRect)->data()); 156 156 157 IntRect effectBDrawingRect = calculateDrawingIntRect(in2->repaintRectInLocalCoordinates());157 IntRect effectBDrawingRect = requestedRegionOfInputImageData(in2->repaintRectInLocalCoordinates()); 158 158 RefPtr<ImageData> imageData(in2->resultImage()->getPremultipliedImageData(effectBDrawingRect)); 159 159 CanvasPixelArray* srcPixelArrayB(imageData->data()); -
trunk/WebCore/platform/graphics/filters/FEComposite.h
r67847 r67929 1 1 /* 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 aintwith this library; see the file COPYING.LIB. If not, write to18 19 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 */ 21 21 22 22 #ifndef FEComposite_h … … 60 60 void setK4(float); 61 61 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; 65 66 66 67 private: -
trunk/WebCore/platform/graphics/filters/FEGaussianBlur.cpp
r67847 r67929 1 1 /* 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 aintwith this library; see the file COPYING.LIB. If not, write to20 21 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 */ 23 23 24 24 #include "config.h" … … 133 133 return; 134 134 135 if (! getEffectContext())135 if (!effectContext()) 136 136 return; 137 137 138 138 setIsAlphaImage(in->isAlphaImage()); 139 139 140 IntRect effectDrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates());140 IntRect effectDrawingRect = requestedRegionOfInputImageData(in->repaintRectInLocalCoordinates()); 141 141 RefPtr<ImageData> srcImageData(in->resultImage()->getPremultipliedImageData(effectDrawingRect)); 142 142 IntRect imageRect(IntPoint(), resultImage()->size()); -
trunk/WebCore/platform/graphics/filters/FEGaussianBlur.h
r67847 r67929 1 1 /* 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 aintwith this library; see the file COPYING.LIB. If not, write to18 19 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 */ 21 21 22 22 #ifndef FEGaussianBlur_h … … 39 39 void setStdDeviationY(float); 40 40 41 void apply(Filter*); 42 void dump(); 43 TextStream& externalRepresentation(TextStream&, int indent) const; 41 static float calculateStdDeviation(float); 44 42 45 static float calculateStdDeviation(float); 43 virtual void apply(Filter*); 44 virtual void dump(); 45 46 virtual TextStream& externalRepresentation(TextStream&, int indention) const; 46 47 47 48 private: -
trunk/WebCore/platform/graphics/filters/Filter.h
r67847 r67929 1 1 /* 2 * 2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 3 3 * 4 * 5 * 6 * 7 * 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 8 * 9 * 10 * 11 * 12 * 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 13 * 14 * 15 * aintwith this library; see the file COPYING.LIB. If not, write to16 * 17 * 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 18 */ 19 19 -
trunk/WebCore/platform/graphics/filters/FilterEffect.cpp
r67847 r67929 57 57 } 58 58 59 IntRect FilterEffect:: calculateDrawingIntRect(const FloatRect& effectRect) const59 IntRect FilterEffect::requestedRegionOfInputImageData(const FloatRect& effectRect) const 60 60 { 61 61 ASSERT(m_effectBuffer); … … 65 65 } 66 66 67 FloatRect FilterEffect:: calculateDrawingRect(const FloatRect& srcRect) const67 FloatRect FilterEffect::drawingRegionOfInputImage(const FloatRect& srcRect) const 68 68 { 69 69 return FloatRect(FloatPoint(srcRect.x() - m_repaintRectInLocalCoordinates.x(), … … 77 77 } 78 78 79 GraphicsContext* FilterEffect:: getEffectContext()79 GraphicsContext* FilterEffect::effectContext() 80 80 { 81 81 IntRect bufferRect = enclosingIntRect(m_repaintRectInLocalCoordinates); -
trunk/WebCore/platform/graphics/filters/FilterEffect.h
r67847 r67929 50 50 // Creates the ImageBuffer for the current filter primitive result in the size of the 51 51 // repaintRect. Gives back the GraphicsContext of the own ImageBuffer. 52 GraphicsContext* getEffectContext();52 GraphicsContext* effectContext(); 53 53 54 54 FilterEffectVector& inputEffects() { return m_inputEffects; } … … 56 56 unsigned numberOfEffectInputs() const { return m_inputEffects.size(); } 57 57 58 FloatRect calculateDrawingRect(const FloatRect&) const;59 IntRect calculateDrawingIntRect(const FloatRect&) const;58 FloatRect drawingRegionOfInputImage(const FloatRect&) const; 59 IntRect requestedRegionOfInputImageData(const FloatRect&) const; 60 60 61 61 // Solid black image with different alpha values. -
trunk/WebCore/platform/graphics/filters/ImageBufferFilter.cpp
r51310 r67929 1 1 /* 2 * 3 * 2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 3 * Copyright (C) 2009 Brent Fulgham <bfulgham@webkit.org> 4 4 * 5 * 6 * 7 * 8 * 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 9 * 10 * 11 * 12 * 13 * 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 14 * 15 * 16 * aintwith this library; see the file COPYING.LIB. If not, write to17 * 18 * 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 19 */ 20 20 -
trunk/WebCore/platform/graphics/filters/ImageBufferFilter.h
r51310 r67929 1 1 /* 2 * 3 * 2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 3 * Copyright (C) 2009 Brent Fulgham <bfulgham@webkit.org> 4 4 * 5 * 6 * 7 * 8 * 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 9 * 10 * 11 * 12 * 13 * 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 14 * 15 * 16 * aintwith this library; see the file COPYING.LIB. If not, write to17 * 18 * 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 19 */ 20 20 -
trunk/WebCore/platform/graphics/filters/SourceAlpha.cpp
r67847 r67929 1 1 /* 2 * 2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 3 3 * 4 * 5 * 6 * 7 * 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 8 * 9 * 10 * 11 * 12 * 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 13 * 14 * 15 * aintwith this library; see the file COPYING.LIB. If not, write to16 * 17 * 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 18 */ 19 19 … … 58 58 void SourceAlpha::apply(Filter* filter) 59 59 { 60 GraphicsContext* filterContext = getEffectContext();60 GraphicsContext* filterContext = effectContext(); 61 61 if (!filterContext) 62 62 return; -
trunk/WebCore/platform/graphics/filters/SourceAlpha.h
r67847 r67929 1 1 /* 2 3 4 5 6 7 8 9 10 11 12 13 14 15 aintwith this library; see the file COPYING.LIB. If not, write to16 17 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 */ 19 19 20 20 #ifndef SourceAlpha_h … … 29 29 namespace WebCore { 30 30 31 32 33 31 class SourceAlpha : public FilterEffect { 32 public: 33 static PassRefPtr<SourceAlpha> create(); 34 34 35 35 static const AtomicString& effectName(); 36 36 37 void apply(Filter*); 38 void dump(); 39 TextStream& externalRepresentation(TextStream&, int indent) const; 37 virtual FloatRect determineFilterPrimitiveSubregion(Filter*); 40 38 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 46 private: 47 SourceAlpha() { } 48 }; 49 47 50 } //namespace WebCore 48 51 -
trunk/WebCore/platform/graphics/filters/SourceGraphic.cpp
r67847 r67929 1 1 /* 2 * 2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 3 3 * 4 * 5 * 6 * 7 * 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 8 * 9 * 10 * 11 * 12 * 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 13 * 14 * 15 * aintwith this library; see the file COPYING.LIB. If not, write to16 * 17 * 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 18 */ 19 19 … … 57 57 void SourceGraphic::apply(Filter* filter) 58 58 { 59 GraphicsContext* filterContext = getEffectContext();59 GraphicsContext* filterContext = effectContext(); 60 60 if (!filterContext) 61 61 return; -
trunk/WebCore/platform/graphics/filters/SourceGraphic.h
r67847 r67929 1 1 /* 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 aintwith this library; see the file COPYING.LIB. If not, write to17 18 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 */ 20 20 21 21 #ifndef SourceGraphic_h … … 30 30 namespace WebCore { 31 31 32 33 34 32 class SourceGraphic : public FilterEffect { 33 public: 34 static PassRefPtr<SourceGraphic> create(); 35 35 36 36 static const AtomicString& effectName(); 37 37 38 void apply(Filter*); 39 void dump(); 40 TextStream& externalRepresentation(TextStream&, int indent) const; 38 virtual FloatRect determineFilterPrimitiveSubregion(Filter*); 41 39 42 virtual bool isSourceInput() const { return true; }43 virtual FloatRect determineFilterPrimitiveSubregion(Filter*);40 virtual void apply(Filter*); 41 virtual void dump(); 44 42 45 private: 46 SourceGraphic() { } 47 }; 43 virtual bool isSourceInput() const { return true; } 44 45 virtual TextStream& externalRepresentation(TextStream&, int indention) const; 46 47 private: 48 SourceGraphic() { } 49 }; 50 48 51 } //namespace WebCore 49 52 -
trunk/WebCore/rendering/RenderTreeAsText.cpp
r65116 r67929 47 47 #include "RenderWidget.h" 48 48 #include "SelectionController.h" 49 #include "TextStream.h"50 49 #include <wtf/UnusedParam.h> 51 50 #include <wtf/Vector.h> … … 76 75 static void writeLayers(TextStream&, const RenderLayer* rootLayer, RenderLayer*, const IntRect& paintDirtyRect, int indent = 0, RenderAsTextBehavior behavior = RenderAsTextBehaviorNormal); 77 76 78 #if !ENABLE(SVG) 79 static TextStream &operator<<(TextStream& ts, const IntRect& r) 77 bool 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 84 TextStream& operator<<(TextStream& ts, const IntRect& r) 80 85 { 81 86 return ts << "at (" << r.x() << "," << r.y() << ") size " << r.width() << "x" << r.height(); 82 87 } 83 #endif 88 89 TextStream& operator<<(TextStream& ts, const IntPoint& p) 90 { 91 return ts << "(" << p.x() << "," << p.y() << ")"; 92 } 93 94 TextStream& 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 109 TextStream& 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 } 84 123 85 124 void writeIndent(TextStream& ts, int indent) -
trunk/WebCore/rendering/RenderTreeAsText.h
r65021 r67929 26 26 #ifndef RenderTreeAsText_h 27 27 #define RenderTreeAsText_h 28 #include "TextStream.h" 28 29 29 30 #include <wtf/Forward.h> 31 #include <wtf/MathExtras.h> 30 32 31 33 namespace WebCore { 32 34 33 35 class Element; 36 class FloatPoint; 37 class FloatSize; 34 38 class Frame; 39 class IntPoint; 40 class IntRect; 35 41 class RenderObject; 36 42 class TextStream; … … 60 66 }; 61 67 68 TextStream& operator<<(TextStream&, const IntPoint&); 69 TextStream& operator<<(TextStream&, const IntRect&); 70 TextStream& operator<<(TextStream&, const FloatPoint&); 71 TextStream& operator<<(TextStream&, const FloatSize&); 72 73 template<typename Item> 74 TextStream& 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 62 89 // Helper function shared with SVGRenderTreeAsText 63 90 String quoteAndEscapeNonPrintables(const String&); … … 67 94 String markerTextForListItem(Element*); 68 95 96 bool hasFractions(double val); 97 69 98 } // namespace WebCore 70 99 -
trunk/WebCore/rendering/SVGRenderTreeAsText.cpp
r66955 r67929 125 125 } 126 126 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 145 127 TextStream& operator<<(TextStream& ts, const FloatRect &r) 146 128 { … … 165 147 else 166 148 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 else176 ts << int(p.x());177 ts << ",";178 if (hasFractions(p.y()))179 ts << p.y();180 else181 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 else191 ts << int(s.width());192 ts << " height=";193 if (hasFractions(s.height()))194 ts << s.height();195 else196 ts << int(s.height());197 149 return ts; 198 150 } -
trunk/WebCore/rendering/SVGRenderTreeAsText.h
r65116 r67929 34 34 35 35 class Color; 36 class FloatPoint;37 36 class FloatRect; 38 37 class FloatSize; 39 class IntPoint;40 class IntRect;41 38 class Node; 42 39 class RenderBlock; … … 64 61 // helper operators defined used in various classes to dump the render tree. 65 62 TextStream& operator<<(TextStream&, const AffineTransform&); 66 TextStream& operator<<(TextStream&, const IntRect&);67 63 TextStream& operator<<(TextStream&, const Color&); 68 TextStream& operator<<(TextStream&, const IntPoint&);69 TextStream& operator<<(TextStream&, const FloatSize&);70 64 TextStream& operator<<(TextStream&, const FloatRect&); 71 TextStream& operator<<(TextStream&, const FloatPoint&);72 65 73 66 // helper operators specific to dumping the render tree. these are used in various classes to dump the render tree … … 81 74 for (unsigned i = 0; i < v.size(); i++) { 82 75 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];98 76 if (i < v.size() - 1) 99 77 ts << ", "; -
trunk/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp
r67847 r67929 30 30 #include "Filter.h" 31 31 #include "ImageData.h" 32 #include "SVGRenderTreeAsText.h"33 32 34 33 namespace WebCore { … … 379 378 return; 380 379 381 if (! getEffectContext())380 if (!effectContext()) 382 381 return; 383 382 384 383 IntRect imageRect(IntPoint(), resultImage()->size()); 385 IntRect effectDrawingRect = calculateDrawingIntRect(in->filterPrimitiveSubregion());384 IntRect effectDrawingRect = requestedRegionOfInputImageData(in->filterPrimitiveSubregion()); 386 385 387 386 RefPtr<CanvasPixelArray> srcPixelArray; -
trunk/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h
r67847 r67929 73 73 void setPreserveAlpha(bool); 74 74 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; 78 79 79 80 private: -
trunk/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp
r67847 r67929 26 26 27 27 #include "SVGLightSource.h" 28 #include "SVGRenderTreeAsText.h"29 28 30 29 namespace WebCore { -
trunk/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h
r67847 r67929 54 54 void setLightSource(PassRefPtr<LightSource>); 55 55 56 void dump(); 57 TextStream& externalRepresentation(TextStream&, int indent) const; 56 virtual void dump(); 57 58 virtual TextStream& externalRepresentation(TextStream&, int indention) const; 58 59 59 60 private: 60 FEDiffuseLighting(const Color&, float, float, 61 float, float, PassRefPtr<LightSource>); 61 FEDiffuseLighting(const Color&, float, float, float, float, PassRefPtr<LightSource>); 62 62 }; 63 63 -
trunk/WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp
r67847 r67929 30 30 #include "GraphicsContext.h" 31 31 #include "ImageData.h" 32 #include "SVGRenderTreeAsText.h"33 32 34 33 namespace WebCore { … … 90 89 return; 91 90 92 if (! getEffectContext())91 if (!effectContext()) 93 92 return; 94 93 95 IntRect effectADrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates());94 IntRect effectADrawingRect = requestedRegionOfInputImageData(in->repaintRectInLocalCoordinates()); 96 95 RefPtr<CanvasPixelArray> srcPixelArrayA(in->resultImage()->getPremultipliedImageData(effectADrawingRect)->data()); 97 96 98 IntRect effectBDrawingRect = calculateDrawingIntRect(in2->repaintRectInLocalCoordinates());97 IntRect effectBDrawingRect = requestedRegionOfInputImageData(in2->repaintRectInLocalCoordinates()); 99 98 RefPtr<CanvasPixelArray> srcPixelArrayB(in2->resultImage()->getUnmultipliedImageData(effectBDrawingRect)->data()); 100 99 -
trunk/WebCore/svg/graphics/filters/SVGFEDisplacementMap.h
r67847 r67929 30 30 namespace WebCore { 31 31 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); 32 enum ChannelSelectorType { 33 CHANNEL_UNKNOWN = 0, 34 CHANNEL_R = 1, 35 CHANNEL_G = 2, 36 CHANNEL_B = 3, 37 CHANNEL_A = 4 38 }; 43 39 44 ChannelSelectorType xChannelSelector() const; 45 void setXChannelSelector(const ChannelSelectorType); 40 class FEDisplacementMap : public FilterEffect { 41 public: 42 static PassRefPtr<FEDisplacementMap> create(ChannelSelectorType xChannelSelector, ChannelSelectorType yChannelSelector, float); 46 43 47 ChannelSelectorType yChannelSelector() const;48 void setYChannelSelector(const ChannelSelectorType);44 ChannelSelectorType xChannelSelector() const; 45 void setXChannelSelector(const ChannelSelectorType); 49 46 50 float scale() const;51 void setScale(float scale);47 ChannelSelectorType yChannelSelector() const; 48 void setYChannelSelector(const ChannelSelectorType); 52 49 53 void apply(Filter*); 54 void dump(); 55 TextStream& externalRepresentation(TextStream&, int indent) const; 50 float scale() const; 51 void setScale(float scale); 56 52 57 private:58 FEDisplacementMap(ChannelSelectorType, ChannelSelectorType, float);53 virtual void apply(Filter*); 54 virtual void dump(); 59 55 60 ChannelSelectorType m_xChannelSelector; 61 ChannelSelectorType m_yChannelSelector; 62 float m_scale; 63 }; 56 virtual TextStream& externalRepresentation(TextStream&, int indention) const; 57 58 private: 59 FEDisplacementMap(ChannelSelectorType xChannelSelector, ChannelSelectorType yChannelSelector, float); 60 61 ChannelSelectorType m_xChannelSelector; 62 ChannelSelectorType m_yChannelSelector; 63 float m_scale; 64 }; 64 65 65 66 } // namespace WebCore -
trunk/WebCore/svg/graphics/filters/SVGFEFlood.cpp
r67847 r67929 28 28 #include "Filter.h" 29 29 #include "GraphicsContext.h" 30 #include "SVGRenderTreeAsText.h"31 30 32 31 namespace WebCore { 33 32 34 FEFlood::FEFlood(const Color& floodColor, const float&floodOpacity)33 FEFlood::FEFlood(const Color& floodColor, float floodOpacity) 35 34 : FilterEffect() 36 35 , m_floodColor(floodColor) … … 39 38 } 40 39 41 PassRefPtr<FEFlood> FEFlood::create(const Color& floodColor, const float&floodOpacity)40 PassRefPtr<FEFlood> FEFlood::create(const Color& floodColor, float floodOpacity) 42 41 { 43 42 return adoptRef(new FEFlood(floodColor, floodOpacity)); … … 66 65 void FEFlood::apply(Filter*) 67 66 { 68 GraphicsContext* filterContext = getEffectContext();67 GraphicsContext* filterContext = effectContext(); 69 68 if (!filterContext) 70 69 return; … … 83 82 ts << "[feFlood"; 84 83 FilterEffect::externalRepresentation(ts); 85 ts << " flood-color=\"" << floodColor() << "\" "84 ts << " flood-color=\"" << floodColor().name() << "\" " 86 85 << "flood-opacity=\"" << floodOpacity() << "\"]\n"; 87 86 return ts; -
trunk/WebCore/svg/graphics/filters/SVGFEFlood.h
r64579 r67929 30 30 namespace WebCore { 31 31 32 33 34 static PassRefPtr<FEFlood> create(const Color&, const float&);32 class FEFlood : public FilterEffect { 33 public: 34 static PassRefPtr<FEFlood> create(const Color&, float); 35 35 36 37 36 Color floodColor() const; 37 void setFloodColor(const Color &); 38 38 39 40 39 float floodOpacity() const; 40 void setFloodOpacity(float); 41 41 42 void apply(Filter*); 43 void dump(); 44 TextStream& externalRepresentation(TextStream&, int indent) const; 42 virtual void apply(Filter*); 43 virtual void dump(); 45 44 46 private: 47 FEFlood(const Color&, const float&); 45 virtual TextStream& externalRepresentation(TextStream&, int indention) const; 48 46 49 Color m_floodColor; 50 float m_floodOpacity; 51 }; 47 private: 48 FEFlood(const Color&, float); 49 50 Color m_floodColor; 51 float m_floodOpacity; 52 }; 52 53 53 54 } // namespace WebCore -
trunk/WebCore/svg/graphics/filters/SVGFEImage.cpp
r67847 r67929 30 30 #include "GraphicsContext.h" 31 31 #include "SVGPreserveAspectRatio.h" 32 #include "SVGRenderTreeAsText.h"33 32 34 33 namespace WebCore { 35 34 36 FEImage::FEImage(RefPtr<Image> image, SVGPreserveAspectRatiopreserveAspectRatio)35 FEImage::FEImage(RefPtr<Image> image, const SVGPreserveAspectRatio& preserveAspectRatio) 37 36 : FilterEffect() 38 37 , m_image(image) … … 41 40 } 42 41 43 PassRefPtr<FEImage> FEImage::create(RefPtr<Image> image, SVGPreserveAspectRatiopreserveAspectRatio)42 PassRefPtr<FEImage> FEImage::create(RefPtr<Image> image, const SVGPreserveAspectRatio& preserveAspectRatio) 44 43 { 45 44 return adoptRef(new FEImage(image, preserveAspectRatio)); … … 51 50 return; 52 51 53 GraphicsContext* filterContext = getEffectContext();52 GraphicsContext* filterContext = effectContext(); 54 53 if (!filterContext) 55 54 return; -
trunk/WebCore/svg/graphics/filters/SVGFEImage.h
r64579 r67929 30 30 namespace WebCore { 31 31 32 33 34 static PassRefPtr<FEImage> create(RefPtr<Image>, SVGPreserveAspectRatio);32 class FEImage : public FilterEffect { 33 public: 34 static PassRefPtr<FEImage> create(RefPtr<Image>, const SVGPreserveAspectRatio&); 35 35 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(); 42 38 43 RefPtr<Image> m_image; 44 SVGPreserveAspectRatio m_preserveAspectRatio; 45 }; 39 virtual TextStream& externalRepresentation(TextStream&, int indention) const; 40 41 private: 42 FEImage(RefPtr<Image>, const SVGPreserveAspectRatio&); 43 44 RefPtr<Image> m_image; 45 SVGPreserveAspectRatio m_preserveAspectRatio; 46 }; 46 47 47 48 } // namespace WebCore -
trunk/WebCore/svg/graphics/filters/SVGFELighting.cpp
r67847 r67929 248 248 return; 249 249 250 if (! getEffectContext())250 if (!effectContext()) 251 251 return; 252 252 253 253 setIsAlphaImage(false); 254 254 255 IntRect effectDrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates());255 IntRect effectDrawingRect = requestedRegionOfInputImageData(in->repaintRectInLocalCoordinates()); 256 256 RefPtr<ImageData> srcImageData(in->resultImage()->getUnmultipliedImageData(effectDrawingRect)); 257 257 CanvasPixelArray* srcPixelArray(srcImageData->data()); -
trunk/WebCore/svg/graphics/filters/SVGFELighting.h
r67847 r67929 43 43 class FELighting : public FilterEffect { 44 44 public: 45 v oid apply(Filter*);45 virtual void apply(Filter*); 46 46 47 47 protected: -
trunk/WebCore/svg/graphics/filters/SVGFEMerge.cpp
r67847 r67929 27 27 #include "Filter.h" 28 28 #include "GraphicsContext.h" 29 #include "SVGRenderTreeAsText.h"30 29 31 30 namespace WebCore { … … 52 51 } 53 52 54 GraphicsContext* filterContext = getEffectContext();53 GraphicsContext* filterContext = effectContext(); 55 54 if (!filterContext) 56 55 return; … … 58 57 for (unsigned i = 0; i < size; ++i) { 59 58 FilterEffect* in = inputEffect(i); 60 filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, calculateDrawingRect(in->repaintRectInLocalCoordinates()));59 filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, drawingRegionOfInputImage(in->repaintRectInLocalCoordinates())); 61 60 } 62 61 } -
trunk/WebCore/svg/graphics/filters/SVGFEMerge.h
r67847 r67929 30 30 namespace WebCore { 31 31 32 33 34 32 class FEMerge : public FilterEffect { 33 public: 34 static PassRefPtr<FEMerge> create(); 35 35 36 void apply(Filter*); 37 void dump(); 38 TextStream& externalRepresentation(TextStream&, int indent) const; 36 virtual void apply(Filter*); 37 virtual void dump(); 39 38 40 private: 41 FEMerge(); 42 }; 39 virtual TextStream& externalRepresentation(TextStream&, int indention) const; 40 41 private: 42 FEMerge(); 43 }; 43 44 44 45 } // namespace WebCore -
trunk/WebCore/svg/graphics/filters/SVGFEMorphology.cpp
r67847 r67929 29 29 #include "Filter.h" 30 30 #include "ImageData.h" 31 #include "SVGRenderTreeAsText.h"32 31 33 32 #include <wtf/Vector.h> … … 88 87 return; 89 88 90 if (! getEffectContext())89 if (!effectContext()) 91 90 return; 92 91 … … 99 98 100 99 IntRect imageRect(IntPoint(), resultImage()->size()); 101 IntRect effectDrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates());100 IntRect effectDrawingRect = requestedRegionOfInputImageData(in->repaintRectInLocalCoordinates()); 102 101 RefPtr<CanvasPixelArray> srcPixelArray(in->resultImage()->getPremultipliedImageData(effectDrawingRect)->data()); 103 102 RefPtr<ImageData> imageData = ImageData::create(imageRect.width(), imageRect.height()); -
trunk/WebCore/svg/graphics/filters/SVGFEMorphology.h
r67847 r67929 29 29 namespace WebCore { 30 30 31 32 33 FEMORPHOLOGY_OPERATOR_ERODE= 1,34 FEMORPHOLOGY_OPERATOR_DILATE= 235 31 enum MorphologyOperatorType { 32 FEMORPHOLOGY_OPERATOR_UNKNOWN = 0, 33 FEMORPHOLOGY_OPERATOR_ERODE = 1, 34 FEMORPHOLOGY_OPERATOR_DILATE = 2 35 }; 36 36 37 38 39 40 41 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); 42 42 43 44 43 float radiusX() const; 44 void setRadiusX(float); 45 45 46 47 46 float radiusY() const; 47 void setRadiusY(float); 48 48 49 void apply(Filter*); 50 void dump(); 51 TextStream& externalRepresentation(TextStream&, int indent) const; 49 virtual void apply(Filter*); 50 virtual void dump(); 52 51 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 54 private: 55 FEMorphology(MorphologyOperatorType, float radiusX, float radiusY); 56 57 MorphologyOperatorType m_type; 58 float m_radiusX; 59 float m_radiusY; 60 }; 60 61 61 62 } // namespace WebCore -
trunk/WebCore/svg/graphics/filters/SVGFEOffset.cpp
r67847 r67929 28 28 #include "Filter.h" 29 29 #include "GraphicsContext.h" 30 #include "SVGRenderTreeAsText.h"31 30 32 31 namespace WebCore { … … 71 70 return; 72 71 73 GraphicsContext* filterContext = getEffectContext();72 GraphicsContext* filterContext = effectContext(); 74 73 if (!filterContext) 75 74 return; -
trunk/WebCore/svg/graphics/filters/SVGFEOffset.h
r67847 r67929 29 29 namespace WebCore { 30 30 31 32 33 static PassRefPtr<FEOffset> create(float, float);31 class FEOffset : public FilterEffect { 32 public: 33 static PassRefPtr<FEOffset> create(float dx, float dy); 34 34 35 36 35 float dx() const; 36 void setDx(float); 37 37 38 39 38 float dy() const; 39 void setDy(float); 40 40 41 void apply(Filter*); 42 void dump(); 43 TextStream& externalRepresentation(TextStream&, int indent) const; 41 virtual void apply(Filter*); 42 virtual void dump(); 44 43 45 private: 46 FEOffset(float, float); 44 virtual TextStream& externalRepresentation(TextStream&, int indention) const; 47 45 48 float m_dx; 49 float m_dy; 50 }; 46 private: 47 FEOffset(float dx, float dy); 48 49 float m_dx; 50 float m_dy; 51 }; 51 52 52 53 } // namespace WebCore -
trunk/WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp
r67847 r67929 26 26 27 27 #include "SVGLightSource.h" 28 #include "SVGRenderTreeAsText.h"29 28 30 29 namespace WebCore { -
trunk/WebCore/svg/graphics/filters/SVGFESpecularLighting.h
r67847 r67929 55 55 void setLightSource(PassRefPtr<LightSource>); 56 56 57 void dump(); 58 TextStream& externalRepresentation(TextStream&, int indent) const; 57 virtual void dump(); 58 59 virtual TextStream& externalRepresentation(TextStream&, int indention) const; 59 60 60 61 private: -
trunk/WebCore/svg/graphics/filters/SVGFETile.cpp
r67847 r67929 28 28 #include "GraphicsContext.h" 29 29 #include "Pattern.h" 30 #include "SVGRenderTreeAsText.h"31 30 32 31 namespace WebCore { … … 57 56 return; 58 57 59 GraphicsContext* filterContext = getEffectContext();58 GraphicsContext* filterContext = effectContext(); 60 59 if (!filterContext) 61 60 return; -
trunk/WebCore/svg/graphics/filters/SVGFETile.h
r67847 r67929 29 29 namespace WebCore { 30 30 31 32 33 31 class FETile : public FilterEffect { 32 public: 33 static PassRefPtr<FETile> create(); 34 34 35 void apply(Filter*); 36 void dump(); 37 TextStream& externalRepresentation(TextStream&, int indent) const; 35 virtual void apply(Filter*); 36 virtual void dump(); 38 37 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 42 private: 43 FETile(); 44 }; 44 45 45 46 } // namespace WebCore -
trunk/WebCore/svg/graphics/filters/SVGFETurbulence.cpp
r65590 r67929 30 30 #include "Filter.h" 31 31 #include "ImageData.h" 32 #include "SVGRenderTreeAsText.h"33 32 34 33 #include <wtf/MathExtras.h> … … 323 322 void FETurbulence::apply(Filter* filter) 324 323 { 325 if (! getEffectContext())324 if (!effectContext()) 326 325 return; 327 326 -
trunk/WebCore/svg/graphics/filters/SVGFETurbulence.h
r64579 r67929 59 59 void setStitchTiles(bool); 60 60 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; 64 65 65 66 private:
Note: See TracChangeset
for help on using the changeset viewer.