Title: [111572] trunk/Source/WebCore
Revision
111572
Author
[email protected]
Date
2012-03-21 10:43:46 -0700 (Wed, 21 Mar 2012)

Log Message

Incremental cleanup of BitmapImage: inlined virtual functions
https://bugs.webkit.org/show_bug.cgi?id=81688

Patch by Tom Hudson <[email protected]> on 2012-03-21
Reviewed by James Robinson.

No change in functionality, so no new tests.

Move virtual functions defined in headers into .cpp files.

* WebCore.gypi:
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::isBitmapImage):
(WebCore):
(WebCore::BitmapImage::hasSingleSecurityOrigin):
(WebCore::BitmapImage::nativeImageForCurrentFrame):
(WebCore::BitmapImage::currentFrameHasAlpha):
(WebCore::BitmapImage::notSolidColor):
(WebCore::BitmapImage::decodedSize):
(WebCore::BitmapImage::mayFillWithSolidColor):
(WebCore::BitmapImage::solidColor):
* platform/graphics/BitmapImage.h:
(BitmapImage):
* platform/graphics/skia/BitmapImageSingleFrameSkia.cpp: Added.
(WebCore):
(WebCore::BitmapImageSingleFrameSkia::isBitmapImage):
(WebCore::BitmapImageSingleFrameSkia::currentFrameHasAlpha):
(WebCore::BitmapImageSingleFrameSkia::size):
(WebCore::BitmapImageSingleFrameSkia::destroyDecodedData):
(WebCore::BitmapImageSingleFrameSkia::decodedSize):
(WebCore::BitmapImageSingleFrameSkia::nativeImageForCurrentFrame):
(WebCore::BitmapImageSingleFrameSkia::notSolidColor):
* platform/graphics/skia/BitmapImageSingleFrameSkia.h:
(BitmapImageSingleFrameSkia):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (111571 => 111572)


--- trunk/Source/WebCore/ChangeLog	2012-03-21 17:43:20 UTC (rev 111571)
+++ trunk/Source/WebCore/ChangeLog	2012-03-21 17:43:46 UTC (rev 111572)
@@ -1,3 +1,39 @@
+2012-03-21  Tom Hudson  <[email protected]>
+
+        Incremental cleanup of BitmapImage: inlined virtual functions
+        https://bugs.webkit.org/show_bug.cgi?id=81688
+
+        Reviewed by James Robinson.
+
+        No change in functionality, so no new tests.
+
+        Move virtual functions defined in headers into .cpp files.
+
+        * WebCore.gypi:
+        * platform/graphics/BitmapImage.cpp:
+        (WebCore::BitmapImage::isBitmapImage):
+        (WebCore):
+        (WebCore::BitmapImage::hasSingleSecurityOrigin):
+        (WebCore::BitmapImage::nativeImageForCurrentFrame):
+        (WebCore::BitmapImage::currentFrameHasAlpha):
+        (WebCore::BitmapImage::notSolidColor):
+        (WebCore::BitmapImage::decodedSize):
+        (WebCore::BitmapImage::mayFillWithSolidColor):
+        (WebCore::BitmapImage::solidColor):
+        * platform/graphics/BitmapImage.h:
+        (BitmapImage):
+        * platform/graphics/skia/BitmapImageSingleFrameSkia.cpp: Added.
+        (WebCore):
+        (WebCore::BitmapImageSingleFrameSkia::isBitmapImage):
+        (WebCore::BitmapImageSingleFrameSkia::currentFrameHasAlpha):
+        (WebCore::BitmapImageSingleFrameSkia::size):
+        (WebCore::BitmapImageSingleFrameSkia::destroyDecodedData):
+        (WebCore::BitmapImageSingleFrameSkia::decodedSize):
+        (WebCore::BitmapImageSingleFrameSkia::nativeImageForCurrentFrame):
+        (WebCore::BitmapImageSingleFrameSkia::notSolidColor):
+        * platform/graphics/skia/BitmapImageSingleFrameSkia.h:
+        (BitmapImageSingleFrameSkia):
+
 2012-03-21  Alexey Proskuryakov  <[email protected]>
 
         Remove obsolete File attributes

Modified: trunk/Source/WebCore/WebCore.gypi (111571 => 111572)


--- trunk/Source/WebCore/WebCore.gypi	2012-03-21 17:43:20 UTC (rev 111571)
+++ trunk/Source/WebCore/WebCore.gypi	2012-03-21 17:43:46 UTC (rev 111572)
@@ -3863,6 +3863,7 @@
             'platform/graphics/qt/TileQt.cpp',
             'platform/graphics/qt/TransformationMatrixQt.cpp',
             'platform/graphics/qt/TransparencyLayer.h',
+            'platform/graphics/skia/BitmapImageSingleFrameSkia.cpp',
             'platform/graphics/skia/BitmapImageSingleFrameSkia.h',
             'platform/graphics/skia/FloatPointSkia.cpp',
             'platform/graphics/skia/FloatRectSkia.cpp',

Modified: trunk/Source/WebCore/platform/graphics/BitmapImage.cpp (111571 => 111572)


--- trunk/Source/WebCore/platform/graphics/BitmapImage.cpp	2012-03-21 17:43:20 UTC (rev 111571)
+++ trunk/Source/WebCore/platform/graphics/BitmapImage.cpp	2012-03-21 17:43:46 UTC (rev 111572)
@@ -73,6 +73,17 @@
     stopAnimation();
 }
 
+bool BitmapImage::isBitmapImage() const
+{
+    return true;
+}
+
+bool BitmapImage::hasSingleSecurityOrigin() const
+{
+    return true;
+}
+
+
 void BitmapImage::destroyDecodedData(bool destroyAll)
 {
     int framesCleared = 0;
@@ -290,6 +301,11 @@
     return m_frames[index].m_duration;
 }
 
+NativeImagePtr BitmapImage::nativeImageForCurrentFrame()
+{
+    return frameAtIndex(currentFrame());
+}
+
 bool BitmapImage::frameHasAlphaAtIndex(size_t index)
 {
     if (index >= frameCount())
@@ -301,6 +317,20 @@
     return m_frames[index].m_hasAlpha;
 }
 
+bool BitmapImage::currentFrameHasAlpha()
+{
+    return frameHasAlphaAtIndex(currentFrame());
+}
+
+#if !ASSERT_DISABLED
+bool BitmapImage::notSolidColor()
+{
+    return size().width() != 1 || size().height() != 1 || frameCount() > 1;
+}
+#endif
+
+
+
 int BitmapImage::repetitionCount(bool imageKnownToBeComplete)
 {
     if ((m_repetitionCountStatus == Unknown) || ((m_repetitionCountStatus == Uncertain) && imageKnownToBeComplete)) {
@@ -436,6 +466,13 @@
     destroyDecodedDataIfNecessary(true);
 }
 
+unsigned BitmapImage::decodedSize() const
+{
+    return m_decodedSize;
+}
+
+
+
 void BitmapImage::advanceAnimation(Timer<BitmapImage>*)
 {
     internalAdvanceAnimation(false);
@@ -484,4 +521,22 @@
     return advancedAnimation;
 }
 
+bool BitmapImage::mayFillWithSolidColor()
+{
+    if (!m_checkedForSolidColor && frameCount() > 0) {
+        checkForSolidColor();
+        // WINCE PORT: checkForSolidColor() doesn't set m_checkedForSolidColor until
+        // it gets enough information to make final decision.
+#if !OS(WINCE)
+        ASSERT(m_checkedForSolidColor);
+#endif
+    }
+    return m_isSolidColor && !m_currentFrame;
 }
+
+Color BitmapImage::solidColor() const
+{
+    return m_solidColor;
+}
+
+}

Modified: trunk/Source/WebCore/platform/graphics/BitmapImage.h (111571 => 111572)


--- trunk/Source/WebCore/platform/graphics/BitmapImage.h	2012-03-21 17:43:20 UTC (rev 111571)
+++ trunk/Source/WebCore/platform/graphics/BitmapImage.h	2012-03-21 17:43:46 UTC (rev 111572)
@@ -108,9 +108,9 @@
     }
     ~BitmapImage();
     
-    virtual bool isBitmapImage() const { return true; }
+    virtual bool isBitmapImage() const;
 
-    virtual bool hasSingleSecurityOrigin() const { return true; }
+    virtual bool hasSingleSecurityOrigin() const;
 
     virtual IntSize size() const;
     IntSize currentFrameSize() const;
@@ -125,7 +125,7 @@
     virtual void stopAnimation();
     virtual void resetAnimation();
     
-    virtual unsigned decodedSize() const { return m_decodedSize; }
+    virtual unsigned decodedSize() const;
 
 #if PLATFORM(MAC)
     // Accessors for native image formats.
@@ -151,15 +151,12 @@
     virtual GdkPixbuf* getGdkPixbuf();
 #endif
 
-    virtual NativeImagePtr nativeImageForCurrentFrame() { return frameAtIndex(currentFrame()); }
+    virtual NativeImagePtr nativeImageForCurrentFrame();
     bool frameHasAlphaAtIndex(size_t);
-    virtual bool currentFrameHasAlpha() { return frameHasAlphaAtIndex(currentFrame()); }
+    virtual bool currentFrameHasAlpha();
 
 #if !ASSERT_DISABLED
-    virtual bool notSolidColor()
-    {
-        return size().width() != 1 || size().height() != 1 || frameCount() > 1;
-    }
+    virtual bool notSolidColor();
 #endif
 
 protected:
@@ -239,19 +236,8 @@
     // changed.
     void checkForSolidColor();
     
-    virtual bool mayFillWithSolidColor()
-    {
-        if (!m_checkedForSolidColor && frameCount() > 0) {
-            checkForSolidColor();
-            // WINCE PORT: checkForSolidColor() doesn't set m_checkedForSolidColor until
-            // it gets enough information to make final decision.
-#if !OS(WINCE)
-            ASSERT(m_checkedForSolidColor);
-#endif
-        }
-        return m_isSolidColor && m_currentFrame == 0;
-    }
-    virtual Color solidColor() const { return m_solidColor; }
+    virtual bool mayFillWithSolidColor();
+    virtual Color solidColor() const;
     
     ImageSource m_source;
     mutable IntSize m_size; // The size to use for the overall image (will just be the size of the first image).

Added: trunk/Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.cpp (0 => 111572)


--- trunk/Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.cpp	2012-03-21 17:43:46 UTC (rev 111572)
@@ -0,0 +1,47 @@
+#include "config.h"
+
+#include "BitmapImageSingleFrameSkia.h"
+
+namespace WebCore {
+
+bool BitmapImageSingleFrameSkia::isBitmapImage() const
+{
+    return true;
+}
+
+bool BitmapImageSingleFrameSkia::currentFrameHasAlpha()
+{
+    return !m_nativeImage.bitmap().isOpaque();
+}
+
+IntSize BitmapImageSingleFrameSkia::size() const
+{
+    return IntSize(m_nativeImage.bitmap().width(), m_nativeImage.bitmap().height());
+}
+
+// Do nothing, as we only have the one representation of data (decoded).
+void BitmapImageSingleFrameSkia::destroyDecodedData(bool destroyAll)
+{
+
+}
+
+unsigned BitmapImageSingleFrameSkia::decodedSize() const
+{
+    return m_nativeImage.decodedSize();
+}
+
+// We only have a single frame.
+NativeImagePtr BitmapImageSingleFrameSkia::nativeImageForCurrentFrame()
+{
+    return &m_nativeImage;
+}
+
+#if !ASSERT_DISABLED
+bool BitmapImageSingleFrameSkia::notSolidColor()
+{
+    return m_nativeImage.bitmap().width() != 1 || m_nativeImage.bitmap().height() != 1;
+}
+#endif
+
+} // namespace WebCore
+

Modified: trunk/Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h (111571 => 111572)


--- trunk/Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h	2012-03-21 17:43:20 UTC (rev 111571)
+++ trunk/Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h	2012-03-21 17:43:46 UTC (rev 111572)
@@ -51,34 +51,22 @@
     // ref'ed).
     static PassRefPtr<BitmapImageSingleFrameSkia> create(const SkBitmap&, bool copyPixels);
 
-    virtual bool isBitmapImage() const { return true; }
+    virtual bool isBitmapImage() const;
 
-    virtual bool currentFrameHasAlpha() { return !m_nativeImage.bitmap().isOpaque(); }
+    virtual bool currentFrameHasAlpha();
 
-    virtual IntSize size() const
-    {
-        return IntSize(m_nativeImage.bitmap().width(), m_nativeImage.bitmap().height());
-    }
+    virtual IntSize size() const;
 
     // Do nothing, as we only have the one representation of data (decoded).
-    virtual void destroyDecodedData(bool destroyAll = true) { }
+    virtual void destroyDecodedData(bool destroyAll = true);
 
-    virtual unsigned decodedSize() const
-    {
-        return m_nativeImage.decodedSize();
-    }
+    virtual unsigned decodedSize() const;
 
     // We only have a single frame.
-    virtual NativeImagePtr nativeImageForCurrentFrame()
-    {
-        return &m_nativeImage;
-    }
+    virtual NativeImagePtr nativeImageForCurrentFrame();
 
 #if !ASSERT_DISABLED
-    virtual bool notSolidColor()
-    {
-        return m_nativeImage.bitmap().width() != 1 || m_nativeImage.bitmap().height() != 1;
-    }
+    virtual bool notSolidColor();
 #endif
 
 protected:
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to