Changeset 24090 in webkit
- Timestamp:
- Jul 7, 2007 1:14:41 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r24089 r24090 1 2007-07-07 Rob Buis <buis@kde.org> 2 3 Reviewed by Darin. 4 5 Testcase for: 6 http://bugs.webkit.org/show_bug.cgi?id=8994 7 Canvas doesn't reset on resize 8 9 * fast/canvas/canvas-resize-reset-expected.checksum: Added. 10 * fast/canvas/canvas-resize-reset-expected.png: Added. 11 * fast/canvas/canvas-resize-reset-expected.txt: Added. 12 * fast/canvas/canvas-resize-reset.html: Added. 13 1 14 2007-07-07 Alexey Proskuryakov <ap@webkit.org> 2 15 -
trunk/WebCore/ChangeLog
r24088 r24090 1 2007-07-07 Rob Buis <buis@kde.org> 2 3 Reviewed and tweaked by Darin. 4 5 http://bugs.webkit.org/show_bug.cgi?id=8994 6 Canvas doesn't reset on resize 7 8 Also reset the rendering context when resetting the canvas. 9 10 * html/HTMLCanvasElement.cpp: 11 (WebCore::HTMLCanvasElement::reset): 12 (WebCore::HTMLCanvasElement::drawingContext): 13 1 14 2007-07-07 Alexey Proskuryakov <ap@webkit.org> 2 15 -
trunk/WebCore/html/CanvasRenderingContext2D.cpp
r23935 r24090 436 436 if (!c) 437 437 return; 438 if (state().m_path.isEmpty()) 439 return; 438 440 // FIXME: Do this through platform-independent GraphicsContext API. 439 441 #if PLATFORM(CG) … … 472 474 GraphicsContext* c = drawingContext(); 473 475 if (!c) 476 return; 477 if (state().m_path.isEmpty()) 474 478 return; 475 479 // FIXME: Do this through platform-independent GraphicsContext API. -
trunk/WebCore/html/HTMLCanvasElement.cpp
r21749 r24090 39 39 #include "RenderHTMLCanvas.h" 40 40 #include "Settings.h" 41 #include <math.h> 41 42 42 43 #if PLATFORM(QT) … … 45 46 #endif 46 47 47 #include <math.h>48 49 50 48 namespace WebCore { 51 49 … … 53 51 54 52 // These values come from the WhatWG spec. 55 const int defaultWidth = 300;56 const int defaultHeight = 150;53 static const int defaultWidth = 300; 54 static const int defaultHeight = 150; 57 55 58 56 // Firefox limits width/height to 32767 pixels, but slows down dramatically before it 59 // reaches that limit we limit by area instead, giving us larger max dimensions, in exchange60 // for reducemaximum canvas size.61 const float maxCanvasArea = 32768 * 8192; // Maximum canvas area in CSS pixels57 // reaches that limit. We limit by area instead, giving us larger maximum dimensions, 58 // in exchange for a smaller maximum canvas size. 59 static const float maxCanvasArea = 32768 * 8192; // Maximum canvas area in CSS pixels 62 60 63 61 HTMLCanvasElement::HTMLCanvasElement(Document* doc) … … 178 176 delete m_drawingContext; 179 177 m_drawingContext = 0; 178 if (m_2DContext) 179 m_2DContext->reset(); 180 180 181 181 if (RenderObject* ro = renderer()) … … 218 218 float wf = ceilf(unscaledWidth * pageScaleFactor); 219 219 float hf = ceilf(unscaledHeight * pageScaleFactor); 220 220 221 221 if (!(wf >= 1 && hf >= 1 && wf * hf <= maxCanvasArea)) 222 222 return; 223 223 224 224 unsigned w = static_cast<unsigned>(wf); 225 225 unsigned h = static_cast<unsigned>(hf); 226 226 227 #if PLATFORM(CG) 227 228 size_t bytesPerRow = w * 4; 228 229 if (bytesPerRow / 4 != w) // check for overflow 229 230 return; 230 #if PLATFORM(CG)231 231 m_data = fastCalloc(h, bytesPerRow); 232 #elif PLATFORM(QT)233 m_data = new QPixmap(w, h);234 #endif235 232 if (!m_data) 236 233 return; 237 #if PLATFORM(CG)238 234 CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 239 235 CGContextRef bitmapContext = CGBitmapContextCreate(m_data, w, h, 8, bytesPerRow, colorSpace, kCGImageAlphaPremultipliedLast); … … 243 239 CGContextRelease(bitmapContext); 244 240 #elif PLATFORM(QT) 241 m_data = new QPixmap(w, h); 242 if (!m_data) 243 return; 245 244 m_data->fill(Qt::white); 246 245 m_painter = new QPainter(m_data); … … 263 262 if (!context) 264 263 return 0; 265 264 266 265 CGContextRef contextRef = context->platformContext(); 267 266 if (!contextRef) 268 267 return 0; 269 268 270 269 CGContextFlush(contextRef); 271 270 272 271 return CGBitmapContextCreateImage(contextRef); 273 272 } 274 #elif PLATFORM(QT) 273 274 #elif PLATFORM(QT) 275 275 276 QPixmap HTMLCanvasElement::createPlatformImage() const 276 277 {
Note: See TracChangeset
for help on using the changeset viewer.