OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "config.h" | |
6 #include "core/html/canvas/OffScreenCanvas.h" | |
7 | |
8 #include "wtf/MathExtras.h" | |
9 | |
10 namespace blink { | |
11 | |
12 OffScreenCanvas* OffScreenCanvas::create(unsigned width, unsigned height) | |
13 { | |
14 if (width > INT_MAX) | |
Justin Novosad
2015/12/03 19:06:11
This condition is not necessary. it is implied in
xidachen
2015/12/03 20:42:22
Done.
| |
15 width = clampTo<int>(width); | |
16 if (height > INT_MAX) | |
17 height = clampTo<int>(height); | |
18 return new OffScreenCanvas(IntSize(width, height)); | |
19 } | |
20 | |
21 void OffScreenCanvas::setWidth(unsigned width) | |
22 { | |
23 if (width > INT_MAX) | |
24 m_size.setWidth(clampTo<int>(width)); | |
25 else | |
26 m_size.setWidth(width); | |
27 } | |
28 | |
29 void OffScreenCanvas::setHeight(unsigned height) | |
30 { | |
31 if (height > INT_MAX) | |
32 m_size.setHeight(clampTo<int>(height)); | |
33 else | |
34 m_size.setHeight(height); | |
35 } | |
36 | |
37 OffScreenCanvas::OffScreenCanvas(const IntSize& size) | |
38 : m_size(size) | |
39 { | |
40 } | |
41 | |
42 DEFINE_TRACE(OffScreenCanvas) | |
43 { | |
44 } | |
45 | |
46 } // namespace blink | |
OLD | NEW |