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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 }; | 163 }; |
164 | 164 |
165 // FIXME - The code depends on the context not going away once created, to p
revent JS from | 165 // FIXME - The code depends on the context not going away once created, to p
revent JS from |
166 // seeing a dangling pointer. So for now we will disallow the context from b
eing changed | 166 // seeing a dangling pointer. So for now we will disallow the context from b
eing changed |
167 // once it is created. | 167 // once it is created. |
168 if (type == "2d") { | 168 if (type == "2d") { |
169 if (m_context && !m_context->is2d()) | 169 if (m_context && !m_context->is2d()) |
170 return 0; | 170 return 0; |
171 if (!m_context) { | 171 if (!m_context) { |
172 HistogramSupport::histogramEnumeration("Canvas.ContextType", Context
2d, ContextTypeCount); | 172 HistogramSupport::histogramEnumeration("Canvas.ContextType", Context
2d, ContextTypeCount); |
173 m_context = CanvasRenderingContext2D::create(this, RuntimeEnabledFea
tures::experimentalCanvasFeaturesEnabled() ? static_cast<Canvas2DContextAttribut
es*>(attrs) : 0, document().inQuirksMode()); | 173 m_context = CanvasRenderingContext2D::create(this, static_cast<Canva
s2DContextAttributes*>(attrs), document().inQuirksMode()); |
174 if (m_context) | 174 if (m_context) |
175 scheduleLayerUpdate(); | 175 scheduleLayerUpdate(); |
176 } | 176 } |
177 return m_context.get(); | 177 return m_context.get(); |
178 } | 178 } |
179 | 179 |
180 Settings* settings = document().settings(); | 180 Settings* settings = document().settings(); |
181 if (settings && settings->webGLEnabled()) { | 181 if (settings && settings->webGLEnabled()) { |
182 // Accept the legacy "webkit-3d" name as well as the provisional "experi
mental-webgl" name. | 182 // Accept the legacy "webkit-3d" name as well as the provisional "experi
mental-webgl" name. |
183 // Now that WebGL is ratified, we will also accept "webgl" as the contex
t name in Chrome. | 183 // Now that WebGL is ratified, we will also accept "webgl" as the contex
t name in Chrome. |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 FloatSize unscaledSize = size(); | 580 FloatSize unscaledSize = size(); |
581 FloatSize deviceSize = convertLogicalToDevice(unscaledSize); | 581 FloatSize deviceSize = convertLogicalToDevice(unscaledSize); |
582 IntSize size(deviceSize.width(), deviceSize.height()); | 582 IntSize size(deviceSize.width(), deviceSize.height()); |
583 AffineTransform transform; | 583 AffineTransform transform; |
584 if (size.width() && size.height()) | 584 if (size.width() && size.height()) |
585 transform.scaleNonUniform(size.width() / unscaledSize.width(), size.heig
ht() / unscaledSize.height()); | 585 transform.scaleNonUniform(size.width() / unscaledSize.width(), size.heig
ht() / unscaledSize.height()); |
586 return m_imageBuffer->baseTransform() * transform; | 586 return m_imageBuffer->baseTransform() * transform; |
587 } | 587 } |
588 | 588 |
589 } | 589 } |
OLD | NEW |