summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/cg/ImageSourceCG.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/graphics/cg/ImageSourceCG.cpp')
-rw-r--r--WebCore/platform/graphics/cg/ImageSourceCG.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/WebCore/platform/graphics/cg/ImageSourceCG.cpp b/WebCore/platform/graphics/cg/ImageSourceCG.cpp
index 9ad3166..4a7aecc 100644
--- a/WebCore/platform/graphics/cg/ImageSourceCG.cpp
+++ b/WebCore/platform/graphics/cg/ImageSourceCG.cpp
@@ -29,6 +29,7 @@
#if PLATFORM(CG)
#include "ImageSourceCG.h"
+#include "IntPoint.h"
#include "IntSize.h"
#include "MIMETypeRegistry.h"
#include "SharedBuffer.h"
@@ -196,6 +197,28 @@ IntSize ImageSource::size() const
return frameSizeAtIndex(0);
}
+bool ImageSource::getHotSpot(IntPoint& hotSpot) const
+{
+ RetainPtr<CFDictionaryRef> properties(AdoptCF, CGImageSourceCopyPropertiesAtIndex(m_decoder, 0, imageSourceOptions()));
+ if (!properties)
+ return false;
+
+ int x = -1, y = -1;
+ CFNumberRef num = (CFNumberRef)CFDictionaryGetValue(properties.get(), CFSTR("hotspotX"));
+ if (!num || !CFNumberGetValue(num, kCFNumberIntType, &x))
+ return false;
+
+ num = (CFNumberRef)CFDictionaryGetValue(properties.get(), CFSTR("hotspotY"));
+ if (!num || !CFNumberGetValue(num, kCFNumberIntType, &y))
+ return false;
+
+ if (x < 0 || y < 0)
+ return false;
+
+ hotSpot = IntPoint(x, y);
+ return true;
+}
+
int ImageSource::repetitionCount()
{
int result = cAnimationLoopOnce; // No property means loop once.