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 25 matching lines...) Expand all Loading... |
36 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
37 #include "core/dom/ExceptionCode.h" | 37 #include "core/dom/ExceptionCode.h" |
38 #include "core/frame/LocalFrame.h" | 38 #include "core/frame/LocalFrame.h" |
39 #include "core/frame/Settings.h" | 39 #include "core/frame/Settings.h" |
40 #include "core/html/ImageData.h" | 40 #include "core/html/ImageData.h" |
41 #include "core/html/canvas/Canvas2DContextAttributes.h" | 41 #include "core/html/canvas/Canvas2DContextAttributes.h" |
42 #include "core/html/canvas/CanvasRenderingContext2D.h" | 42 #include "core/html/canvas/CanvasRenderingContext2D.h" |
43 #include "core/html/canvas/WebGLContextAttributes.h" | 43 #include "core/html/canvas/WebGLContextAttributes.h" |
44 #include "core/html/canvas/WebGLContextEvent.h" | 44 #include "core/html/canvas/WebGLContextEvent.h" |
45 #include "core/html/canvas/WebGLRenderingContext.h" | 45 #include "core/html/canvas/WebGLRenderingContext.h" |
| 46 #include "core/page/ChromeClient.h" |
46 #include "core/rendering/RenderHTMLCanvas.h" | 47 #include "core/rendering/RenderHTMLCanvas.h" |
47 #include "platform/MIMETypeRegistry.h" | 48 #include "platform/MIMETypeRegistry.h" |
48 #include "platform/graphics/Canvas2DImageBufferSurface.h" | 49 #include "platform/graphics/Canvas2DImageBufferSurface.h" |
49 #include "platform/graphics/GraphicsContextStateSaver.h" | 50 #include "platform/graphics/GraphicsContextStateSaver.h" |
50 #include "platform/graphics/ImageBuffer.h" | 51 #include "platform/graphics/ImageBuffer.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> |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 if (m_context && !m_context->is2d()) | 425 if (m_context && !m_context->is2d()) |
425 return false; | 426 return false; |
426 | 427 |
427 if (m_accelerationDisabled) | 428 if (m_accelerationDisabled) |
428 return false; | 429 return false; |
429 | 430 |
430 Settings* settings = document().settings(); | 431 Settings* settings = document().settings(); |
431 if (!settings || !settings->accelerated2dCanvasEnabled()) | 432 if (!settings || !settings->accelerated2dCanvasEnabled()) |
432 return false; | 433 return false; |
433 | 434 |
434 // Do not use acceleration for small canvas. | 435 // Do not use acceleration for small canvases, unless GPU rasterization is a
vailable. |
435 if (size.width() * size.height() < settings->minimumAccelerated2dCanvasSize(
)) | 436 // GPU raterization is a heuristic to avoid difficult content & whitelist ta
rgeted content. |
| 437 if (!document().frame()->chromeClient().usesGpuRasterization() && size.width
() * size.height() < settings->minimumAccelerated2dCanvasSize()) |
436 return false; | 438 return false; |
437 | 439 |
438 if (!blink::Platform::current()->canAccelerate2dCanvas()) | 440 if (!blink::Platform::current()->canAccelerate2dCanvas()) |
439 return false; | 441 return false; |
440 | 442 |
441 return true; | 443 return true; |
442 } | 444 } |
443 | 445 |
444 PassOwnPtr<ImageBufferSurface> HTMLCanvasElement::createImageBufferSurface(const
IntSize& deviceSize, int* msaaSampleCount) | 446 PassOwnPtr<ImageBufferSurface> HTMLCanvasElement::createImageBufferSurface(const
IntSize& deviceSize, int* msaaSampleCount) |
445 { | 447 { |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 { | 698 { |
697 return !originClean(); | 699 return !originClean(); |
698 } | 700 } |
699 | 701 |
700 FloatSize HTMLCanvasElement::sourceSize() const | 702 FloatSize HTMLCanvasElement::sourceSize() const |
701 { | 703 { |
702 return FloatSize(width(), height()); | 704 return FloatSize(width(), height()); |
703 } | 705 } |
704 | 706 |
705 } | 707 } |
OLD | NEW |