Title: [121048] trunk/Source/WebCore
Revision
121048
Author
[email protected]
Date
2012-06-22 12:10:20 -0700 (Fri, 22 Jun 2012)

Log Message

BitmapImage duplicates code to calculate size
https://bugs.webkit.org/show_bug.cgi?id=89728
<rdar://problem/11724321>

Reviewed by Darin Adler.

Add a new updateSize method to BitmapImage that
avoids duplication in the size and
sizeRespectingOrientation methods.

No new tests needed.

* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::updateSize): new method that will set
m_size and m_sizeRespectingOrientation if necessary.
(WebCore):
(WebCore::BitmapImage::size):
(WebCore::BitmapImage::sizeRespectingOrientation): these each
now call updateSize rather than duplicate the update code.
* platform/graphics/BitmapImage.h:
(BitmapImage):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (121047 => 121048)


--- trunk/Source/WebCore/ChangeLog	2012-06-22 18:55:02 UTC (rev 121047)
+++ trunk/Source/WebCore/ChangeLog	2012-06-22 19:10:20 UTC (rev 121048)
@@ -1,3 +1,27 @@
+2012-06-22  Dean Jackson  <[email protected]>
+
+        BitmapImage duplicates code to calculate size
+        https://bugs.webkit.org/show_bug.cgi?id=89728
+        <rdar://problem/11724321>
+
+        Reviewed by Darin Adler.
+
+        Add a new updateSize method to BitmapImage that
+        avoids duplication in the size and
+        sizeRespectingOrientation methods.
+
+        No new tests needed.
+
+        * platform/graphics/BitmapImage.cpp:
+        (WebCore::BitmapImage::updateSize): new method that will set
+        m_size and m_sizeRespectingOrientation if necessary.
+        (WebCore):
+        (WebCore::BitmapImage::size):
+        (WebCore::BitmapImage::sizeRespectingOrientation): these each
+        now call updateSize rather than duplicate the update code.
+        * platform/graphics/BitmapImage.h:
+        (BitmapImage):
+
 2012-06-22  Erik Arvidsson  <[email protected]>
 
         [V8] Clean up visitDOMWrapper code

Modified: trunk/Source/WebCore/platform/graphics/BitmapImage.cpp (121047 => 121048)


--- trunk/Source/WebCore/platform/graphics/BitmapImage.cpp	2012-06-22 18:55:02 UTC (rev 121047)
+++ trunk/Source/WebCore/platform/graphics/BitmapImage.cpp	2012-06-22 19:10:20 UTC (rev 121048)
@@ -178,25 +178,26 @@
         imageObserver()->decodedSizeChanged(this, deltaBytes);
 }
 
+void BitmapImage::updateSize() const
+{
+    if (!m_sizeAvailable || m_haveSize)
+        return;
+
+    m_size = m_source.size();
+    m_sizeRespectingOrientation = m_source.size(RespectImageOrientation);
+    m_haveSize = true;
+    didDecodeProperties();
+}
+
 IntSize BitmapImage::size() const
 {
-    if (m_sizeAvailable && !m_haveSize) {
-        m_size = m_source.size();
-        m_sizeRespectingOrientation = m_source.size(RespectImageOrientation);
-        m_haveSize = true;
-        didDecodeProperties();
-    }
+    updateSize();
     return m_size;
 }
 
 IntSize BitmapImage::sizeRespectingOrientation() const
 {
-    if (m_sizeAvailable && !m_haveSize) {
-        m_size = m_source.size();
-        m_sizeRespectingOrientation = m_source.size(RespectImageOrientation);
-        m_haveSize = true;
-        didDecodeProperties();
-    }
+    updateSize();
     return m_sizeRespectingOrientation;
 }
 

Modified: trunk/Source/WebCore/platform/graphics/BitmapImage.h (121047 => 121048)


--- trunk/Source/WebCore/platform/graphics/BitmapImage.h	2012-06-22 18:55:02 UTC (rev 121047)
+++ trunk/Source/WebCore/platform/graphics/BitmapImage.h	2012-06-22 19:10:20 UTC (rev 121048)
@@ -179,6 +179,9 @@
     virtual bool notSolidColor();
 #endif
 
+private:
+    void updateSize() const;
+
 protected:
     enum RepetitionCountStatus {
       Unknown,    // We haven't checked the source's repetition count.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to