• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2010, Google Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *     * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  *     * Redistributions in binary form must reproduce the above
10  * copyright notice, this list of conditions and the following disclaimer
11  * in the documentation and/or other materials provided with the
12  * distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
18  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
20  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  */
26 
27 #include "config.h"
28 
29 #if ENABLE(3D_CANVAS)
30 
31 #include "WebGLContextAttributes.h"
32 
33 namespace WebCore {
34 
create()35 PassRefPtr<WebGLContextAttributes> WebGLContextAttributes::create()
36 {
37     return adoptRef(new WebGLContextAttributes());
38 }
39 
create(GraphicsContext3D::Attributes attributes)40 PassRefPtr<WebGLContextAttributes> WebGLContextAttributes::create(GraphicsContext3D::Attributes attributes)
41 {
42     return adoptRef(new WebGLContextAttributes(attributes));
43 }
44 
WebGLContextAttributes()45 WebGLContextAttributes::WebGLContextAttributes()
46     : CanvasContextAttributes()
47 {
48 }
49 
WebGLContextAttributes(GraphicsContext3D::Attributes attributes)50 WebGLContextAttributes::WebGLContextAttributes(GraphicsContext3D::Attributes attributes)
51     : CanvasContextAttributes()
52     , m_attrs(attributes)
53 {
54 }
55 
~WebGLContextAttributes()56 WebGLContextAttributes::~WebGLContextAttributes()
57 {
58 }
59 
alpha() const60 bool WebGLContextAttributes::alpha() const
61 {
62     return m_attrs.alpha;
63 }
64 
setAlpha(bool alpha)65 void WebGLContextAttributes::setAlpha(bool alpha)
66 {
67     m_attrs.alpha = alpha;
68 }
69 
depth() const70 bool WebGLContextAttributes::depth() const
71 {
72     return m_attrs.depth;
73 }
74 
setDepth(bool depth)75 void WebGLContextAttributes::setDepth(bool depth)
76 {
77     m_attrs.depth = depth;
78 }
79 
stencil() const80 bool WebGLContextAttributes::stencil() const
81 {
82     return m_attrs.stencil;
83 }
84 
setStencil(bool stencil)85 void WebGLContextAttributes::setStencil(bool stencil)
86 {
87     m_attrs.stencil = stencil;
88 }
89 
antialias() const90 bool WebGLContextAttributes::antialias() const
91 {
92     return m_attrs.antialias;
93 }
94 
setAntialias(bool antialias)95 void WebGLContextAttributes::setAntialias(bool antialias)
96 {
97     m_attrs.antialias = antialias;
98 }
99 
premultipliedAlpha() const100 bool WebGLContextAttributes::premultipliedAlpha() const
101 {
102     return m_attrs.premultipliedAlpha;
103 }
104 
setPremultipliedAlpha(bool premultipliedAlpha)105 void WebGLContextAttributes::setPremultipliedAlpha(bool premultipliedAlpha)
106 {
107     m_attrs.premultipliedAlpha = premultipliedAlpha;
108 }
109 
attributes() const110 GraphicsContext3D::Attributes WebGLContextAttributes::attributes() const
111 {
112     return m_attrs;
113 }
114 
115 } // namespace WebCore
116 
117 #endif // ENABLE(3D_CANVAS)
118