| 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 30 matching lines...) Expand all Loading... |
| 41 #include "core/html/canvas/CanvasRenderingContext2D.h" | 41 #include "core/html/canvas/CanvasRenderingContext2D.h" |
| 42 #include "core/html/canvas/WebGLContextAttributes.h" | 42 #include "core/html/canvas/WebGLContextAttributes.h" |
| 43 #include "core/html/canvas/WebGLContextEvent.h" | 43 #include "core/html/canvas/WebGLContextEvent.h" |
| 44 #include "core/html/canvas/WebGLRenderingContext.h" | 44 #include "core/html/canvas/WebGLRenderingContext.h" |
| 45 #include "core/rendering/RenderHTMLCanvas.h" | 45 #include "core/rendering/RenderHTMLCanvas.h" |
| 46 #include "platform/MIMETypeRegistry.h" | 46 #include "platform/MIMETypeRegistry.h" |
| 47 #include "platform/RuntimeEnabledFeatures.h" | 47 #include "platform/RuntimeEnabledFeatures.h" |
| 48 #include "platform/graphics/Canvas2DImageBufferSurface.h" | 48 #include "platform/graphics/Canvas2DImageBufferSurface.h" |
| 49 #include "platform/graphics/GraphicsContextStateSaver.h" | 49 #include "platform/graphics/GraphicsContextStateSaver.h" |
| 50 #include "platform/graphics/ImageBuffer.h" | 50 #include "platform/graphics/ImageBuffer.h" |
| 51 #include "platform/graphics/RecordingImageBufferSurface.h" |
| 51 #include "platform/graphics/UnacceleratedImageBufferSurface.h" | 52 #include "platform/graphics/UnacceleratedImageBufferSurface.h" |
| 52 #include "platform/graphics/gpu/WebGLImageBufferSurface.h" | 53 #include "platform/graphics/gpu/WebGLImageBufferSurface.h" |
| 53 #include "platform/transforms/AffineTransform.h" | 54 #include "platform/transforms/AffineTransform.h" |
| 54 #include "public/platform/Platform.h" | 55 #include "public/platform/Platform.h" |
| 55 #include <math.h> | 56 #include <math.h> |
| 56 #include <v8.h> | 57 #include <v8.h> |
| 57 | 58 |
| 58 namespace blink { | 59 namespace blink { |
| 59 | 60 |
| 60 using namespace HTMLNames; | 61 using namespace HTMLNames; |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 } | 447 } |
| 447 | 448 |
| 448 PassOwnPtr<ImageBufferSurface> HTMLCanvasElement::createImageBufferSurface(const
IntSize& deviceSize, int* msaaSampleCount) | 449 PassOwnPtr<ImageBufferSurface> HTMLCanvasElement::createImageBufferSurface(const
IntSize& deviceSize, int* msaaSampleCount) |
| 449 { | 450 { |
| 450 OpacityMode opacityMode = !m_context || m_context->hasAlpha() ? NonOpaque :
Opaque; | 451 OpacityMode opacityMode = !m_context || m_context->hasAlpha() ? NonOpaque :
Opaque; |
| 451 | 452 |
| 452 *msaaSampleCount = 0; | 453 *msaaSampleCount = 0; |
| 453 if (is3D()) | 454 if (is3D()) |
| 454 return adoptPtr(new WebGLImageBufferSurface(size(), opacityMode)); | 455 return adoptPtr(new WebGLImageBufferSurface(size(), opacityMode)); |
| 455 | 456 |
| 457 if (RuntimeEnabledFeatures::displayList2dCanvasEnabled()) { |
| 458 OwnPtr<ImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSu
rface(size(), opacityMode)); |
| 459 if (surface->isValid()) |
| 460 return surface.release(); |
| 461 } |
| 462 |
| 456 if (shouldAccelerate(deviceSize)) { | 463 if (shouldAccelerate(deviceSize)) { |
| 457 if (document().settings()) | 464 if (document().settings()) |
| 458 *msaaSampleCount = document().settings()->accelerated2dCanvasMSAASam
pleCount(); | 465 *msaaSampleCount = document().settings()->accelerated2dCanvasMSAASam
pleCount(); |
| 459 OwnPtr<ImageBufferSurface> surface = adoptPtr(new Canvas2DImageBufferSur
face(size(), opacityMode, *msaaSampleCount)); | 466 OwnPtr<ImageBufferSurface> surface = adoptPtr(new Canvas2DImageBufferSur
face(size(), opacityMode, *msaaSampleCount)); |
| 460 if (surface->isValid()) | 467 if (surface->isValid()) |
| 461 return surface.release(); | 468 return surface.release(); |
| 462 } | 469 } |
| 463 | 470 |
| 464 return adoptPtr(new UnacceleratedImageBufferSurface(size(), opacityMode)); | 471 return adoptPtr(new UnacceleratedImageBufferSurface(size(), opacityMode)); |
| 465 } | 472 } |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 { | 713 { |
| 707 return !originClean(); | 714 return !originClean(); |
| 708 } | 715 } |
| 709 | 716 |
| 710 FloatSize HTMLCanvasElement::sourceSize() const | 717 FloatSize HTMLCanvasElement::sourceSize() const |
| 711 { | 718 { |
| 712 return FloatSize(width(), height()); | 719 return FloatSize(width(), height()); |
| 713 } | 720 } |
| 714 | 721 |
| 715 } | 722 } |
| OLD | NEW |