| 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 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 if (checkedExternallyAllocatedMemory.safeGet(externallyAllocatedMemory) == C
heckedState::DidOverflow) | 694 if (checkedExternallyAllocatedMemory.safeGet(externallyAllocatedMemory) == C
heckedState::DidOverflow) |
| 695 externallyAllocatedMemory = std::numeric_limits<intptr_t>::max(); | 695 externallyAllocatedMemory = std::numeric_limits<intptr_t>::max(); |
| 696 | 696 |
| 697 // Subtracting two intptr_t that are known to be positive will never underfl
ow. | 697 // Subtracting two intptr_t that are known to be positive will never underfl
ow. |
| 698 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(externallyA
llocatedMemory - m_externallyAllocatedMemory); | 698 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(externallyA
llocatedMemory - m_externallyAllocatedMemory); |
| 699 m_externallyAllocatedMemory = externallyAllocatedMemory; | 699 m_externallyAllocatedMemory = externallyAllocatedMemory; |
| 700 } | 700 } |
| 701 | 701 |
| 702 GraphicsContext* HTMLCanvasElement::drawingContext() const | 702 GraphicsContext* HTMLCanvasElement::drawingContext() const |
| 703 { | 703 { |
| 704 return buffer() ? m_imageBuffer->context() : 0; | 704 return buffer() ? m_imageBuffer->context() : nullptr; |
| 705 } | 705 } |
| 706 | 706 |
| 707 GraphicsContext* HTMLCanvasElement::existingDrawingContext() const | 707 GraphicsContext* HTMLCanvasElement::existingDrawingContext() const |
| 708 { | 708 { |
| 709 if (!hasImageBuffer()) | 709 if (!hasImageBuffer()) |
| 710 return nullptr; | 710 return nullptr; |
| 711 | 711 |
| 712 return drawingContext(); | 712 return drawingContext(); |
| 713 } | 713 } |
| 714 | 714 |
| 715 SkCanvas* HTMLCanvasElement::drawingCanvas() const |
| 716 { |
| 717 return buffer() ? m_imageBuffer->canvas() : nullptr; |
| 718 } |
| 719 |
| 720 SkCanvas* HTMLCanvasElement::existingDrawingCanvas() const |
| 721 { |
| 722 if (!hasImageBuffer()) |
| 723 return nullptr; |
| 724 |
| 725 return m_imageBuffer->canvas(); |
| 726 } |
| 727 |
| 715 ImageBuffer* HTMLCanvasElement::buffer() const | 728 ImageBuffer* HTMLCanvasElement::buffer() const |
| 716 { | 729 { |
| 717 ASSERT(m_context); | 730 ASSERT(m_context); |
| 718 if (!hasImageBuffer() && !m_didFailToCreateImageBuffer) | 731 if (!hasImageBuffer() && !m_didFailToCreateImageBuffer) |
| 719 const_cast<HTMLCanvasElement*>(this)->createImageBuffer(); | 732 const_cast<HTMLCanvasElement*>(this)->createImageBuffer(); |
| 720 return m_imageBuffer.get(); | 733 return m_imageBuffer.get(); |
| 721 } | 734 } |
| 722 | 735 |
| 723 void HTMLCanvasElement::ensureUnacceleratedImageBuffer() | 736 void HTMLCanvasElement::ensureUnacceleratedImageBuffer() |
| 724 { | 737 { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 { | 850 { |
| 838 return !originClean(); | 851 return !originClean(); |
| 839 } | 852 } |
| 840 | 853 |
| 841 FloatSize HTMLCanvasElement::sourceSize() const | 854 FloatSize HTMLCanvasElement::sourceSize() const |
| 842 { | 855 { |
| 843 return FloatSize(width(), height()); | 856 return FloatSize(width(), height()); |
| 844 } | 857 } |
| 845 | 858 |
| 846 } | 859 } |
| OLD | NEW |