| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2009 Apple Inc. All Rights Reserved. | |
| 3 * Copyright (C) 2009 Google Inc. All Rights Reserved. | |
| 4 * | |
| 5 * Redistribution and use in source and binary forms, with or without | |
| 6 * modification, are permitted provided that the following conditions | |
| 7 * are met: | |
| 8 * 1. Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | |
| 11 * notice, this list of conditions and the following disclaimer in the | |
| 12 * documentation and/or other materials provided with the distribution. | |
| 13 * | |
| 14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | |
| 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR | |
| 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | |
| 22 * 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 "sky/engine/config.h" | |
| 28 #include "sky/engine/core/html/canvas/WebGLGetInfo.h" | |
| 29 | |
| 30 | |
| 31 namespace blink { | |
| 32 | |
| 33 WebGLGetInfo::WebGLGetInfo(bool value) | |
| 34 : m_type(kTypeBool) | |
| 35 , m_bool(value) | |
| 36 , m_float(0) | |
| 37 , m_int(0) | |
| 38 , m_unsignedInt(0) | |
| 39 { | |
| 40 } | |
| 41 | |
| 42 WebGLGetInfo::WebGLGetInfo(const bool* value, int size) | |
| 43 : m_type(kTypeBoolArray) | |
| 44 , m_bool(false) | |
| 45 , m_float(0) | |
| 46 , m_int(0) | |
| 47 , m_unsignedInt(0) | |
| 48 { | |
| 49 if (!value || size <=0) | |
| 50 return; | |
| 51 m_boolArray.resize(size); | |
| 52 for (int ii = 0; ii < size; ++ii) | |
| 53 m_boolArray[ii] = value[ii]; | |
| 54 } | |
| 55 | |
| 56 WebGLGetInfo::WebGLGetInfo(float value) | |
| 57 : m_type(kTypeFloat) | |
| 58 , m_bool(false) | |
| 59 , m_float(value) | |
| 60 , m_int(0) | |
| 61 , m_unsignedInt(0) | |
| 62 { | |
| 63 } | |
| 64 | |
| 65 WebGLGetInfo::WebGLGetInfo(int value) | |
| 66 : m_type(kTypeInt) | |
| 67 , m_bool(false) | |
| 68 , m_float(0) | |
| 69 , m_int(value) | |
| 70 , m_unsignedInt(0) | |
| 71 { | |
| 72 } | |
| 73 | |
| 74 WebGLGetInfo::WebGLGetInfo() | |
| 75 : m_type(kTypeNull) | |
| 76 , m_bool(false) | |
| 77 , m_float(0) | |
| 78 , m_int(0) | |
| 79 , m_unsignedInt(0) | |
| 80 { | |
| 81 } | |
| 82 | |
| 83 WebGLGetInfo::WebGLGetInfo(const String& value) | |
| 84 : m_type(kTypeString) | |
| 85 , m_bool(false) | |
| 86 , m_float(0) | |
| 87 , m_int(0) | |
| 88 , m_string(value) | |
| 89 , m_unsignedInt(0) | |
| 90 { | |
| 91 } | |
| 92 | |
| 93 WebGLGetInfo::WebGLGetInfo(unsigned value) | |
| 94 : m_type(kTypeUnsignedInt) | |
| 95 , m_bool(false) | |
| 96 , m_float(0) | |
| 97 , m_int(0) | |
| 98 , m_unsignedInt(value) | |
| 99 { | |
| 100 } | |
| 101 | |
| 102 WebGLGetInfo::WebGLGetInfo(PassRefPtr<WebGLBuffer> value) | |
| 103 : m_type(kTypeWebGLBuffer) | |
| 104 , m_bool(false) | |
| 105 , m_float(0) | |
| 106 , m_int(0) | |
| 107 , m_unsignedInt(0) | |
| 108 , m_webglBuffer(value) | |
| 109 { | |
| 110 } | |
| 111 | |
| 112 WebGLGetInfo::WebGLGetInfo(PassRefPtr<Float32Array> value) | |
| 113 : m_type(kTypeWebGLFloatArray) | |
| 114 , m_bool(false) | |
| 115 , m_float(0) | |
| 116 , m_int(0) | |
| 117 , m_unsignedInt(0) | |
| 118 , m_webglFloatArray(value) | |
| 119 { | |
| 120 } | |
| 121 | |
| 122 WebGLGetInfo::WebGLGetInfo(PassRefPtr<WebGLFramebuffer> value) | |
| 123 : m_type(kTypeWebGLFramebuffer) | |
| 124 , m_bool(false) | |
| 125 , m_float(0) | |
| 126 , m_int(0) | |
| 127 , m_unsignedInt(0) | |
| 128 , m_webglFramebuffer(value) | |
| 129 { | |
| 130 } | |
| 131 | |
| 132 WebGLGetInfo::WebGLGetInfo(PassRefPtr<Int32Array> value) | |
| 133 : m_type(kTypeWebGLIntArray) | |
| 134 , m_bool(false) | |
| 135 , m_float(0) | |
| 136 , m_int(0) | |
| 137 , m_unsignedInt(0) | |
| 138 , m_webglIntArray(value) | |
| 139 { | |
| 140 } | |
| 141 | |
| 142 WebGLGetInfo::WebGLGetInfo(PassRefPtr<WebGLProgram> value) | |
| 143 : m_type(kTypeWebGLProgram) | |
| 144 , m_bool(false) | |
| 145 , m_float(0) | |
| 146 , m_int(0) | |
| 147 , m_unsignedInt(0) | |
| 148 , m_webglProgram(value) | |
| 149 { | |
| 150 } | |
| 151 | |
| 152 WebGLGetInfo::WebGLGetInfo(PassRefPtr<WebGLRenderbuffer> value) | |
| 153 : m_type(kTypeWebGLRenderbuffer) | |
| 154 , m_bool(false) | |
| 155 , m_float(0) | |
| 156 , m_int(0) | |
| 157 , m_unsignedInt(0) | |
| 158 , m_webglRenderbuffer(value) | |
| 159 { | |
| 160 } | |
| 161 | |
| 162 WebGLGetInfo::WebGLGetInfo(PassRefPtr<WebGLTexture> value) | |
| 163 : m_type(kTypeWebGLTexture) | |
| 164 , m_bool(false) | |
| 165 , m_float(0) | |
| 166 , m_int(0) | |
| 167 , m_unsignedInt(0) | |
| 168 , m_webglTexture(value) | |
| 169 { | |
| 170 } | |
| 171 | |
| 172 WebGLGetInfo::WebGLGetInfo(PassRefPtr<Uint8Array> value) | |
| 173 : m_type(kTypeWebGLUnsignedByteArray) | |
| 174 , m_bool(false) | |
| 175 , m_float(0) | |
| 176 , m_int(0) | |
| 177 , m_unsignedInt(0) | |
| 178 , m_webglUnsignedByteArray(value) | |
| 179 { | |
| 180 } | |
| 181 | |
| 182 WebGLGetInfo::WebGLGetInfo(PassRefPtr<Uint32Array> value) | |
| 183 : m_type(kTypeWebGLUnsignedIntArray) | |
| 184 , m_bool(false) | |
| 185 , m_float(0) | |
| 186 , m_int(0) | |
| 187 , m_unsignedInt(0) | |
| 188 , m_webglUnsignedIntArray(value) | |
| 189 { | |
| 190 } | |
| 191 | |
| 192 WebGLGetInfo::WebGLGetInfo(PassRefPtr<WebGLVertexArrayObjectOES> value) | |
| 193 : m_type(kTypeWebGLVertexArrayObjectOES) | |
| 194 , m_bool(false) | |
| 195 , m_float(0) | |
| 196 , m_int(0) | |
| 197 , m_unsignedInt(0) | |
| 198 , m_webglVertexArrayObject(value) | |
| 199 { | |
| 200 } | |
| 201 | |
| 202 WebGLGetInfo::Type WebGLGetInfo::getType() const | |
| 203 { | |
| 204 return m_type; | |
| 205 } | |
| 206 | |
| 207 bool WebGLGetInfo::getBool() const | |
| 208 { | |
| 209 ASSERT(getType() == kTypeBool); | |
| 210 return m_bool; | |
| 211 } | |
| 212 | |
| 213 const Vector<bool>& WebGLGetInfo::getBoolArray() const | |
| 214 { | |
| 215 ASSERT(getType() == kTypeBoolArray); | |
| 216 return m_boolArray; | |
| 217 } | |
| 218 | |
| 219 float WebGLGetInfo::getFloat() const | |
| 220 { | |
| 221 ASSERT(getType() == kTypeFloat); | |
| 222 return m_float; | |
| 223 } | |
| 224 | |
| 225 int WebGLGetInfo::getInt() const | |
| 226 { | |
| 227 ASSERT(getType() == kTypeInt); | |
| 228 return m_int; | |
| 229 } | |
| 230 | |
| 231 const String& WebGLGetInfo::getString() const | |
| 232 { | |
| 233 ASSERT(getType() == kTypeString); | |
| 234 return m_string; | |
| 235 } | |
| 236 | |
| 237 unsigned WebGLGetInfo::getUnsignedInt() const | |
| 238 { | |
| 239 ASSERT(getType() == kTypeUnsignedInt); | |
| 240 return m_unsignedInt; | |
| 241 } | |
| 242 | |
| 243 PassRefPtr<WebGLBuffer> WebGLGetInfo::getWebGLBuffer() const | |
| 244 { | |
| 245 ASSERT(getType() == kTypeWebGLBuffer); | |
| 246 return m_webglBuffer; | |
| 247 } | |
| 248 | |
| 249 PassRefPtr<Float32Array> WebGLGetInfo::getWebGLFloatArray() const | |
| 250 { | |
| 251 ASSERT(getType() == kTypeWebGLFloatArray); | |
| 252 return m_webglFloatArray; | |
| 253 } | |
| 254 | |
| 255 PassRefPtr<WebGLFramebuffer> WebGLGetInfo::getWebGLFramebuffer() const | |
| 256 { | |
| 257 ASSERT(getType() == kTypeWebGLFramebuffer); | |
| 258 return m_webglFramebuffer; | |
| 259 } | |
| 260 | |
| 261 PassRefPtr<Int32Array> WebGLGetInfo::getWebGLIntArray() const | |
| 262 { | |
| 263 ASSERT(getType() == kTypeWebGLIntArray); | |
| 264 return m_webglIntArray; | |
| 265 } | |
| 266 | |
| 267 PassRefPtr<WebGLProgram> WebGLGetInfo::getWebGLProgram() const | |
| 268 { | |
| 269 ASSERT(getType() == kTypeWebGLProgram); | |
| 270 return m_webglProgram; | |
| 271 } | |
| 272 | |
| 273 PassRefPtr<WebGLRenderbuffer> WebGLGetInfo::getWebGLRenderbuffer() const | |
| 274 { | |
| 275 ASSERT(getType() == kTypeWebGLRenderbuffer); | |
| 276 return m_webglRenderbuffer; | |
| 277 } | |
| 278 | |
| 279 PassRefPtr<WebGLTexture> WebGLGetInfo::getWebGLTexture() const | |
| 280 { | |
| 281 ASSERT(getType() == kTypeWebGLTexture); | |
| 282 return m_webglTexture; | |
| 283 } | |
| 284 | |
| 285 PassRefPtr<Uint8Array> WebGLGetInfo::getWebGLUnsignedByteArray() const | |
| 286 { | |
| 287 ASSERT(getType() == kTypeWebGLUnsignedByteArray); | |
| 288 return m_webglUnsignedByteArray; | |
| 289 } | |
| 290 | |
| 291 PassRefPtr<Uint32Array> WebGLGetInfo::getWebGLUnsignedIntArray() const | |
| 292 { | |
| 293 ASSERT(getType() == kTypeWebGLUnsignedIntArray); | |
| 294 return m_webglUnsignedIntArray; | |
| 295 } | |
| 296 | |
| 297 PassRefPtr<WebGLVertexArrayObjectOES> WebGLGetInfo::getWebGLVertexArrayObjectOES
() const | |
| 298 { | |
| 299 ASSERT(getType() == kTypeWebGLVertexArrayObjectOES); | |
| 300 return m_webglVertexArrayObject; | |
| 301 } | |
| 302 | |
| 303 } // namespace blink | |
| OLD | NEW |