Changeset 50718 in webkit
- Timestamp:
- Nov 9, 2009 11:23:39 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r50710 r50718 1 2009-11-09 Dirk Schulze <krit@webkit.org> 2 3 Reviewed by Oliver Hunt. 4 5 Test for SVG filter effect feDisplacementMap. 6 7 * platform/mac/svg/filters/feDisplacementMap-expected.checksum: Added. 8 * platform/mac/svg/filters/feDisplacementMap-expected.png: Added. 9 * platform/mac/svg/filters/feDisplacementMap-expected.txt: Added. 10 * svg/filters/feDisplacementMap.svg: Added. 11 1 12 2009-11-03 Shinichiro Hamaji <hamaji@chromium.org> 2 13 -
trunk/WebCore/ChangeLog
r50702 r50718 1 2009-11-09 Dirk Schulze <krit@webkit.org> 2 3 Reviewed by Oliver Hunt. 4 5 SVG feDisplacementMap is not implemented 6 [https://bugs.webkit.org/show_bug.cgi?id=31255] 7 8 This is the implementation of the SVG filter effect 9 feDisplacementMap. 10 11 Test: svg/filters/feDisplacementMap.svg 12 13 * svg/graphics/filters/SVGFEDisplacementMap.cpp: 14 (WebCore::FEDisplacementMap::apply): 15 1 16 2009-11-09 Kent Tamura <tkent@chromium.org> 2 17 -
trunk/WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp
r44296 r50718 3 3 2004, 2005 Rob Buis <buis@kde.org> 4 4 2005 Eric Seidel <eric@webkit.org> 5 2009 Dirk Schulze <krit@webkit.org> 5 6 6 7 This library is free software; you can redistribute it and/or … … 24 25 #if ENABLE(SVG) && ENABLE(FILTERS) 25 26 #include "SVGFEDisplacementMap.h" 27 28 #include "CanvasPixelArray.h" 29 #include "Filter.h" 30 #include "GraphicsContext.h" 31 #include "ImageData.h" 26 32 #include "SVGRenderTreeAsText.h" 27 #include "Filter.h"28 33 29 34 namespace WebCore { … … 76 81 } 77 82 78 void FEDisplacementMap::apply(Filter* )83 void FEDisplacementMap::apply(Filter* filter) 79 84 { 85 m_in->apply(filter); 86 m_in2->apply(filter); 87 if (!m_in->resultImage() || !m_in2->resultImage()) 88 return; 89 90 if (m_xChannelSelector == CHANNEL_UNKNOWN || m_yChannelSelector == CHANNEL_UNKNOWN) 91 return; 92 93 if (!getEffectContext()) 94 return; 95 96 IntRect effectADrawingRect = calculateDrawingIntRect(m_in->subRegion()); 97 RefPtr<CanvasPixelArray> srcPixelArrayA(m_in->resultImage()->getPremultipliedImageData(effectADrawingRect)->data()); 98 99 IntRect effectBDrawingRect = calculateDrawingIntRect(m_in2->subRegion()); 100 RefPtr<CanvasPixelArray> srcPixelArrayB(m_in2->resultImage()->getUnmultipliedImageData(effectBDrawingRect)->data()); 101 102 IntRect imageRect(IntPoint(), resultImage()->size()); 103 RefPtr<ImageData> imageData = ImageData::create(imageRect.width(), imageRect.height()); 104 105 ASSERT(srcPixelArrayA->length() == srcPixelArrayB->length()); 106 107 float scale = m_scale / 255.f; 108 float scaleAdjustment = 0.5f - 0.5f * m_scale; 109 int stride = imageRect.width() * 4; 110 for (int y = 0; y < imageRect.height(); ++y) { 111 int line = y * stride; 112 for (int x = 0; x < imageRect.width(); ++x) { 113 int dstIndex = line + x * 4; 114 int srcX = x + static_cast<int>(scale * srcPixelArrayB->get(dstIndex + m_xChannelSelector - 1) + scaleAdjustment); 115 int srcY = y + static_cast<int>(scale * srcPixelArrayB->get(dstIndex + m_yChannelSelector - 1) + scaleAdjustment); 116 for (unsigned channel = 0; channel < 4; ++channel) { 117 if (srcX < 0 || srcX >= imageRect.width() || srcY < 0 || srcY >= imageRect.height()) 118 imageData->data()->set(dstIndex + channel, static_cast<unsigned char>(0)); 119 else { 120 unsigned char pixelValue = srcPixelArrayA->get(srcY * stride + srcX * 4 + channel); 121 imageData->data()->set(dstIndex + channel, pixelValue); 122 } 123 } 124 125 } 126 } 127 resultImage()->putPremultipliedImageData(imageData.get(), imageRect, IntPoint()); 80 128 } 81 129
Note: See TracChangeset
for help on using the changeset viewer.