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 namespace blink { | |
9 | |
10 OffScreenCanvas* OffScreenCanvas::create(unsigned width, unsigned height) | |
11 { | |
12 if (width > INT_MAX) | |
13 width = INT_MAX; | |
14 if (height > INT_MAX) | |
15 height = INT_MAX; | |
16 return new OffScreenCanvas(IntSize(width, height)); | |
17 } | |
18 | |
19 void OffScreenCanvas::setWidth(unsigned width) | |
20 { | |
21 if (width > INT_MAX) | |
Justin Novosad
2015/12/03 17:05:55
use clampTo<int>, defined in wtf/MathExtras.h
xidachen
2015/12/03 18:41:40
Done.
| |
22 m_size.setWidth(INT_MAX); | |
23 m_size.setWidth(width); | |
24 } | |
25 | |
26 void OffScreenCanvas::setHeight(unsigned height) | |
27 { | |
28 if (height > INT_MAX) | |
29 m_size.setHeight(INT_MAX); | |
30 m_size.setHeight(height); | |
31 } | |
32 | |
33 OffScreenCanvas::OffScreenCanvas(const IntSize& size) | |
34 : m_size(size) | |
35 { | |
36 } | |
37 | |
38 DEFINE_TRACE(OffScreenCanvas) | |
39 { | |
40 } | |
41 | |
42 } // namespace blink | |
OLD | NEW |