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 19 matching lines...) Expand all Loading... |
30 #include "public/platform/WebGraphicsContext3D.h" | 30 #include "public/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() | 38 FakeWebGraphicsContext3D() |
39 : m_nextTextureId(1) | 39 : m_nextTextureId(1) |
| 40 , m_isContextLost(false) |
40 { | 41 { |
41 } | 42 } |
42 | 43 |
43 virtual bool makeContextCurrent() { return true; } | 44 virtual bool makeContextCurrent() { return true; } |
44 | 45 |
45 virtual int width() { return 0; } | 46 virtual int width() { return 0; } |
46 virtual int height() { return 0; } | 47 virtual int height() { return 0; } |
47 | 48 |
48 virtual void reshape(int width, int height) { } | 49 virtual void reshape(int width, int height) { } |
49 | 50 |
50 virtual void prepareTexture() { } | 51 virtual void prepareTexture() { } |
51 | 52 |
52 virtual void postSubBufferCHROMIUM(int x, int y, int width, int height) { } | 53 virtual void postSubBufferCHROMIUM(int x, int y, int width, int height) { } |
53 | 54 |
54 virtual void synthesizeGLError(WGC3Denum) { } | 55 virtual void synthesizeGLError(WGC3Denum) { } |
55 | 56 |
56 virtual bool isContextLost() { return false; } | 57 virtual bool isContextLost() { return m_isContextLost; } |
57 | 58 |
58 virtual void* mapBufferSubDataCHROMIUM(WGC3Denum target, WGC3Dintptr offset,
WGC3Dsizeiptr size, WGC3Denum access) { return 0; } | 59 virtual void* mapBufferSubDataCHROMIUM(WGC3Denum target, WGC3Dintptr offset,
WGC3Dsizeiptr size, WGC3Denum access) { return 0; } |
59 virtual void unmapBufferSubDataCHROMIUM(const void*) { } | 60 virtual void unmapBufferSubDataCHROMIUM(const void*) { } |
60 virtual void* mapTexSubImage2DCHROMIUM(WGC3Denum target, WGC3Dint level, WGC
3Dint xoffset, WGC3Dint yoffset, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum
format, WGC3Denum type, WGC3Denum access) { return 0; } | 61 virtual void* mapTexSubImage2DCHROMIUM(WGC3Denum target, WGC3Dint level, WGC
3Dint xoffset, WGC3Dint yoffset, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum
format, WGC3Denum type, WGC3Denum access) { return 0; } |
61 virtual void unmapTexSubImage2DCHROMIUM(const void*) { } | 62 virtual void unmapTexSubImage2DCHROMIUM(const void*) { } |
62 | 63 |
63 virtual void setVisibilityCHROMIUM(bool visible) { } | 64 virtual void setVisibilityCHROMIUM(bool visible) { } |
64 | 65 |
65 virtual void discardFramebufferEXT(WGC3Denum target, WGC3Dsizei numAttachmen
ts, const WGC3Denum* attachments) { } | 66 virtual void discardFramebufferEXT(WGC3Denum target, WGC3Dsizei numAttachmen
ts, const WGC3Denum* attachments) { } |
66 virtual void ensureFramebufferCHROMIUM() { } | 67 virtual void ensureFramebufferCHROMIUM() { } |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 virtual void texStorage2DEXT(WGC3Denum target, WGC3Dint levels, WGC3Duint in
ternalformat, WGC3Dint width, WGC3Dint height) { } | 257 virtual void texStorage2DEXT(WGC3Denum target, WGC3Dint levels, WGC3Duint in
ternalformat, WGC3Dint width, WGC3Dint height) { } |
257 | 258 |
258 virtual WebGLId createQueryEXT() { return 1; } | 259 virtual WebGLId createQueryEXT() { return 1; } |
259 virtual void deleteQueryEXT(WebGLId) { } | 260 virtual void deleteQueryEXT(WebGLId) { } |
260 virtual GC3Dboolean isQueryEXT(WebGLId) { return true; } | 261 virtual GC3Dboolean isQueryEXT(WebGLId) { return true; } |
261 virtual void beginQueryEXT(GC3Denum, WebGLId) { } | 262 virtual void beginQueryEXT(GC3Denum, WebGLId) { } |
262 virtual void endQueryEXT(GC3Denum) { } | 263 virtual void endQueryEXT(GC3Denum) { } |
263 virtual void getQueryivEXT(GC3Denum, GC3Denum, GC3Dint*) { } | 264 virtual void getQueryivEXT(GC3Denum, GC3Denum, GC3Dint*) { } |
264 virtual void getQueryObjectuivEXT(WebGLId, GC3Denum, GC3Duint*) { } | 265 virtual void getQueryObjectuivEXT(WebGLId, GC3Denum, GC3Duint*) { } |
265 | 266 |
| 267 void fakeContextLoss() { m_isContextLost = true;} |
| 268 |
266 protected: | 269 protected: |
267 unsigned m_nextTextureId; | 270 unsigned m_nextTextureId; |
268 Attributes m_attrs; | 271 Attributes m_attrs; |
| 272 bool m_isContextLost; |
269 }; | 273 }; |
270 | 274 |
271 } // namespace WebKit | 275 } // namespace WebKit |
272 | 276 |
273 #endif // FakeWebGraphicsContext3D_h | 277 #endif // FakeWebGraphicsContext3D_h |
OLD | NEW |