summaryrefslogtreecommitdiffstats
path: root/WebCore/svg/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/svg/graphics')
-rw-r--r--WebCore/svg/graphics/SVGImage.cpp9
-rw-r--r--WebCore/svg/graphics/SVGImage.h3
-rw-r--r--WebCore/svg/graphics/filters/SVGFEMerge.cpp2
-rw-r--r--WebCore/svg/graphics/filters/SVGFEOffset.cpp2
-rw-r--r--WebCore/svg/graphics/filters/SVGFETile.cpp4
-rw-r--r--WebCore/svg/graphics/filters/SVGFETurbulence.cpp12
-rw-r--r--WebCore/svg/graphics/filters/SVGFilterBuilder.h2
7 files changed, 18 insertions, 16 deletions
diff --git a/WebCore/svg/graphics/SVGImage.cpp b/WebCore/svg/graphics/SVGImage.cpp
index 990e41f..6608c9e 100644
--- a/WebCore/svg/graphics/SVGImage.cpp
+++ b/WebCore/svg/graphics/SVGImage.cpp
@@ -221,12 +221,13 @@ NativeImagePtr SVGImage::nativeImageForCurrentFrame()
if (!m_frameCache) {
if (!m_page)
return 0;
- m_frameCache = ImageBuffer::create(size());
- if (!m_frameCache) // failed to allocate image
+ OwnPtr<ImageBuffer> buffer = ImageBuffer::create(size());
+ if (!buffer) // failed to allocate image
return 0;
- draw(m_frameCache->context(), rect(), rect(), DeviceColorSpace, CompositeSourceOver);
+ draw(buffer->context(), rect(), rect(), DeviceColorSpace, CompositeSourceOver);
+ m_frameCache = buffer->copyImage();
}
- return m_frameCache->image()->nativeImageForCurrentFrame();
+ return m_frameCache->nativeImageForCurrentFrame();
}
bool SVGImage::dataChanged(bool allDataReceived)
diff --git a/WebCore/svg/graphics/SVGImage.h b/WebCore/svg/graphics/SVGImage.h
index 1936626..01eae71 100644
--- a/WebCore/svg/graphics/SVGImage.h
+++ b/WebCore/svg/graphics/SVGImage.h
@@ -33,7 +33,6 @@
namespace WebCore {
- class ImageBuffer;
class Page;
class SVGImageChromeClient;
@@ -72,7 +71,7 @@ namespace WebCore {
OwnPtr<SVGImageChromeClient> m_chromeClient;
OwnPtr<Page> m_page;
- OwnPtr<ImageBuffer> m_frameCache;
+ RefPtr<Image> m_frameCache;
};
}
diff --git a/WebCore/svg/graphics/filters/SVGFEMerge.cpp b/WebCore/svg/graphics/filters/SVGFEMerge.cpp
index 649f670..11c7407 100644
--- a/WebCore/svg/graphics/filters/SVGFEMerge.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEMerge.cpp
@@ -79,7 +79,7 @@ void FEMerge::apply(Filter* filter)
for (unsigned i = 0; i < m_mergeInputs.size(); i++) {
FloatRect destRect = calculateDrawingRect(m_mergeInputs[i]->scaledSubRegion());
- filterContext->drawImage(m_mergeInputs[i]->resultImage()->image(), DeviceColorSpace, destRect);
+ filterContext->drawImageBuffer(m_mergeInputs[i]->resultImage(), DeviceColorSpace, destRect);
}
}
diff --git a/WebCore/svg/graphics/filters/SVGFEOffset.cpp b/WebCore/svg/graphics/filters/SVGFEOffset.cpp
index f6c1a3c..e12b8e0 100644
--- a/WebCore/svg/graphics/filters/SVGFEOffset.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEOffset.cpp
@@ -91,7 +91,7 @@ void FEOffset::apply(Filter* filter)
m_in->scaledSubRegion().width(),
m_in->scaledSubRegion().height());
- filterContext->drawImage(m_in->resultImage()->image(), DeviceColorSpace, dstRect);
+ filterContext->drawImageBuffer(m_in->resultImage(), DeviceColorSpace, dstRect);
}
void FEOffset::dump()
diff --git a/WebCore/svg/graphics/filters/SVGFETile.cpp b/WebCore/svg/graphics/filters/SVGFETile.cpp
index fc172ee..56cbc1e 100644
--- a/WebCore/svg/graphics/filters/SVGFETile.cpp
+++ b/WebCore/svg/graphics/filters/SVGFETile.cpp
@@ -72,8 +72,8 @@ void FETile::apply(Filter* filter)
OwnPtr<ImageBuffer> tileImage = ImageBuffer::create(tileRect.size());
GraphicsContext* tileImageContext = tileImage->context();
- tileImageContext->drawImage(m_in->resultImage()->image(), DeviceColorSpace, IntPoint());
- RefPtr<Pattern> pattern = Pattern::create(tileImage->image(), true, true);
+ tileImageContext->drawImageBuffer(m_in->resultImage(), DeviceColorSpace, IntPoint());
+ RefPtr<Pattern> pattern = Pattern::create(tileImage->copyImage(), true, true);
AffineTransform matrix;
matrix.translate(m_in->scaledSubRegion().x() - scaledSubRegion().x(), m_in->scaledSubRegion().y() - scaledSubRegion().y());
diff --git a/WebCore/svg/graphics/filters/SVGFETurbulence.cpp b/WebCore/svg/graphics/filters/SVGFETurbulence.cpp
index 7bf40ed..399f7fc 100644
--- a/WebCore/svg/graphics/filters/SVGFETurbulence.cpp
+++ b/WebCore/svg/graphics/filters/SVGFETurbulence.cpp
@@ -181,7 +181,7 @@ inline void FETurbulence::initPaint(PaintingData& paintingData)
gradient[1] /= normalizationFactor;
}
}
- for (int i = s_blockSize - 1; i >= 0; --i) {
+ for (int i = s_blockSize - 1; i > 0; --i) {
int k = paintingData.latticeSelector[i];
int j = paintingData.random() % s_blockSize;
ASSERT(j >= 0);
@@ -311,10 +311,12 @@ unsigned char FETurbulence::calculateTurbulenceValueForPoint(PaintingData& paint
}
}
- // Clamp result
- turbulenceFunctionResult = std::max(std::min(turbulenceFunctionResult, 255.f), 0.f);
+ // The value of turbulenceFunctionResult comes from ((turbulenceFunctionResult * 255) + 255) / 2 by fractalNoise
+ // and (turbulenceFunctionResult * 255) by turbulence.
if (m_type == FETURBULENCE_TYPE_FRACTALNOISE)
- return static_cast<unsigned char>(turbulenceFunctionResult * 127.5f + 127.5f); // It comes form (turbulenceFunctionResult * 255 + 255) / 2
+ turbulenceFunctionResult = turbulenceFunctionResult * 0.5f + 0.5f;
+ // Clamp result
+ turbulenceFunctionResult = std::max(std::min(turbulenceFunctionResult, 1.f), 0.f);
return static_cast<unsigned char>(turbulenceFunctionResult * 255);
}
@@ -328,7 +330,7 @@ void FETurbulence::apply(Filter* filter)
return;
RefPtr<ImageData> imageData = ImageData::create(imageRect.width(), imageRect.height());
- PaintingData paintingData(floorf(fabsf(m_seed)), imageRect.size());
+ PaintingData paintingData(m_seed, imageRect.size());
initPaint(paintingData);
FloatRect filterRegion = filter->filterRegion();
diff --git a/WebCore/svg/graphics/filters/SVGFilterBuilder.h b/WebCore/svg/graphics/filters/SVGFilterBuilder.h
index 3325dac..4ef6ffe 100644
--- a/WebCore/svg/graphics/filters/SVGFilterBuilder.h
+++ b/WebCore/svg/graphics/filters/SVGFilterBuilder.h
@@ -23,12 +23,12 @@
#include "config.h"
#if ENABLE(SVG) && ENABLE(FILTERS)
-#include "AtomicStringHash.h"
#include "FilterEffect.h"
#include "PlatformString.h"
#include <wtf/HashMap.h>
#include <wtf/PassRefPtr.h>
+#include <wtf/text/AtomicStringHash.h>
namespace WebCore {