| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
| 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 return canCreateImageBuffer(size()); | 276 return canCreateImageBuffer(size()); |
| 277 return buffer(); | 277 return buffer(); |
| 278 } | 278 } |
| 279 | 279 |
| 280 void HTMLCanvasElement::didDraw(const FloatRect& rect) | 280 void HTMLCanvasElement::didDraw(const FloatRect& rect) |
| 281 { | 281 { |
| 282 if (rect.isEmpty()) | 282 if (rect.isEmpty()) |
| 283 return; | 283 return; |
| 284 m_imageBufferIsClear = false; | 284 m_imageBufferIsClear = false; |
| 285 clearCopiedImage(); | 285 clearCopiedImage(); |
| 286 if (renderer()) | 286 if (layoutObject()) |
| 287 renderer()->setMayNeedPaintInvalidation(); | 287 layoutObject()->setMayNeedPaintInvalidation(); |
| 288 m_dirtyRect.unite(rect); | 288 m_dirtyRect.unite(rect); |
| 289 if (m_context && m_context->is2d() && hasImageBuffer()) | 289 if (m_context && m_context->is2d() && hasImageBuffer()) |
| 290 buffer()->didDraw(rect); | 290 buffer()->didDraw(rect); |
| 291 } | 291 } |
| 292 | 292 |
| 293 void HTMLCanvasElement::didFinalizeFrame() | 293 void HTMLCanvasElement::didFinalizeFrame() |
| 294 { | 294 { |
| 295 if (m_dirtyRect.isEmpty()) | 295 if (m_dirtyRect.isEmpty()) |
| 296 return; | 296 return; |
| 297 | 297 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 toCanvasRenderingContext2D(m_context.get())->clearRect(0, 0, width()
, height()); | 373 toCanvasRenderingContext2D(m_context.get())->clearRect(0, 0, width()
, height()); |
| 374 } | 374 } |
| 375 return; | 375 return; |
| 376 } | 376 } |
| 377 | 377 |
| 378 setSurfaceSize(newSize); | 378 setSurfaceSize(newSize); |
| 379 | 379 |
| 380 if (m_context && m_context->is3d() && oldSize != size()) | 380 if (m_context && m_context->is3d() && oldSize != size()) |
| 381 toWebGLRenderingContextBase(m_context.get())->reshape(width(), height())
; | 381 toWebGLRenderingContextBase(m_context.get())->reshape(width(), height())
; |
| 382 | 382 |
| 383 if (LayoutObject* renderer = this->renderer()) { | 383 if (LayoutObject* renderer = this->layoutObject()) { |
| 384 if (renderer->isCanvas()) { | 384 if (renderer->isCanvas()) { |
| 385 if (oldSize != size()) { | 385 if (oldSize != size()) { |
| 386 toLayoutHTMLCanvas(renderer)->canvasSizeChanged(); | 386 toLayoutHTMLCanvas(renderer)->canvasSizeChanged(); |
| 387 if (layoutBox() && layoutBox()->hasAcceleratedCompositing()) | 387 if (layoutBox() && layoutBox()->hasAcceleratedCompositing()) |
| 388 layoutBox()->contentChanged(CanvasChanged); | 388 layoutBox()->contentChanged(CanvasChanged); |
| 389 } | 389 } |
| 390 if (hadImageBuffer) | 390 if (hadImageBuffer) |
| 391 renderer->setShouldDoFullPaintInvalidation(); | 391 renderer->setShouldDoFullPaintInvalidation(); |
| 392 } | 392 } |
| 393 } | 393 } |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 { | 892 { |
| 893 return FloatSize(width(), height()); | 893 return FloatSize(width(), height()); |
| 894 } | 894 } |
| 895 | 895 |
| 896 bool HTMLCanvasElement::isOpaque() const | 896 bool HTMLCanvasElement::isOpaque() const |
| 897 { | 897 { |
| 898 return m_context && !m_context->hasAlpha(); | 898 return m_context && !m_context->hasAlpha(); |
| 899 } | 899 } |
| 900 | 900 |
| 901 } // blink | 901 } // blink |
| OLD | NEW |