OLD | NEW |
| (Empty) |
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 #ifndef WebGLContextAttributes_h | |
28 #define WebGLContextAttributes_h | |
29 | |
30 #include "bindings/core/v8/ScriptWrappable.h" | |
31 #include "core/html/canvas/CanvasContextAttributes.h" | |
32 #include "public/platform/WebGraphicsContext3D.h" | |
33 #include "wtf/PassRefPtr.h" | |
34 | |
35 namespace blink { | |
36 | |
37 class Settings; | |
38 | |
39 class WebGLContextAttributes final : public CanvasContextAttributes, public Scri
ptWrappable { | |
40 DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(WebGLContextAttributes); | |
41 DEFINE_WRAPPERTYPEINFO(); | |
42 public: | |
43 // Create a new attributes object | |
44 static PassRefPtrWillBeRawPtr<WebGLContextAttributes> create(); | |
45 | |
46 // Create a copy of this object. | |
47 PassRefPtrWillBeRawPtr<WebGLContextAttributes> clone() const; | |
48 | |
49 // Whether or not the drawing buffer has an alpha channel; default=true | |
50 bool alpha() const; | |
51 void setAlpha(bool); | |
52 | |
53 // Whether or not the drawing buffer has a depth buffer; default=true | |
54 bool depth() const; | |
55 void setDepth(bool); | |
56 | |
57 // Whether or not the drawing buffer has a stencil buffer; default=false | |
58 bool stencil() const; | |
59 void setStencil(bool); | |
60 | |
61 // Whether or not the drawing buffer is antialiased; default=true | |
62 bool antialias() const; | |
63 void setAntialias(bool); | |
64 | |
65 // Whether or not to treat the values in the drawing buffer as | |
66 // though their alpha channel has already been multiplied into the | |
67 // color channels; default=true | |
68 bool premultipliedAlpha() const; | |
69 void setPremultipliedAlpha(bool); | |
70 | |
71 // Whether or not to preserve the drawing buffer after presentation to the | |
72 // screen; default=false | |
73 bool preserveDrawingBuffer() const; | |
74 void setPreserveDrawingBuffer(bool); | |
75 | |
76 // Whether or not to fail context creation if performance will be | |
77 // significantly degraded compared to a native GL context; default=false | |
78 bool failIfMajorPerformanceCaveat() const; | |
79 void setFailIfMajorPerformanceCaveat(bool); | |
80 | |
81 // Set up the attributes that can be used to initialize a WebGraphicsContext
3D. | |
82 // It's mostly based on WebGLContextAttributes, but would be adjusted based | |
83 // on settings. | |
84 blink::WebGraphicsContext3D::Attributes attributes(const blink::WebString&,
Settings*, unsigned webGLVersion) const; | |
85 | |
86 protected: | |
87 WebGLContextAttributes(); | |
88 WebGLContextAttributes(const WebGLContextAttributes&); | |
89 | |
90 private: | |
91 bool m_alpha; | |
92 bool m_depth; | |
93 bool m_stencil; | |
94 bool m_antialias; | |
95 bool m_premultipliedAlpha; | |
96 bool m_preserveDrawingBuffer; | |
97 bool m_failIfMajorPerformanceCaveat; | |
98 }; | |
99 | |
100 } // namespace blink | |
101 | |
102 #endif // WebGLContextAttributes_h | |
OLD | NEW |