Changeset 41358 in webkit
- Timestamp:
- Mar 2, 2009 7:37:02 AM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r41357 r41358 1 2009-03-02 Adam Treat <adam.treat@torchmobile.com> 2 3 Reviewed by Adam Roben and previously by Eric Seidel and Simon Fraser. 4 5 https://bugs.webkit.org/show_bug.cgi?id=24227 6 Ensure that the checkForSolidColor() optimization is correctly triggered 7 for all cases of drawPattern. Currently, the optimization was not triggered 8 when the check had not been previously performed via a request for the 9 image's NativeImagePtr. 10 11 Implement the Qt version of the checkForSolidColor() method. Combined with 12 the bug fix this reduces the time it takes to draw a repeating background 13 of a 1x1 image from ~50msecs to ~0msecs on my machine. 14 15 * platform/graphics/BitmapImage.cpp: 16 (WebCore::BitmapImage::BitmapImage): 17 * platform/graphics/BitmapImage.h: 18 (WebCore::BitmapImage::mayFillWithSolidColor): 19 * platform/graphics/Image.h: 20 (WebCore::Image::mayFillWithSolidColor): 21 * platform/graphics/cairo/ImageCairo.cpp: 22 (WebCore::BitmapImage::BitmapImage): 23 (WebCore::BitmapImage::checkForSolidColor): 24 * platform/graphics/cg/ImageCG.cpp: 25 (WebCore::BitmapImage::BitmapImage): 26 (WebCore::BitmapImage::checkForSolidColor): 27 * platform/graphics/qt/ImageQt.cpp: 28 (WebCore::BitmapImage::checkForSolidColor): 29 * platform/graphics/skia/ImageSkia.cpp: 30 (WebCore::BitmapImage::checkForSolidColor): 31 * platform/graphics/wx/ImageWx.cpp: 32 (WebCore::BitmapImage::checkForSolidColor): 33 1 34 2009-03-02 Gustavo Noronha Silva <gns@gnome.org> 2 35 -
trunk/WebCore/platform/graphics/BitmapImage.cpp
r41304 r41358 54 54 , m_desiredFrameStartTime(0) 55 55 , m_isSolidColor(false) 56 , m_checkedForSolidColor(false) 56 57 , m_animationFinished(false) 57 58 , m_allDataReceived(false) -
trunk/WebCore/platform/graphics/BitmapImage.h
r41304 r41358 209 209 210 210 // Checks to see if the image is a 1x1 solid color. We optimize these images and just do a fill rect instead. 211 // This check should happen regardless whether m_checkedForSolidColor is already set, as the frame may have 212 // changed. 211 213 void checkForSolidColor(); 212 214 213 virtual bool mayFillWithSolidColor() const { return m_isSolidColor && m_currentFrame == 0; } 215 virtual bool mayFillWithSolidColor() 216 { 217 if (!m_checkedForSolidColor && frameCount() > 0) { 218 checkForSolidColor(); 219 ASSERT(m_checkedForSolidColor); 220 } 221 return m_isSolidColor && m_currentFrame == 0; 222 } 214 223 virtual Color solidColor() const { return m_solidColor; } 215 224 … … 233 242 Color m_solidColor; // If we're a 1x1 solid color, this is the color to use to fill. 234 243 bool m_isSolidColor; // Whether or not we are a 1x1 solid image. 244 bool m_checkedForSolidColor; // Whether we've checked the frame for solid color. 235 245 236 246 bool m_animationFinished; // Whether or not we've completed the entire animation. -
trunk/WebCore/platform/graphics/Image.h
r41304 r41358 156 156 157 157 // Supporting tiled drawing 158 virtual bool mayFillWithSolidColor() const{ return false; }158 virtual bool mayFillWithSolidColor() { return false; } 159 159 virtual Color solidColor() const { return Color(); } 160 160 -
trunk/WebCore/platform/graphics/cairo/ImageCairo.cpp
r41304 r41358 61 61 , m_repetitionsComplete(0) 62 62 , m_isSolidColor(false) 63 , m_checkedForSolidColor(false) 63 64 , m_animationFinished(true) 64 65 , m_allDataReceived(true) … … 183 184 // FIXME: It's easy to implement this optimization. Just need to check the RGBA32 buffer to see if it is 1x1. 184 185 m_isSolidColor = false; 186 m_checkedForSolidColor = true; 185 187 } 186 188 -
trunk/WebCore/platform/graphics/cg/ImageCG.cpp
r41304 r41358 74 74 , m_repetitionsComplete(0) 75 75 , m_isSolidColor(false) 76 , m_checkedForSolidColor(false) 76 77 , m_animationFinished(true) 77 78 , m_allDataReceived(true) … … 100 101 void BitmapImage::checkForSolidColor() 101 102 { 103 m_checkedForSolidColor = true; 102 104 if (frameCount() > 1) 103 105 m_isSolidColor = false; -
trunk/WebCore/platform/graphics/qt/ImageQt.cpp
r41304 r41358 3 3 * Copyright (C) 2006 Zack Rusin <zack@kde.org> 4 4 * Copyright (C) 2006 Simon Hausmann <hausmann@kde.org> 5 * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 5 6 * 6 7 * All rights reserved. … … 163 164 void BitmapImage::checkForSolidColor() 164 165 { 165 // FIXME: It's easy to implement this optimization. Just need to check the RGBA32 buffer to see if it is 1x1.166 166 m_isSolidColor = false; 167 m_checkedForSolidColor = true; 168 169 if (frameCount() > 1) 170 return; 171 172 QPixmap* framePixmap = frameAtIndex(0); 173 if (!framePixmap || framePixmap->width() != 1 || framePixmap->height() != 1) 174 return; 175 176 m_isSolidColor = true; 177 m_solidColor = QColor(framePixmap->toImage().pixel(0, 0)); 167 178 } 168 179 -
trunk/WebCore/platform/graphics/skia/ImageSkia.cpp
r41304 r41358 401 401 void BitmapImage::checkForSolidColor() 402 402 { 403 m_checkedForSolidColor = true; 403 404 } 404 405 -
trunk/WebCore/platform/graphics/wx/ImageWx.cpp
r41304 r41358 238 238 void BitmapImage::checkForSolidColor() 239 239 { 240 240 m_checkedForSolidColor = true; 241 241 } 242 242
Note: See TracChangeset
for help on using the changeset viewer.