Changeset 41295 in webkit
- Timestamp:
- Feb 27, 2009 12:42:51 PM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r41294 r41295 1 2009-02-27 Adam Treat <adam.treat@torchmobile.com> 2 3 Reviewed 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 * platform/graphics/cg/ImageCG.cpp: 24 (WebCore::BitmapImage::BitmapImage): 25 (WebCore::BitmapImage::checkForSolidColor): 26 * platform/graphics/qt/ImageQt.cpp: 27 (WebCore::BitmapImage::checkForSolidColor): 28 * platform/graphics/skia/ImageSkia.cpp: 29 (WebCore::BitmapImage::checkForSolidColor): 30 * platform/graphics/wx/ImageWx.cpp: 31 (WebCore::BitmapImage::checkForSolidColor): 32 1 33 2009-02-27 Dirk Schulze <krit@webkit.org> 2 34 -
trunk/WebCore/platform/graphics/BitmapImage.cpp
r39964 r41295 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
r40759 r41295 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) { 218 ASSERT(m_haveFrameCount); 219 checkForSolidColor(); 220 ASSERT(m_checkedForSolidColor); 221 } 222 return m_isSolidColor && m_currentFrame == 0; 223 } 214 224 virtual Color solidColor() const { return m_solidColor; } 215 225 … … 233 243 Color m_solidColor; // If we're a 1x1 solid color, this is the color to use to fill. 234 244 bool m_isSolidColor; // Whether or not we are a 1x1 solid image. 245 bool m_checkedForSolidColor; // Whether we've checked the frame for solid color. 235 246 236 247 bool m_animationFinished; // Whether or not we've completed the entire animation. -
trunk/WebCore/platform/graphics/Image.h
r40011 r41295 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
r39751 r41295 61 61 , m_repetitionsComplete(0) 62 62 , m_isSolidColor(false) 63 , m_checkedForSolidColor(false) 63 64 , m_animationFinished(true) 64 65 , m_allDataReceived(true) -
trunk/WebCore/platform/graphics/cg/ImageCG.cpp
r39751 r41295 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
r40759 r41295 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. … … 158 159 void BitmapImage::checkForSolidColor() 159 160 { 160 // FIXME: It's easy to implement this optimization. Just need to check the RGBA32 buffer to see if it is 1x1.161 161 m_isSolidColor = false; 162 m_checkedForSolidColor = true; 163 164 if (frameCount() > 1) 165 return; 166 167 QPixmap* framePixmap = frameAtIndex(0); 168 if (!framePixmap || framePixmap->width() != 1 || framePixmap->height() != 1) 169 return; 170 171 m_isSolidColor = true; 172 m_solidColor = QColor(framePixmap->toImage().pixel(0, 0)); 162 173 } 163 174 -
trunk/WebCore/platform/graphics/skia/ImageSkia.cpp
r41287 r41295 401 401 void BitmapImage::checkForSolidColor() 402 402 { 403 m_checkedForSolidColor = true; 403 404 } 404 405 -
trunk/WebCore/platform/graphics/wx/ImageWx.cpp
r40197 r41295 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.