| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 m_observers.add(observer); | 125 m_observers.add(observer); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void HTMLCanvasElement::removeObserver(CanvasObserver* observer) | 128 void HTMLCanvasElement::removeObserver(CanvasObserver* observer) |
| 129 { | 129 { |
| 130 m_observers.remove(observer); | 130 m_observers.remove(observer); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void HTMLCanvasElement::setHeight(int value) | 133 void HTMLCanvasElement::setHeight(int value) |
| 134 { | 134 { |
| 135 setAttribute(heightAttr, String::number(value)); | 135 setAttribute(heightAttr, AtomicString::number(value)); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void HTMLCanvasElement::setWidth(int value) | 138 void HTMLCanvasElement::setWidth(int value) |
| 139 { | 139 { |
| 140 setAttribute(widthAttr, String::number(value)); | 140 setAttribute(widthAttr, AtomicString::number(value)); |
| 141 } | 141 } |
| 142 | 142 |
| 143 CanvasRenderingContext* HTMLCanvasElement::getContext(const String& type, Canvas
ContextAttributes* attrs) | 143 CanvasRenderingContext* HTMLCanvasElement::getContext(const String& type, Canvas
ContextAttributes* attrs) |
| 144 { | 144 { |
| 145 // A Canvas can either be "2D" or "webgl" but never both. If you request a 2
D canvas and the existing | 145 // A Canvas can either be "2D" or "webgl" but never both. If you request a 2
D canvas and the existing |
| 146 // context is already 2D, just return that. If the existing context is WebGL
, then destroy it | 146 // context is already 2D, just return that. If the existing context is WebGL
, then destroy it |
| 147 // before creating a new 2D context. Vice versa when requesting a WebGL canv
as. Requesting a | 147 // before creating a new 2D context. Vice versa when requesting a WebGL canv
as. Requesting a |
| 148 // context with any other type string will destroy any existing context. | 148 // context with any other type string will destroy any existing context. |
| 149 enum ContextType { | 149 enum ContextType { |
| 150 Context2d, | 150 Context2d, |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 ASSERT(hasImageBuffer() && !m_didFailToCreateImageBuffer); | 551 ASSERT(hasImageBuffer() && !m_didFailToCreateImageBuffer); |
| 552 IntSize unscaledSize = size(); | 552 IntSize unscaledSize = size(); |
| 553 IntSize size = convertLogicalToDevice(unscaledSize); | 553 IntSize size = convertLogicalToDevice(unscaledSize); |
| 554 AffineTransform transform; | 554 AffineTransform transform; |
| 555 if (size.width() && size.height()) | 555 if (size.width() && size.height()) |
| 556 transform.scaleNonUniform(size.width() / unscaledSize.width(), size.heig
ht() / unscaledSize.height()); | 556 transform.scaleNonUniform(size.width() / unscaledSize.width(), size.heig
ht() / unscaledSize.height()); |
| 557 return m_imageBuffer->baseTransform() * transform; | 557 return m_imageBuffer->baseTransform() * transform; |
| 558 } | 558 } |
| 559 | 559 |
| 560 } | 560 } |
| OLD | NEW |