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 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 return surface.release(); | 685 return surface.release(); |
686 surfaceFactory = adoptPtr(new UnacceleratedSurfaceFactory()); // recreat
e because previous one was released | 686 surfaceFactory = adoptPtr(new UnacceleratedSurfaceFactory()); // recreat
e because previous one was released |
687 } | 687 } |
688 | 688 |
689 return surfaceFactory->createSurface(deviceSize, opacityMode); | 689 return surfaceFactory->createSurface(deviceSize, opacityMode); |
690 } | 690 } |
691 | 691 |
692 void HTMLCanvasElement::createImageBuffer() | 692 void HTMLCanvasElement::createImageBuffer() |
693 { | 693 { |
694 createImageBufferInternal(nullptr); | 694 createImageBufferInternal(nullptr); |
695 if (m_didFailToCreateImageBuffer && m_context->is2d()) | 695 if (m_didFailToCreateImageBuffer && m_context->is2d() && !size().isEmpty()) |
696 m_context->loseContext(CanvasRenderingContext::SyntheticLostContext); | 696 m_context->loseContext(CanvasRenderingContext::SyntheticLostContext); |
697 } | 697 } |
698 | 698 |
699 void HTMLCanvasElement::createImageBufferInternal(PassOwnPtr<ImageBufferSurface>
externalSurface) | 699 void HTMLCanvasElement::createImageBufferInternal(PassOwnPtr<ImageBufferSurface>
externalSurface) |
700 { | 700 { |
701 ASSERT(!m_imageBuffer); | 701 ASSERT(!m_imageBuffer); |
702 | 702 |
703 m_didFailToCreateImageBuffer = true; | 703 m_didFailToCreateImageBuffer = true; |
704 m_imageBufferIsClear = true; | 704 m_imageBufferIsClear = true; |
705 | 705 |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 { | 943 { |
944 return FloatSize(width(), height()); | 944 return FloatSize(width(), height()); |
945 } | 945 } |
946 | 946 |
947 bool HTMLCanvasElement::isOpaque() const | 947 bool HTMLCanvasElement::isOpaque() const |
948 { | 948 { |
949 return m_context && !m_context->hasAlpha(); | 949 return m_context && !m_context->hasAlpha(); |
950 } | 950 } |
951 | 951 |
952 } // blink | 952 } // blink |
OLD | NEW |