| 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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 RefPtr<SkImage> image = sourceImage->imageForCurrentFrame(); | 423 RefPtr<SkImage> image = sourceImage->imageForCurrentFrame(); |
| 424 for (CanvasDrawListener* listener : m_listeners) { | 424 for (CanvasDrawListener* listener : m_listeners) { |
| 425 if (listener->needsNewFrame()) { | 425 if (listener->needsNewFrame()) { |
| 426 listener->sendNewFrame(image); | 426 listener->sendNewFrame(image); |
| 427 } | 427 } |
| 428 } | 428 } |
| 429 } | 429 } |
| 430 | 430 |
| 431 } | 431 } |
| 432 | 432 |
| 433 void HTMLCanvasElement::paint(GraphicsContext* context, const LayoutRect& r) | 433 void HTMLCanvasElement::paint(GraphicsContext& context, const LayoutRect& r) |
| 434 { | 434 { |
| 435 // FIXME: crbug.com/438240; there is a bug with the new CSS blending and com
positing feature. | 435 // FIXME: crbug.com/438240; there is a bug with the new CSS blending and com
positing feature. |
| 436 if (!m_context) | 436 if (!m_context) |
| 437 return; | 437 return; |
| 438 if (!paintsIntoCanvasBuffer() && !document().printing()) | 438 if (!paintsIntoCanvasBuffer() && !document().printing()) |
| 439 return; | 439 return; |
| 440 | 440 |
| 441 m_context->paintRenderingResultsToCanvas(FrontBuffer); | 441 m_context->paintRenderingResultsToCanvas(FrontBuffer); |
| 442 if (hasImageBuffer()) { | 442 if (hasImageBuffer()) { |
| 443 if (!context->contextDisabled()) { | 443 if (!context.contextDisabled()) { |
| 444 SkXfermode::Mode compositeOperator = !m_context || m_context->hasAlp
ha() ? SkXfermode::kSrcOver_Mode : SkXfermode::kSrc_Mode; | 444 SkXfermode::Mode compositeOperator = !m_context || m_context->hasAlp
ha() ? SkXfermode::kSrcOver_Mode : SkXfermode::kSrc_Mode; |
| 445 buffer()->draw(context, pixelSnappedIntRect(r), 0, compositeOperator
); | 445 buffer()->draw(context, pixelSnappedIntRect(r), 0, compositeOperator
); |
| 446 } | 446 } |
| 447 } else { | 447 } else { |
| 448 // When alpha is false, we should draw to opaque black. | 448 // When alpha is false, we should draw to opaque black. |
| 449 if (!m_context->hasAlpha()) | 449 if (!m_context->hasAlpha()) |
| 450 context->fillRect(FloatRect(r), Color(0, 0, 0)); | 450 context.fillRect(FloatRect(r), Color(0, 0, 0)); |
| 451 } | 451 } |
| 452 | 452 |
| 453 if (is3D() && paintsIntoCanvasBuffer()) | 453 if (is3D() && paintsIntoCanvasBuffer()) |
| 454 m_context->markLayerComposited(); | 454 m_context->markLayerComposited(); |
| 455 } | 455 } |
| 456 | 456 |
| 457 bool HTMLCanvasElement::is3D() const | 457 bool HTMLCanvasElement::is3D() const |
| 458 { | 458 { |
| 459 return m_context && m_context->is3d(); | 459 return m_context && m_context->is3d(); |
| 460 } | 460 } |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 } | 991 } |
| 992 return ImageBitmapSource::fulfillImageBitmap(scriptState, isPaintable() ? Im
ageBitmap::create(this, IntRect(sx, sy, sw, sh)) : nullptr); | 992 return ImageBitmapSource::fulfillImageBitmap(scriptState, isPaintable() ? Im
ageBitmap::create(this, IntRect(sx, sy, sw, sh)) : nullptr); |
| 993 } | 993 } |
| 994 | 994 |
| 995 bool HTMLCanvasElement::isOpaque() const | 995 bool HTMLCanvasElement::isOpaque() const |
| 996 { | 996 { |
| 997 return m_context && !m_context->hasAlpha(); | 997 return m_context && !m_context->hasAlpha(); |
| 998 } | 998 } |
| 999 | 999 |
| 1000 } // blink | 1000 } // blink |
| OLD | NEW |