| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CC_TEST_FAKE_WEB_GRAPHICS_CONTEXT_3D_H_ | 5 #ifndef CC_TEST_FAKE_WEB_GRAPHICS_CONTEXT_3D_H_ |
| 6 #define CC_TEST_FAKE_WEB_GRAPHICS_CONTEXT_3D_H_ | 6 #define CC_TEST_FAKE_WEB_GRAPHICS_CONTEXT_3D_H_ |
| 7 | 7 |
| 8 #include "third_party/khronos/GLES2/gl2.h" | 8 #include "third_party/khronos/GLES2/gl2.h" |
| 9 #include <public/WebGraphicsContext3D.h> | 9 #include <public/WebGraphicsContext3D.h> |
| 10 | 10 |
| 11 namespace cc { | 11 namespace cc { |
| 12 | 12 |
| 13 // WebGraphicsContext3D base class for use in WebKit unit tests. | 13 // WebGraphicsContext3D base class for use in WebKit unit tests. |
| 14 // All operations are no-ops (returning 0 if necessary). | 14 // All operations are no-ops (returning 0 if necessary). |
| 15 class FakeWebGraphicsContext3D : public WebKit::WebGraphicsContext3D { | 15 class FakeWebGraphicsContext3D : public WebKit::WebGraphicsContext3D { |
| 16 public: | 16 public: |
| 17 FakeWebGraphicsContext3D() | 17 FakeWebGraphicsContext3D() |
| 18 : m_nextTextureId(1) | 18 : m_nextTextureId(1) |
| 19 , m_contextLost(false) |
| 20 , m_contextLostCallback(NULL) |
| 19 { | 21 { |
| 20 } | 22 } |
| 21 | 23 |
| 22 virtual bool makeContextCurrent(); | 24 virtual bool makeContextCurrent(); |
| 23 | 25 |
| 24 virtual int width(); | 26 virtual int width(); |
| 25 virtual int height(); | 27 virtual int height(); |
| 26 | 28 |
| 27 virtual void reshape(int width, int height) { } | 29 virtual void reshape(int width, int height) { } |
| 28 | 30 |
| 29 virtual bool isGLES2Compliant(); | 31 virtual bool isGLES2Compliant(); |
| 30 | 32 |
| 31 virtual bool readBackFramebuffer(unsigned char* pixels, size_t bufferSize, W
ebKit::WebGLId framebuffer, int width, int height); | 33 virtual bool readBackFramebuffer(unsigned char* pixels, size_t bufferSize, W
ebKit::WebGLId framebuffer, int width, int height); |
| 32 | 34 |
| 33 virtual WebKit::WebGLId getPlatformTextureId(); | 35 virtual WebKit::WebGLId getPlatformTextureId(); |
| 34 | 36 |
| 35 virtual void prepareTexture() { } | 37 virtual void prepareTexture() { } |
| 36 | 38 |
| 37 virtual void postSubBufferCHROMIUM(int x, int y, int width, int height) { } | 39 virtual void postSubBufferCHROMIUM(int x, int y, int width, int height) { } |
| 38 | 40 |
| 39 virtual void synthesizeGLError(WebKit::WGC3Denum) { } | 41 virtual void synthesizeGLError(WebKit::WGC3Denum) { } |
| 40 | 42 |
| 41 virtual bool isContextLost(); | 43 virtual bool isContextLost(); |
| 44 virtual WebKit::WGC3Denum getGraphicsResetStatusARB(); |
| 42 | 45 |
| 43 virtual void* mapBufferSubDataCHROMIUM(WebKit::WGC3Denum target, WebKit::WGC
3Dintptr offset, WebKit::WGC3Dsizeiptr size, WebKit::WGC3Denum access); | 46 virtual void* mapBufferSubDataCHROMIUM(WebKit::WGC3Denum target, WebKit::WGC
3Dintptr offset, WebKit::WGC3Dsizeiptr size, WebKit::WGC3Denum access); |
| 44 | 47 |
| 45 virtual void unmapBufferSubDataCHROMIUM(const void*) { } | 48 virtual void unmapBufferSubDataCHROMIUM(const void*) { } |
| 46 virtual void* mapTexSubImage2DCHROMIUM(WebKit::WGC3Denum target, WebKit::WGC
3Dint level, WebKit::WGC3Dint xoffset, WebKit::WGC3Dint yoffset, WebKit::WGC3Dsi
zei width, WebKit::WGC3Dsizei height, WebKit::WGC3Denum format, WebKit::WGC3Denu
m type, WebKit::WGC3Denum access); | 49 virtual void* mapTexSubImage2DCHROMIUM(WebKit::WGC3Denum target, WebKit::WGC
3Dint level, WebKit::WGC3Dint xoffset, WebKit::WGC3Dint yoffset, WebKit::WGC3Dsi
zei width, WebKit::WGC3Dsizei height, WebKit::WGC3Denum format, WebKit::WGC3Denu
m type, WebKit::WGC3Denum access); |
| 47 virtual void unmapTexSubImage2DCHROMIUM(const void*) { } | 50 virtual void unmapTexSubImage2DCHROMIUM(const void*) { } |
| 48 | 51 |
| 49 virtual void setVisibilityCHROMIUM(bool visible) { } | 52 virtual void setVisibilityCHROMIUM(bool visible) { } |
| 50 | 53 |
| 51 virtual void discardFramebufferEXT(WebKit::WGC3Denum target, WebKit::WGC3Dsi
zei numAttachments, const WebKit::WGC3Denum* attachments) { } | 54 virtual void discardFramebufferEXT(WebKit::WGC3Denum target, WebKit::WGC3Dsi
zei numAttachments, const WebKit::WGC3Denum* attachments) { } |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 WebKit::WGC3Dint width, WebKit::WGC3Dint height
) { } | 232 WebKit::WGC3Dint width, WebKit::WGC3Dint height
) { } |
| 230 | 233 |
| 231 virtual WebKit::WebGLId createQueryEXT(); | 234 virtual WebKit::WebGLId createQueryEXT(); |
| 232 virtual void deleteQueryEXT(WebKit::WebGLId) { } | 235 virtual void deleteQueryEXT(WebKit::WebGLId) { } |
| 233 virtual WebKit::WGC3Dboolean isQueryEXT(WebKit::WebGLId); | 236 virtual WebKit::WGC3Dboolean isQueryEXT(WebKit::WebGLId); |
| 234 virtual void beginQueryEXT(WebKit::WGC3Denum, WebKit::WebGLId) { } | 237 virtual void beginQueryEXT(WebKit::WGC3Denum, WebKit::WebGLId) { } |
| 235 virtual void endQueryEXT(WebKit::WGC3Denum) { } | 238 virtual void endQueryEXT(WebKit::WGC3Denum) { } |
| 236 virtual void getQueryivEXT(WebKit::WGC3Denum, WebKit::WGC3Denum, WebKit::WGC
3Dint*) { } | 239 virtual void getQueryivEXT(WebKit::WGC3Denum, WebKit::WGC3Denum, WebKit::WGC
3Dint*) { } |
| 237 virtual void getQueryObjectuivEXT(WebKit::WebGLId, WebKit::WGC3Denum, WebKit
::WGC3Duint*) { } | 240 virtual void getQueryObjectuivEXT(WebKit::WebGLId, WebKit::WGC3Denum, WebKit
::WGC3Duint*) { } |
| 238 | 241 |
| 242 virtual void setContextLostCallback(WebGraphicsContextLostCallback* callback
); |
| 243 |
| 244 void loseContext(); |
| 245 |
| 239 protected: | 246 protected: |
| 240 unsigned m_nextTextureId; | 247 unsigned m_nextTextureId; |
| 241 Attributes m_attrs; | 248 Attributes m_attrs; |
| 249 bool m_contextLost; |
| 250 WebGraphicsContextLostCallback* m_contextLostCallback; |
| 242 }; | 251 }; |
| 243 | 252 |
| 244 } // namespace cc | 253 } // namespace cc |
| 245 | 254 |
| 246 #endif // CC_TEST_FAKE_WEB_GRAPHICS_CONTEXT_3D_H_ | 255 #endif // CC_TEST_FAKE_WEB_GRAPHICS_CONTEXT_3D_H_ |
| OLD | NEW |