OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 #include "GraphicsContext3D.h" | 29 #include "GraphicsContext3D.h" |
30 #include "platform/WebGraphicsContext3D.h" | 30 #include "platform/WebGraphicsContext3D.h" |
31 | 31 |
32 namespace WebKit { | 32 namespace WebKit { |
33 | 33 |
34 // WebGraphicsContext3D base class for use in WebKit unit tests. | 34 // WebGraphicsContext3D base class for use in WebKit unit tests. |
35 // All operations are no-ops (returning 0 if necessary). | 35 // All operations are no-ops (returning 0 if necessary). |
36 class FakeWebGraphicsContext3D : public WebGraphicsContext3D { | 36 class FakeWebGraphicsContext3D : public WebGraphicsContext3D { |
37 public: | 37 public: |
| 38 FakeWebGraphicsContext3D() |
| 39 : m_nextTextureId(1) |
| 40 { |
| 41 } |
| 42 |
38 virtual bool makeContextCurrent() { return true; } | 43 virtual bool makeContextCurrent() { return true; } |
39 | 44 |
40 virtual int width() { return 0; } | 45 virtual int width() { return 0; } |
41 virtual int height() { return 0; } | 46 virtual int height() { return 0; } |
42 | 47 |
43 virtual void reshape(int width, int height) { } | 48 virtual void reshape(int width, int height) { } |
44 | 49 |
45 virtual bool isGLES2Compliant() { return false; } | 50 virtual bool isGLES2Compliant() { return false; } |
46 | 51 |
47 virtual bool readBackFramebuffer(unsigned char* pixels, size_t bufferSize, W
ebGLId framebuffer, int width, int height) { return false; } | 52 virtual bool readBackFramebuffer(unsigned char* pixels, size_t bufferSize, W
ebGLId framebuffer, int width, int height) { return false; } |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 virtual void vertexAttribPointer(WGC3Duint index, WGC3Dint size, WGC3Denum t
ype, WGC3Dboolean normalized, | 244 virtual void vertexAttribPointer(WGC3Duint index, WGC3Dint size, WGC3Denum t
ype, WGC3Dboolean normalized, |
240 WGC3Dsizei stride, WGC3Dintptr offset) { } | 245 WGC3Dsizei stride, WGC3Dintptr offset) { } |
241 | 246 |
242 virtual void viewport(WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei h
eight) { } | 247 virtual void viewport(WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei h
eight) { } |
243 | 248 |
244 virtual WebGLId createBuffer() { return 1; } | 249 virtual WebGLId createBuffer() { return 1; } |
245 virtual WebGLId createFramebuffer() { return 1; } | 250 virtual WebGLId createFramebuffer() { return 1; } |
246 virtual WebGLId createProgram() { return 1; } | 251 virtual WebGLId createProgram() { return 1; } |
247 virtual WebGLId createRenderbuffer() { return 1; } | 252 virtual WebGLId createRenderbuffer() { return 1; } |
248 virtual WebGLId createShader(WGC3Denum) { return 1; } | 253 virtual WebGLId createShader(WGC3Denum) { return 1; } |
249 virtual WebGLId createTexture() { return 1; } | 254 virtual WebGLId createTexture() { return m_nextTextureId++; } |
250 | 255 |
251 virtual void deleteBuffer(WebGLId) { } | 256 virtual void deleteBuffer(WebGLId) { } |
252 virtual void deleteFramebuffer(WebGLId) { } | 257 virtual void deleteFramebuffer(WebGLId) { } |
253 virtual void deleteProgram(WebGLId) { } | 258 virtual void deleteProgram(WebGLId) { } |
254 virtual void deleteRenderbuffer(WebGLId) { } | 259 virtual void deleteRenderbuffer(WebGLId) { } |
255 virtual void deleteShader(WebGLId) { } | 260 virtual void deleteShader(WebGLId) { } |
256 virtual void deleteTexture(WebGLId) { } | 261 virtual void deleteTexture(WebGLId) { } |
257 | 262 |
258 virtual void texStorage2DEXT(WGC3Denum target, WGC3Dint levels, WGC3Duint in
ternalformat, | 263 virtual void texStorage2DEXT(WGC3Denum target, WGC3Dint levels, WGC3Duint in
ternalformat, |
259 WGC3Dint width, WGC3Dint height) { } | 264 WGC3Dint width, WGC3Dint height) { } |
260 | 265 |
261 virtual WebGLId createQueryEXT() { return 1; } | 266 virtual WebGLId createQueryEXT() { return 1; } |
262 virtual void deleteQueryEXT(WebGLId) { } | 267 virtual void deleteQueryEXT(WebGLId) { } |
263 virtual GC3Dboolean isQueryEXT(WebGLId) { return true; } | 268 virtual GC3Dboolean isQueryEXT(WebGLId) { return true; } |
264 virtual void beginQueryEXT(GC3Denum, WebGLId) { } | 269 virtual void beginQueryEXT(GC3Denum, WebGLId) { } |
265 virtual void endQueryEXT(GC3Denum) { } | 270 virtual void endQueryEXT(GC3Denum) { } |
266 virtual void getQueryivEXT(GC3Denum, GC3Denum, GC3Dint*) { } | 271 virtual void getQueryivEXT(GC3Denum, GC3Denum, GC3Dint*) { } |
267 virtual void getQueryObjectuivEXT(WebGLId, GC3Denum, GC3Duint*) { } | 272 virtual void getQueryObjectuivEXT(WebGLId, GC3Denum, GC3Duint*) { } |
268 | 273 |
269 protected: | 274 protected: |
| 275 unsigned m_nextTextureId; |
270 Attributes m_attrs; | 276 Attributes m_attrs; |
271 }; | 277 }; |
272 | 278 |
273 } // namespace WebKit | 279 } // namespace WebKit |
274 | 280 |
275 #endif // FakeWebGraphicsContext3D_h | 281 #endif // FakeWebGraphicsContext3D_h |
OLD | NEW |