Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (156225 => 156226)
--- trunk/Source/WebCore/CMakeLists.txt 2013-09-21 08:03:45 UTC (rev 156225)
+++ trunk/Source/WebCore/CMakeLists.txt 2013-09-21 10:52:25 UTC (rev 156226)
@@ -1903,9 +1903,9 @@
platform/graphics/LayoutBoxExtent.cpp
platform/graphics/LayoutRect.cpp
platform/graphics/GeneratedImage.cpp
- platform/graphics/GeneratorGeneratedImage.cpp
platform/graphics/GlyphPageTreeNode.cpp
platform/graphics/Gradient.cpp
+ platform/graphics/GradientImage.cpp
platform/graphics/GraphicsContext.cpp
platform/graphics/GraphicsLayer.cpp
platform/graphics/GraphicsLayerAnimation.cpp
Modified: trunk/Source/WebCore/ChangeLog (156225 => 156226)
--- trunk/Source/WebCore/ChangeLog 2013-09-21 08:03:45 UTC (rev 156225)
+++ trunk/Source/WebCore/ChangeLog 2013-09-21 10:52:25 UTC (rev 156226)
@@ -1,3 +1,43 @@
+2013-09-21 Tim Horton <[email protected]>
+
+ GeneratorGeneratedImage should be called GradientImage
+ https://bugs.webkit.org/show_bug.cgi?id=121085
+
+ Reviewed by Simon Fraser.
+
+ No new tests, just a refactor.
+
+ r150053 removed the concept of a Generator, making GeneratorGeneratedImage
+ take a Gradient. This leaves GeneratorGeneratedImage's name not making a
+ whole lot of sense, so let's rename it to GradientImage.
+
+ * CMakeLists.txt:
+ * GNUmakefile.list.am:
+ * Target.pri:
+ * WebCore.vcxproj/WebCore.vcxproj:
+ * WebCore.vcxproj/WebCore.vcxproj.filters:
+ * WebCore.xcodeproj/project.pbxproj:
+ * css/CSSGradientValue.cpp:
+ (WebCore::CSSGradientValue::image):
+ * platform/graphics/BitmapImage.h:
+ * platform/graphics/GradientImage.cpp: Renamed from Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp.
+ (WebCore::GradientImage::draw):
+ (WebCore::GradientImage::drawPattern):
+ * platform/graphics/GradientImage.h: Renamed from Source/WebCore/platform/graphics/GeneratorGeneratedImage.h.
+ * platform/graphics/Image.h:
+ * platform/graphics/ImageBuffer.h:
+ Rename.
+
+ * css/CSSImageGeneratorValue.cpp:
+ (WebCore::CSSImageGeneratorValue::cachedImageForSize):
+ (WebCore::CSSImageGeneratorValue::saveCachedImageForSize):
+ (WebCore::CSSImageGeneratorValue::CachedGeneratedImage::CachedGeneratedImage):
+ * css/CSSImageGeneratorValue.h:
+ (WebCore::CSSImageGeneratorValue::CachedGeneratedImage::image):
+ Drive-by, the CSSImageGeneratorValue generated image cache should be
+ in terms of GeneratedImage, not a random subclass, regardless
+ of the fact that it's only used for GradientImage as of yet.
+
2013-09-21 Darin Adler <[email protected]>
Shrink valueForBasicShape by removing repeated calls to cssValuePool()
Modified: trunk/Source/WebCore/GNUmakefile.list.am (156225 => 156226)
--- trunk/Source/WebCore/GNUmakefile.list.am 2013-09-21 08:03:45 UTC (rev 156225)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2013-09-21 10:52:25 UTC (rev 156226)
@@ -5835,8 +5835,6 @@
Source/WebCore/platform/graphics/FontWidthVariant.h \
Source/WebCore/platform/graphics/GeneratedImage.cpp \
Source/WebCore/platform/graphics/GeneratedImage.h \
- Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp \
- Source/WebCore/platform/graphics/GeneratorGeneratedImage.h \
Source/WebCore/platform/graphics/Glyph.h \
Source/WebCore/platform/graphics/GlyphBuffer.h \
Source/WebCore/platform/graphics/GlyphMetricsMap.h \
@@ -5845,6 +5843,8 @@
Source/WebCore/platform/graphics/GlyphPageTreeNode.h \
Source/WebCore/platform/graphics/Gradient.cpp \
Source/WebCore/platform/graphics/Gradient.h \
+ Source/WebCore/platform/graphics/GradientImage.cpp \
+ Source/WebCore/platform/graphics/GradientImage.h \
Source/WebCore/platform/graphics/GraphicsContext.cpp \
Source/WebCore/platform/graphics/GraphicsContext.h \
Source/WebCore/platform/graphics/GraphicsTypes.cpp \
Modified: trunk/Source/WebCore/Target.pri (156225 => 156226)
--- trunk/Source/WebCore/Target.pri 2013-09-21 08:03:45 UTC (rev 156225)
+++ trunk/Source/WebCore/Target.pri 2013-09-21 10:52:25 UTC (rev 156226)
@@ -993,9 +993,9 @@
platform/graphics/LayoutBoxExtent.cpp \
platform/graphics/LayoutRect.cpp \
platform/graphics/GeneratedImage.cpp \
- platform/graphics/GeneratorGeneratedImage.cpp \
platform/graphics/GlyphPageTreeNode.cpp \
platform/graphics/Gradient.cpp \
+ platform/graphics/GradientImage.cpp \
platform/graphics/GraphicsContext.cpp \
platform/graphics/GraphicsLayer.cpp \
platform/graphics/GraphicsLayerAnimation.cpp \
@@ -2194,10 +2194,10 @@
platform/graphics/FontFeatureSettings.h \
platform/graphics/FontMetrics.h \
platform/graphics/Font.h \
- platform/graphics/GeneratorGeneratedImage.h \
platform/graphics/GeneratedImage.h \
platform/graphics/GlyphPageTreeNode.h \
platform/graphics/Gradient.h \
+ platform/graphics/GradientImage.h \
platform/graphics/GraphicsContext.h \
platform/graphics/GraphicsLayer.h \
platform/graphics/GraphicsLayerAnimation.h \
Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (156225 => 156226)
--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj 2013-09-21 08:03:45 UTC (rev 156225)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj 2013-09-21 10:52:25 UTC (rev 156226)
@@ -7633,9 +7633,9 @@
<ClCompile Include="..\platform\graphics\FontFeatureSettings.cpp" />
<ClCompile Include="..\platform\graphics\FontPlatformData.cpp" />
<ClCompile Include="..\platform\graphics\GeneratedImage.cpp" />
- <ClCompile Include="..\platform\graphics\GeneratorGeneratedImage.cpp" />
<ClCompile Include="..\platform\graphics\GlyphPageTreeNode.cpp" />
<ClCompile Include="..\platform\graphics\Gradient.cpp" />
+ <ClCompile Include="..\platform\graphics\GradientImage.cpp" />
<ClCompile Include="..\platform\graphics\GraphicsContext.cpp" />
<ClCompile Include="..\platform\graphics\GraphicsLayer.cpp" />
<ClCompile Include="..\platform\graphics\GraphicsLayerUpdater.cpp" />
Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (156225 => 156226)
--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters 2013-09-21 08:03:45 UTC (rev 156225)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters 2013-09-21 10:52:25 UTC (rev 156226)
@@ -1359,15 +1359,15 @@
<ClCompile Include="..\platform\graphics\FloatQuad.cpp">
<Filter>platform\graphics</Filter>
</ClCompile>
- <ClCompile Include="..\platform\graphics\GeneratorGeneratedImage.cpp">
- <Filter>platform\graphics</Filter>
- </ClCompile>
<ClCompile Include="..\platform\graphics\GlyphPageTreeNode.cpp">
<Filter>platform\graphics</Filter>
</ClCompile>
<ClCompile Include="..\platform\graphics\Gradient.cpp">
<Filter>platform\graphics</Filter>
</ClCompile>
+ <ClCompile Include="..\platform\graphics\GradientImage.cpp">
+ <Filter>platform\graphics</Filter>
+ </ClCompile>
<ClCompile Include="..\platform\graphics\GraphicsContext.cpp">
<Filter>platform\graphics</Filter>
</ClCompile>
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (156225 => 156226)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2013-09-21 08:03:45 UTC (rev 156225)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2013-09-21 10:52:25 UTC (rev 156226)
@@ -906,8 +906,8 @@
2D46F05017B96FD2005647F0 /* IntSize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D46F04F17B96FD2005647F0 /* IntSize.cpp */; };
2D481F00146B5C4C00AA7834 /* CrossfadeGeneratedImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D2FC0541460CD6F00263633 /* CrossfadeGeneratedImage.cpp */; };
2D481F02146B5C5500AA7834 /* CrossfadeGeneratedImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D2FC0551460CD6F00263633 /* CrossfadeGeneratedImage.h */; };
- 2D481F03146B5C6500AA7834 /* GeneratorGeneratedImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D2FC0561460CD6F00263633 /* GeneratorGeneratedImage.cpp */; };
- 2D481F04146B5C6B00AA7834 /* GeneratorGeneratedImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D2FC0571460CD6F00263633 /* GeneratorGeneratedImage.h */; };
+ 2D481F03146B5C6500AA7834 /* GradientImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D2FC0561460CD6F00263633 /* GradientImage.cpp */; };
+ 2D481F04146B5C6B00AA7834 /* GradientImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D2FC0571460CD6F00263633 /* GradientImage.h */; };
2D5A592F152525230036EE51 /* ImageOrientation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8748D7412CC3F89001FBA41 /* ImageOrientation.cpp */; };
2D5A5931152525D00036EE51 /* ImageOrientation.h in Headers */ = {isa = PBXBuildFile; fileRef = A8748D6612CC3763001FBA41 /* ImageOrientation.h */; settings = {ATTRIBUTES = (Private, ); }; };
2D5BC42716F882EE007048D0 /* SecurityPolicyViolationEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D5BC42516F882BE007048D0 /* SecurityPolicyViolationEvent.h */; };
@@ -7396,8 +7396,8 @@
2BE8E2C812A58A0100FAD550 /* HTMLMetaCharsetParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HTMLMetaCharsetParser.cpp; path = parser/HTMLMetaCharsetParser.cpp; sourceTree = "<group>"; };
2D2FC0541460CD6F00263633 /* CrossfadeGeneratedImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CrossfadeGeneratedImage.cpp; sourceTree = "<group>"; };
2D2FC0551460CD6F00263633 /* CrossfadeGeneratedImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CrossfadeGeneratedImage.h; sourceTree = "<group>"; };
- 2D2FC0561460CD6F00263633 /* GeneratorGeneratedImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeneratorGeneratedImage.cpp; sourceTree = "<group>"; };
- 2D2FC0571460CD6F00263633 /* GeneratorGeneratedImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeneratorGeneratedImage.h; sourceTree = "<group>"; };
+ 2D2FC0561460CD6F00263633 /* GradientImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GradientImage.cpp; sourceTree = "<group>"; };
+ 2D2FC0571460CD6F00263633 /* GradientImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GradientImage.h; sourceTree = "<group>"; };
2D3A0E3513A7D76100E85AF0 /* SVGParsingError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGParsingError.h; sourceTree = "<group>"; };
2D46F04D17B96FBD005647F0 /* IntPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IntPoint.cpp; sourceTree = "<group>"; };
2D46F04F17B96FD2005647F0 /* IntSize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IntSize.cpp; sourceTree = "<group>"; };
@@ -18928,8 +18928,8 @@
BCE4413512F7490B009B84B8 /* FontWidthVariant.h */,
4FB390AC15EF61F3007AD51F /* GeneratedImage.cpp */,
BC23F0DA0DAFF4A4009FDC91 /* GeneratedImage.h */,
- 2D2FC0561460CD6F00263633 /* GeneratorGeneratedImage.cpp */,
- 2D2FC0571460CD6F00263633 /* GeneratorGeneratedImage.h */,
+ 2D2FC0561460CD6F00263633 /* GradientImage.cpp */,
+ 2D2FC0571460CD6F00263633 /* GradientImage.h */,
086BBD0E136039C2008B15D8 /* Glyph.h */,
B2C3DA5B0D006CD600EF6F26 /* GlyphBuffer.h */,
C5D4AA78116BAFB60069CA93 /* GlyphMetricsMap.h */,
@@ -22507,7 +22507,7 @@
1432E8470C51493800B1500F /* GCController.h in Headers */,
C0C054CC1118C8E400CE2636 /* generate-bindings.pl in Headers */,
BC23F0DB0DAFF4A4009FDC91 /* GeneratedImage.h in Headers */,
- 2D481F04146B5C6B00AA7834 /* GeneratorGeneratedImage.h in Headers */,
+ 2D481F04146B5C6B00AA7834 /* GradientImage.h in Headers */,
0720B0A114D3323500642955 /* GenericEventQueue.h in Headers */,
9746AF2414F4DDE6003E7A70 /* Geolocation.h in Headers */,
9746AF2514F4DDE6003E7A71 /* GeolocationClient.h in Headers */,
@@ -25782,7 +25782,7 @@
FD31600C12B0267600C1A359 /* GainNode.cpp in Sources */,
1432E8490C51493F00B1500F /* GCController.cpp in Sources */,
4FB390AD15EF61F3007AD51F /* GeneratedImage.cpp in Sources */,
- 2D481F03146B5C6500AA7834 /* GeneratorGeneratedImage.cpp in Sources */,
+ 2D481F03146B5C6500AA7834 /* GradientImage.cpp in Sources */,
0720B0A014D3323500642955 /* GenericEventQueue.cpp in Sources */,
9746AF2314F4DDE6003E7A70 /* Geolocation.cpp in Sources */,
9746AF2614F4DDE6003E7A70 /* GeolocationController.cpp in Sources */,
Modified: trunk/Source/WebCore/css/CSSGradientValue.cpp (156225 => 156226)
--- trunk/Source/WebCore/css/CSSGradientValue.cpp 2013-09-21 08:03:45 UTC (rev 156225)
+++ trunk/Source/WebCore/css/CSSGradientValue.cpp 2013-09-21 10:52:25 UTC (rev 156226)
@@ -28,8 +28,8 @@
#include "CSSCalculationValue.h"
#include "CSSValueKeywords.h"
-#include "GeneratorGeneratedImage.h"
#include "Gradient.h"
+#include "GradientImage.h"
#include "Image.h"
#include "IntSize.h"
#include "IntSizeHash.h"
@@ -67,7 +67,7 @@
gradient = static_cast<CSSRadialGradientValue*>(this)->createGradient(renderer, size);
}
- RefPtr<GeneratorGeneratedImage> newImage = GeneratorGeneratedImage::create(gradient, size);
+ RefPtr<GradientImage> newImage = GradientImage::create(gradient, size);
if (cacheable)
saveCachedImageForSize(size, newImage);
Modified: trunk/Source/WebCore/css/CSSImageGeneratorValue.cpp (156225 => 156226)
--- trunk/Source/WebCore/css/CSSImageGeneratorValue.cpp 2013-09-21 08:03:45 UTC (rev 156225)
+++ trunk/Source/WebCore/css/CSSImageGeneratorValue.cpp 2013-09-21 10:52:25 UTC (rev 156226)
@@ -64,7 +64,7 @@
deref();
}
-GeneratorGeneratedImage* CSSImageGeneratorValue::cachedImageForSize(IntSize size)
+GeneratedImage* CSSImageGeneratorValue::cachedImageForSize(IntSize size)
{
if (size.isEmpty())
return 0;
@@ -77,7 +77,7 @@
return cachedGeneratedImage->image();
}
-void CSSImageGeneratorValue::saveCachedImageForSize(IntSize size, PassRefPtr<GeneratorGeneratedImage> image)
+void CSSImageGeneratorValue::saveCachedImageForSize(IntSize size, PassRefPtr<GeneratedImage> image)
{
ASSERT(!m_images.contains(size));
m_images.add(size, adoptPtr(new CachedGeneratedImage(*this, size, image)));
@@ -89,7 +89,7 @@
m_images.remove(size);
}
-CSSImageGeneratorValue::CachedGeneratedImage::CachedGeneratedImage(CSSImageGeneratorValue& owner, IntSize size, PassRefPtr<GeneratorGeneratedImage> image)
+CSSImageGeneratorValue::CachedGeneratedImage::CachedGeneratedImage(CSSImageGeneratorValue& owner, IntSize size, PassRefPtr<GeneratedImage> image)
: m_owner(owner)
, m_size(size)
, m_image(image)
Modified: trunk/Source/WebCore/css/CSSImageGeneratorValue.h (156225 => 156226)
--- trunk/Source/WebCore/css/CSSImageGeneratorValue.h 2013-09-21 08:03:45 UTC (rev 156225)
+++ trunk/Source/WebCore/css/CSSImageGeneratorValue.h 2013-09-21 10:52:25 UTC (rev 156226)
@@ -28,7 +28,7 @@
#include "CSSValue.h"
#include "CachedImage.h"
-#include "GeneratorGeneratedImage.h"
+#include "GeneratedImage.h"
#include "IntSizeHash.h"
#include "Timer.h"
#include <wtf/HashCountedSet.h>
@@ -37,7 +37,7 @@
namespace WebCore {
class CachedResourceLoader;
-class GeneratorGeneratedImage;
+class GeneratedImage;
class RenderObject;
class StyleResolver;
@@ -61,8 +61,8 @@
protected:
CSSImageGeneratorValue(ClassType);
- GeneratorGeneratedImage* cachedImageForSize(IntSize);
- void saveCachedImageForSize(IntSize, PassRefPtr<GeneratorGeneratedImage>);
+ GeneratedImage* cachedImageForSize(IntSize);
+ void saveCachedImageForSize(IntSize, PassRefPtr<GeneratedImage>);
const HashCountedSet<RenderObject*>& clients() const { return m_clients; }
// Helper functions for Crossfade and Filter.
@@ -72,8 +72,8 @@
private:
class CachedGeneratedImage {
public:
- CachedGeneratedImage(CSSImageGeneratorValue&, IntSize, PassRefPtr<GeneratorGeneratedImage>);
- GeneratorGeneratedImage* image() { return m_image.get(); }
+ CachedGeneratedImage(CSSImageGeneratorValue&, IntSize, PassRefPtr<GeneratedImage>);
+ GeneratedImage* image() { return m_image.get(); }
void puntEvictionTimer() { m_evictionTimer.restart(); }
private:
@@ -81,7 +81,7 @@
CSSImageGeneratorValue& m_owner;
IntSize m_size;
- RefPtr<GeneratorGeneratedImage> m_image;
+ RefPtr<GeneratedImage> m_image;
DeferrableOneShotTimer<CachedGeneratedImage> m_evictionTimer;
};
Modified: trunk/Source/WebCore/platform/graphics/BitmapImage.h (156225 => 156226)
--- trunk/Source/WebCore/platform/graphics/BitmapImage.h 2013-09-21 08:03:45 UTC (rev 156225)
+++ trunk/Source/WebCore/platform/graphics/BitmapImage.h 2013-09-21 10:52:25 UTC (rev 156226)
@@ -100,7 +100,7 @@
class BitmapImage FINAL : public Image {
friend class GeneratedImage;
friend class CrossfadeGeneratedImage;
- friend class GeneratorGeneratedImage;
+ friend class GradientImage;
friend class GraphicsContext;
public:
static PassRefPtr<BitmapImage> create(PassNativeImagePtr nativeImage, ImageObserver* observer = 0)
Deleted: trunk/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp (156225 => 156226)
--- trunk/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp 2013-09-21 08:03:45 UTC (rev 156225)
+++ trunk/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp 2013-09-21 10:52:25 UTC (rev 156226)
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "GeneratorGeneratedImage.h"
-
-#include "FloatRect.h"
-#include "GraphicsContext.h"
-#include "Length.h"
-
-namespace WebCore {
-
-void GeneratorGeneratedImage::draw(GraphicsContext* destContext, const FloatRect& destRect, const FloatRect& srcRect, ColorSpace, CompositeOperator compositeOp, BlendMode blendMode)
-{
- GraphicsContextStateSaver stateSaver(*destContext);
- destContext->setCompositeOperation(compositeOp, blendMode);
- destContext->clip(destRect);
- destContext->translate(destRect.x(), destRect.y());
- if (destRect.size() != srcRect.size())
- destContext->scale(FloatSize(destRect.width() / srcRect.width(), destRect.height() / srcRect.height()));
- destContext->translate(-srcRect.x(), -srcRect.y());
- destContext->fillRect(FloatRect(FloatPoint(), size()), *m_gradient.get());
-}
-
-void GeneratorGeneratedImage::drawPattern(GraphicsContext* destContext, const FloatRect& srcRect, const AffineTransform& patternTransform,
- const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& destRect, BlendMode)
-{
- // Allow the generator to provide visually-equivalent tiling parameters for better performance.
- IntSize adjustedSize = size();
- FloatRect adjustedSrcRect = srcRect;
- m_gradient->adjustParametersForTiledDrawing(adjustedSize, adjustedSrcRect);
-
- // Factor in the destination context's scale to generate at the best resolution
- AffineTransform destContextCTM = destContext->getCTM(GraphicsContext::DefinitelyIncludeDeviceScale);
- double xScale = fabs(destContextCTM.xScale());
- double yScale = fabs(destContextCTM.yScale());
- AffineTransform adjustedPatternCTM = patternTransform;
- adjustedPatternCTM.scale(1.0 / xScale, 1.0 / yScale);
- adjustedSrcRect.scale(xScale, yScale);
-
- unsigned generatorHash = m_gradient->hash();
-
- if (!m_cachedImageBuffer || m_cachedGeneratorHash != generatorHash || m_cachedAdjustedSize != adjustedSize || !destContext->isCompatibleWithBuffer(m_cachedImageBuffer.get())) {
- m_cachedImageBuffer = destContext->createCompatibleBuffer(adjustedSize, m_gradient->hasAlpha());
- if (!m_cachedImageBuffer)
- return;
-
- // Fill with the generated image.
- m_cachedImageBuffer->context()->fillRect(FloatRect(FloatPoint(), adjustedSize), *m_gradient);
-
- m_cachedGeneratorHash = generatorHash;
- m_cachedAdjustedSize = adjustedSize;
- }
-
- m_cachedImageBuffer->setSpaceSize(spaceSize());
- // Tile the image buffer into the context.
- m_cachedImageBuffer->drawPattern(destContext, adjustedSrcRect, adjustedPatternCTM, phase, styleColorSpace, compositeOp, destRect);
-}
-
-}
Deleted: trunk/Source/WebCore/platform/graphics/GeneratorGeneratedImage.h (156225 => 156226)
--- trunk/Source/WebCore/platform/graphics/GeneratorGeneratedImage.h 2013-09-21 08:03:45 UTC (rev 156225)
+++ trunk/Source/WebCore/platform/graphics/GeneratorGeneratedImage.h 2013-09-21 10:52:25 UTC (rev 156226)
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2008, 2012, 2013 Apple Computer, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef GeneratorGeneratedImage_h
-#define GeneratorGeneratedImage_h
-
-#include "GeneratedImage.h"
-#include "Gradient.h"
-#include "Image.h"
-#include "ImageBuffer.h"
-#include "IntSize.h"
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-class GeneratorGeneratedImage FINAL : public GeneratedImage {
-public:
- static PassRefPtr<GeneratorGeneratedImage> create(PassRefPtr<Gradient> generator, const IntSize& size)
- {
- return adoptRef(new GeneratorGeneratedImage(generator, size));
- }
-
- virtual ~GeneratorGeneratedImage() { }
-
-protected:
- virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, BlendMode) OVERRIDE;
- virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform,
- const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect, BlendMode) OVERRIDE;
-
- GeneratorGeneratedImage(PassRefPtr<Gradient> generator, const IntSize& size)
- : m_gradient(generator)
- {
- setContainerSize(size);
- }
-
-private:
- RefPtr<Gradient> m_gradient;
- OwnPtr<ImageBuffer> m_cachedImageBuffer;
- IntSize m_cachedAdjustedSize;
- unsigned m_cachedGeneratorHash;
-};
-
-}
-
-#endif
Copied: trunk/Source/WebCore/platform/graphics/GradientImage.cpp (from rev 156225, trunk/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp) (0 => 156226)
--- trunk/Source/WebCore/platform/graphics/GradientImage.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/GradientImage.cpp 2013-09-21 10:52:25 UTC (rev 156226)
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "GradientImage.h"
+
+#include "FloatRect.h"
+#include "GraphicsContext.h"
+#include "Length.h"
+
+namespace WebCore {
+
+void GradientImage::draw(GraphicsContext* destContext, const FloatRect& destRect, const FloatRect& srcRect, ColorSpace, CompositeOperator compositeOp, BlendMode blendMode)
+{
+ GraphicsContextStateSaver stateSaver(*destContext);
+ destContext->setCompositeOperation(compositeOp, blendMode);
+ destContext->clip(destRect);
+ destContext->translate(destRect.x(), destRect.y());
+ if (destRect.size() != srcRect.size())
+ destContext->scale(FloatSize(destRect.width() / srcRect.width(), destRect.height() / srcRect.height()));
+ destContext->translate(-srcRect.x(), -srcRect.y());
+ destContext->fillRect(FloatRect(FloatPoint(), size()), *m_gradient.get());
+}
+
+void GradientImage::drawPattern(GraphicsContext* destContext, const FloatRect& srcRect, const AffineTransform& patternTransform,
+ const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& destRect, BlendMode)
+{
+ // Allow the generator to provide visually-equivalent tiling parameters for better performance.
+ IntSize adjustedSize = size();
+ FloatRect adjustedSrcRect = srcRect;
+ m_gradient->adjustParametersForTiledDrawing(adjustedSize, adjustedSrcRect);
+
+ // Factor in the destination context's scale to generate at the best resolution
+ AffineTransform destContextCTM = destContext->getCTM(GraphicsContext::DefinitelyIncludeDeviceScale);
+ double xScale = fabs(destContextCTM.xScale());
+ double yScale = fabs(destContextCTM.yScale());
+ AffineTransform adjustedPatternCTM = patternTransform;
+ adjustedPatternCTM.scale(1.0 / xScale, 1.0 / yScale);
+ adjustedSrcRect.scale(xScale, yScale);
+
+ unsigned generatorHash = m_gradient->hash();
+
+ if (!m_cachedImageBuffer || m_cachedGeneratorHash != generatorHash || m_cachedAdjustedSize != adjustedSize || !destContext->isCompatibleWithBuffer(m_cachedImageBuffer.get())) {
+ m_cachedImageBuffer = destContext->createCompatibleBuffer(adjustedSize, m_gradient->hasAlpha());
+ if (!m_cachedImageBuffer)
+ return;
+
+ // Fill with the generated image.
+ m_cachedImageBuffer->context()->fillRect(FloatRect(FloatPoint(), adjustedSize), *m_gradient);
+
+ m_cachedGeneratorHash = generatorHash;
+ m_cachedAdjustedSize = adjustedSize;
+ }
+
+ m_cachedImageBuffer->setSpaceSize(spaceSize());
+ // Tile the image buffer into the context.
+ m_cachedImageBuffer->drawPattern(destContext, adjustedSrcRect, adjustedPatternCTM, phase, styleColorSpace, compositeOp, destRect);
+}
+
+}
Copied: trunk/Source/WebCore/platform/graphics/GradientImage.h (from rev 156225, trunk/Source/WebCore/platform/graphics/GeneratorGeneratedImage.h) (0 => 156226)
--- trunk/Source/WebCore/platform/graphics/GradientImage.h (rev 0)
+++ trunk/Source/WebCore/platform/graphics/GradientImage.h 2013-09-21 10:52:25 UTC (rev 156226)
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2008, 2012, 2013 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GradientImage_h
+#define GradientImage_h
+
+#include "GeneratedImage.h"
+#include "Gradient.h"
+#include "Image.h"
+#include "ImageBuffer.h"
+#include "IntSize.h"
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class GradientImage FINAL : public GeneratedImage {
+public:
+ static PassRefPtr<GradientImage> create(PassRefPtr<Gradient> generator, const IntSize& size)
+ {
+ return adoptRef(new GradientImage(generator, size));
+ }
+
+ virtual ~GradientImage() { }
+
+protected:
+ virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, BlendMode) OVERRIDE;
+ virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform,
+ const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect, BlendMode) OVERRIDE;
+
+ GradientImage(PassRefPtr<Gradient> generator, const IntSize& size)
+ : m_gradient(generator)
+ {
+ setContainerSize(size);
+ }
+
+private:
+ RefPtr<Gradient> m_gradient;
+ OwnPtr<ImageBuffer> m_cachedImageBuffer;
+ IntSize m_cachedAdjustedSize;
+ unsigned m_cachedGeneratorHash;
+};
+
+}
+
+#endif
Modified: trunk/Source/WebCore/platform/graphics/Image.h (156225 => 156226)
--- trunk/Source/WebCore/platform/graphics/Image.h 2013-09-21 08:03:45 UTC (rev 156225)
+++ trunk/Source/WebCore/platform/graphics/Image.h 2013-09-21 10:52:25 UTC (rev 156226)
@@ -88,7 +88,7 @@
class Image : public RefCounted<Image> {
friend class GeneratedImage;
friend class CrossfadeGeneratedImage;
- friend class GeneratorGeneratedImage;
+ friend class GradientImage;
friend class GraphicsContext;
public:
Modified: trunk/Source/WebCore/platform/graphics/ImageBuffer.h (156225 => 156226)
--- trunk/Source/WebCore/platform/graphics/ImageBuffer.h 2013-09-21 08:03:45 UTC (rev 156225)
+++ trunk/Source/WebCore/platform/graphics/ImageBuffer.h 2013-09-21 10:52:25 UTC (rev 156226)
@@ -150,7 +150,7 @@
friend class GraphicsContext;
friend class GeneratedImage;
friend class CrossfadeGeneratedImage;
- friend class GeneratorGeneratedImage;
+ friend class GradientImage;
private:
ImageBufferData m_data;