Changeset 38685 in webkit
- Timestamp:
- Nov 21, 2008 7:08:15 PM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r38684 r38685 1 2008-11-15 Kevin Watters <kevinwatters@gmail.com> 2 3 Reviewed by Kevin Ollivier. 4 5 Improve wx image drawing performance considerably when using wxGraphicsContext 6 by avoiding unnecessary copies and drawing. 7 8 https://bugs.webkit.org/show_bug.cgi?id=22404 9 10 * platform/graphics/wx/ImageWx.cpp: 11 (WebCore::BitmapImage::draw): 12 (WebCore::BitmapImage::drawPattern): 13 14 1 15 2008-11-21 Kevin Watters <kevinwatters@gmail.com> 2 16 -
trunk/WebCore/platform/graphics/wx/ImageWx.cpp
r37612 r38685 96 96 #if USE(WXGC) 97 97 wxGCDC* context = (wxGCDC*)ctxt->platformContext(); 98 wxGraphicsContext* gc = context->GetGraphicsContext(); 98 99 #else 99 100 wxWindowDC* context = ctxt->platformContext(); … … 115 116 // Set the compositing operation. 116 117 ctxt->setCompositeOperation(op); 117 118 119 #if USE(WXGC) 120 float scaleX = src.width() / dst.width(); 121 float scaleY = src.height() / dst.height(); 122 123 FloatRect adjustedDestRect = dst; 124 FloatSize selfSize = currentFrameSize(); 125 126 if (src.size() != selfSize) { 127 adjustedDestRect.setLocation(FloatPoint(dst.x() - src.x() / scaleX, dst.y() - src.y() / scaleY)); 128 adjustedDestRect.setSize(FloatSize(selfSize.width() / scaleX, selfSize.height() / scaleY)); 129 } 130 131 // If the image is only partially loaded, then shrink the destination rect that we're drawing into accordingly. 132 int currHeight = bitmap->GetHeight(); 133 if (currHeight < selfSize.height()) 134 adjustedDestRect.setHeight(adjustedDestRect.height() * currHeight / selfSize.height()); 135 136 gc->DrawBitmap(*bitmap, adjustedDestRect.x(), adjustedDestRect.y(), adjustedDestRect.width(), adjustedDestRect.height()); 137 #else 118 138 IntRect srcIntRect(src); 119 139 IntRect dstIntRect(dst); … … 125 145 img.Rescale(dstIntRect.width(), dstIntRect.height()); 126 146 bitmap = new wxBitmap(img); 127 } 147 } 148 128 149 wxMemoryDC mydc; 129 150 ASSERT(bitmap->GetRefData()); … … 144 165 bitmap = NULL; 145 166 } 167 #endif 168 146 169 ctxt->restore(); 147 170 } … … 170 193 wxGraphicsContext* gc = context->GetGraphicsContext(); 171 194 gc->ConcatTransform(patternTransform); 172 #endif 173 195 #else 174 196 wxMemoryDC mydc; 175 197 mydc.SelectObject(*bitmap); 176 177 while ( currentW < dstRect.width() ) { 178 while ( currentH < dstRect.height() ) { 198 #endif 199 200 wxPoint origin(context->GetDeviceOrigin()); 201 wxSize clientSize(context->GetSize()); 202 203 while ( currentW < dstRect.width() && currentW < clientSize.x - origin.x ) { 204 while ( currentH < dstRect.height() && currentH < clientSize.y - origin.y) { 205 #if USE(WXGC) 206 gc->DrawBitmap(*bitmap, (wxDouble)dstRect.x() + currentW, (wxDouble)dstRect.y() + currentH, (wxDouble)srcRect.width(), (wxDouble)srcRect.height()); 207 #else 179 208 context->Blit((wxCoord)dstRect.x() + currentW, (wxCoord)dstRect.y() + currentH, 180 209 (wxCoord)srcRect.width(), (wxCoord)srcRect.height(), &mydc, 181 210 (wxCoord)srcRect.x(), (wxCoord)srcRect.y(), wxCOPY, true); 211 #endif 182 212 currentH += srcRect.height(); 183 213 } … … 186 216 } 187 217 ctxt->restore(); 218 219 #if !USE(WXGC) 188 220 mydc.SelectObject(wxNullBitmap); 221 #endif 189 222 190 223 // NB: delete is causing crashes during page load, but not during the deletion
Note: See TracChangeset
for help on using the changeset viewer.