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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 return false; | 89 return false; |
90 return true; | 90 return true; |
91 } | 91 } |
92 | 92 |
93 PassRefPtr<Image> createTransparentImage(const IntSize& size) | 93 PassRefPtr<Image> createTransparentImage(const IntSize& size) |
94 { | 94 { |
95 ASSERT(canCreateImageBuffer(size)); | 95 ASSERT(canCreateImageBuffer(size)); |
96 SkBitmap bitmap; | 96 SkBitmap bitmap; |
97 bitmap.allocN32Pixels(size.width(), size.height()); | 97 bitmap.allocN32Pixels(size.width(), size.height()); |
98 bitmap.eraseColor(SK_ColorTRANSPARENT); | 98 bitmap.eraseColor(SK_ColorTRANSPARENT); |
99 return BitmapImage::create(NativeImageSkia::create(bitmap)); | 99 return BitmapImage::create(bitmap); |
100 } | 100 } |
101 | 101 |
102 } // namespace | 102 } // namespace |
103 | 103 |
104 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(CanvasObserver); | 104 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(CanvasObserver); |
105 | 105 |
106 inline HTMLCanvasElement::HTMLCanvasElement(Document& document) | 106 inline HTMLCanvasElement::HTMLCanvasElement(Document& document) |
107 : HTMLElement(canvasTag, document) | 107 : HTMLElement(canvasTag, document) |
108 , DocumentVisibilityObserver(document) | 108 , DocumentVisibilityObserver(document) |
109 , m_size(DefaultWidth, DefaultHeight) | 109 , m_size(DefaultWidth, DefaultHeight) |
(...skipping 782 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 |