| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 // These values come from the WhatWG spec. | 71 // These values come from the WhatWG spec. |
| 72 const int DefaultWidth = 300; | 72 const int DefaultWidth = 300; |
| 73 const int DefaultHeight = 150; | 73 const int DefaultHeight = 150; |
| 74 | 74 |
| 75 // Firefox limits width/height to 32767 pixels, but slows down dramatically befo
re it | 75 // Firefox limits width/height to 32767 pixels, but slows down dramatically befo
re it |
| 76 // reaches that limit. We limit by area instead, giving us larger maximum dimens
ions, | 76 // reaches that limit. We limit by area instead, giving us larger maximum dimens
ions, |
| 77 // in exchange for a smaller maximum canvas size. | 77 // in exchange for a smaller maximum canvas size. |
| 78 const int MaxCanvasArea = 32768 * 8192; // Maximum canvas area in CSS pixels | 78 const int MaxCanvasArea = 32768 * 8192; // Maximum canvas area in CSS pixels |
| 79 | 79 |
| 80 //In Skia, we will also limit width/height to 32767. | 80 // In Skia, we will also limit width/height to 32767. |
| 81 const int MaxSkiaDim = 32767; // Maximum width/height in CSS pixels. | 81 const int MaxSkiaDim = 32767; // Maximum width/height in CSS pixels. |
| 82 | 82 |
| 83 bool canCreateImageBuffer(const IntSize& size) | 83 bool canCreateImageBuffer(const IntSize& size) |
| 84 { | 84 { |
| 85 if (size.isEmpty()) | 85 if (size.isEmpty()) |
| 86 return false; | 86 return false; |
| 87 if (size.width() * size.height() > MaxCanvasArea) | 87 if (size.width() * size.height() > MaxCanvasArea) |
| 88 return false; | 88 return false; |
| 89 if (size.width() > MaxSkiaDim || size.height() > MaxSkiaDim) | 89 if (size.width() > MaxSkiaDim || size.height() > MaxSkiaDim) |
| 90 return false; | 90 return false; |
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 { | 877 { |
| 878 return FloatSize(width(), height()); | 878 return FloatSize(width(), height()); |
| 879 } | 879 } |
| 880 | 880 |
| 881 bool HTMLCanvasElement::isOpaque() const | 881 bool HTMLCanvasElement::isOpaque() const |
| 882 { | 882 { |
| 883 return m_context && !m_context->hasAlpha(); | 883 return m_context && !m_context->hasAlpha(); |
| 884 } | 884 } |
| 885 | 885 |
| 886 } // blink | 886 } // blink |
| OLD | NEW |