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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
308 // Clear the dirty rect | 308 // Clear the dirty rect |
309 m_dirtyRect = FloatRect(); | 309 m_dirtyRect = FloatRect(); |
310 | 310 |
311 if (context->paintingDisabled()) | 311 if (context->paintingDisabled()) |
312 return; | 312 return; |
313 | 313 |
314 if (m_context) { | 314 if (m_context) { |
315 if (!paintsIntoCanvasBuffer() && !document().printing()) | 315 if (!paintsIntoCanvasBuffer() && !document().printing()) |
316 return; | 316 return; |
317 m_context->paintRenderingResultsToCanvas(); | 317 m_context->paintRenderingResultsToCanvas(); |
318 | |
319 // When alpha is false, we should initialize to opaque black. | |
320 if (!hasImageBuffer() && !m_context->hasAlpha()) | |
321 createImageBuffer(); | |
Justin Novosad
2014/03/17 17:24:23
I think you can solve this problem without creatin
| |
318 } | 322 } |
319 | 323 |
320 if (hasImageBuffer()) { | 324 if (hasImageBuffer()) { |
321 ImageBuffer* imageBuffer = buffer(); | 325 ImageBuffer* imageBuffer = buffer(); |
322 if (imageBuffer) { | 326 if (imageBuffer) { |
323 CompositeOperator compositeOperator = !m_context || m_context->hasAl pha() ? CompositeSourceOver : CompositeCopy; | 327 CompositeOperator compositeOperator = !m_context || m_context->hasAl pha() ? CompositeSourceOver : CompositeCopy; |
324 if (m_presentedImage) | 328 if (m_presentedImage) |
325 context->drawImage(m_presentedImage.get(), pixelSnappedIntRect(r ), compositeOperator, DoNotRespectImageOrientation, useLowQualityScale); | 329 context->drawImage(m_presentedImage.get(), pixelSnappedIntRect(r ), compositeOperator, DoNotRespectImageOrientation, useLowQualityScale); |
326 else | 330 else |
327 context->drawImageBuffer(imageBuffer, pixelSnappedIntRect(r), co mpositeOperator, blink::WebBlendModeNormal, useLowQualityScale); | 331 context->drawImageBuffer(imageBuffer, pixelSnappedIntRect(r), co mpositeOperator, blink::WebBlendModeNormal, useLowQualityScale); |
328 } | 332 } |
329 } | 333 } |
Justin Novosad
2014/03/17 17:24:23
You could add an else clause here that just draws
| |
330 | 334 |
331 if (is3D()) | 335 if (is3D()) |
332 toWebGLRenderingContext(m_context.get())->markLayerComposited(); | 336 toWebGLRenderingContext(m_context.get())->markLayerComposited(); |
333 } | 337 } |
334 | 338 |
335 bool HTMLCanvasElement::is3D() const | 339 bool HTMLCanvasElement::is3D() const |
336 { | 340 { |
337 return m_context && m_context->is3d(); | 341 return m_context && m_context->is3d(); |
338 } | 342 } |
339 | 343 |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
653 { | 657 { |
654 return !originClean(); | 658 return !originClean(); |
655 } | 659 } |
656 | 660 |
657 FloatSize HTMLCanvasElement::sourceSize() const | 661 FloatSize HTMLCanvasElement::sourceSize() const |
658 { | 662 { |
659 return FloatSize(width(), height()); | 663 return FloatSize(width(), height()); |
660 } | 664 } |
661 | 665 |
662 } | 666 } |
OLD | NEW |