Add an argument to ImageSource::createFrameAtIndex to hint a decoder that we expect...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Sep 2013 20:35:40 +0000 (20:35 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Sep 2013 20:35:40 +0000 (20:35 +0000)
https://bugs.webkit.org/show_bug.cgi?id=121696

Patch by Yongjun Zhang <yongjun_zhang@apple.com> on 2013-09-20
Reviewed by Antti Koivisto.

Add an argument to ImageSource::createFrameAtIndex.  A platform image decoder can decide the optimal
scale based on the hint and pass the real scale it used for decoding.

No new tests, no behavior change.

* platform/graphics/ImageSource.cpp:
(WebCore::ImageSource::createFrameAtIndex):
* platform/graphics/ImageSource.h:
* platform/graphics/cg/ImageSourceCG.cpp:
(WebCore::ImageSource::createFrameAtIndex):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@156195 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/ImageSource.cpp
Source/WebCore/platform/graphics/ImageSource.h
Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp

index 7a8dbab358ee04c647b852458acc70f6f46cfaaa..8617e611360624cfc2174522284d3909fabef52b 100644 (file)
@@ -1,3 +1,21 @@
+2013-09-20  Yongjun Zhang  <yongjun_zhang@apple.com>
+
+        Add an argument to ImageSource::createFrameAtIndex to hint a decoder that we expect a scaled image.
+        https://bugs.webkit.org/show_bug.cgi?id=121696
+
+        Reviewed by Antti Koivisto.
+
+        Add an argument to ImageSource::createFrameAtIndex.  A platform image decoder can decide the optimal
+        scale based on the hint and pass the real scale it used for decoding.
+
+        No new tests, no behavior change.
+
+        * platform/graphics/ImageSource.cpp:
+        (WebCore::ImageSource::createFrameAtIndex):
+        * platform/graphics/ImageSource.h:
+        * platform/graphics/cg/ImageSourceCG.cpp:
+        (WebCore::ImageSource::createFrameAtIndex):
+
 2013-09-20  Andreas Kling  <akling@apple.com>
 
         Make JSMainThreadNullState noncopyable.
index f86520091e85ad3bae48d96f7fc94b864906abe7..c041f56383b80695f96dda035e70c35076166aee 100644 (file)
@@ -136,8 +136,10 @@ size_t ImageSource::frameCount() const
     return m_decoder ? m_decoder->frameCount() : 0;
 }
 
-PassNativeImagePtr ImageSource::createFrameAtIndex(size_t index)
+PassNativeImagePtr ImageSource::createFrameAtIndex(size_t index, float* scale)
 {
+    UNUSED_PARAM(scale);
+
     if (!m_decoder)
         return 0;
 
index a496f6eb2ad76385fb25903c381e45f5ab0eea4d..3c6327fb7aa6d1e4dac44a0f877458bfa135b3f6 100644 (file)
@@ -145,7 +145,7 @@ public:
 
     // Callers should not call this after calling clear() with a higher index;
     // see comments on clear() above.
-    PassNativeImagePtr createFrameAtIndex(size_t);
+    PassNativeImagePtr createFrameAtIndex(size_t, float* scale = 0);
 
     float frameDurationAtIndex(size_t);
     bool frameHasAlphaAtIndex(size_t); // Whether or not the frame actually used any alpha.
index 65f2f8ff56752737bda032e7e517106262ee276c..dd05b1d315b1c039fe3ff393cedc315a40c7f870 100644 (file)
@@ -291,8 +291,10 @@ size_t ImageSource::frameCount() const
     return m_decoder ? CGImageSourceGetCount(m_decoder) : 0;
 }
 
-CGImageRef ImageSource::createFrameAtIndex(size_t index)
+CGImageRef ImageSource::createFrameAtIndex(size_t index, float* scale)
 {
+    UNUSED_PARAM(scale);
+
     if (!initialized())
         return 0;