Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: Source/core/html/HTMLCanvasElement.cpp

Issue 1186823007: Code cleanup in core/html/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLButtonElement.cpp ('k') | Source/core/html/HTMLDialogElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « Source/core/html/HTMLButtonElement.cpp ('k') | Source/core/html/HTMLDialogElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698