Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 #include "core/html/canvas/WebGLContextObject.h" | 30 #include "core/html/canvas/WebGLContextObject.h" |
| 31 #include "core/html/canvas/WebGLSharedObject.h" | 31 #include "core/html/canvas/WebGLSharedObject.h" |
| 32 #include "wtf/PassRefPtr.h" | 32 #include "wtf/PassRefPtr.h" |
| 33 #include "wtf/RefCounted.h" | 33 #include "wtf/RefCounted.h" |
| 34 | 34 |
| 35 namespace WebCore { | 35 namespace WebCore { |
| 36 | 36 |
| 37 class WebGLRenderbuffer; | 37 class WebGLRenderbuffer; |
| 38 class WebGLTexture; | 38 class WebGLTexture; |
| 39 | 39 |
| 40 class WebGLFramebuffer : public WebGLContextObject, public ScriptWrappable { | 40 class WebGLFramebuffer FINAL : public WebGLContextObject, public ScriptWrappable { |
| 41 public: | 41 public: |
| 42 class WebGLAttachment : public RefCounted<WebGLAttachment> { | 42 class WebGLAttachment : public RefCounted<WebGLAttachment> { |
| 43 public: | 43 public: |
| 44 virtual ~WebGLAttachment(); | 44 virtual ~WebGLAttachment(); |
| 45 | 45 |
| 46 virtual GLsizei width() const = 0; | 46 virtual GLsizei width() const = 0; |
| 47 virtual GLsizei height() const = 0; | 47 virtual GLsizei height() const = 0; |
| 48 virtual GLenum format() const = 0; | 48 virtual GLenum format() const = 0; |
| 49 // For texture attachment, type() returns the type of the attached textu re. | 49 // For texture attachment, type() returns the type of the attached textu re. |
| 50 // For renderbuffer attachment, the type of the renderbuffer may vary wi th GL implementation. | 50 // For renderbuffer attachment, the type of the renderbuffer may vary wi th GL implementation. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 bool hasStencilBuffer() const; | 101 bool hasStencilBuffer() const; |
| 102 | 102 |
| 103 // Wrapper for drawBuffersEXT/drawBuffersARB to work around a driver bug. | 103 // Wrapper for drawBuffersEXT/drawBuffersARB to work around a driver bug. |
| 104 void drawBuffers(const Vector<GLenum>& bufs); | 104 void drawBuffers(const Vector<GLenum>& bufs); |
| 105 | 105 |
| 106 GLenum getDrawBuffer(GLenum); | 106 GLenum getDrawBuffer(GLenum); |
| 107 | 107 |
| 108 protected: | 108 protected: |
| 109 WebGLFramebuffer(WebGLRenderingContext*); | 109 WebGLFramebuffer(WebGLRenderingContext*); |
| 110 | 110 |
| 111 virtual void deleteObjectImpl(GraphicsContext3D*, Platform3DObject); | 111 virtual void deleteObjectImpl(GraphicsContext3D*, Platform3DObject) OVERRIDE ; |
| 112 | 112 |
| 113 private: | 113 private: |
| 114 virtual bool isFramebuffer() const { return true; } | |
|
eseidel
2014/01/10 19:11:22
Dead code?
Inactive
2014/01/10 19:18:26
Yes, it does not override anything and it is never
| |
| 115 | |
| 116 WebGLAttachment* getAttachment(GLenum) const; | 114 WebGLAttachment* getAttachment(GLenum) const; |
| 117 bool isAttachmentComplete(WebGLAttachment* attachedObject, GLenum attachment , const char** reason) const; | 115 bool isAttachmentComplete(WebGLAttachment* attachedObject, GLenum attachment , const char** reason) const; |
| 118 | 116 |
| 119 // Check if the framebuffer is currently bound. | 117 // Check if the framebuffer is currently bound. |
| 120 bool isBound() const; | 118 bool isBound() const; |
| 121 | 119 |
| 122 // attach 'attachment' at 'attachmentPoint'. | 120 // attach 'attachment' at 'attachmentPoint'. |
| 123 void attach(GLenum attachment, GLenum attachmentPoint); | 121 void attach(GLenum attachment, GLenum attachmentPoint); |
| 124 | 122 |
| 125 // Check if a new drawBuffers call should be issued. This is called when we add or remove an attachment. | 123 // Check if a new drawBuffers call should be issued. This is called when we add or remove an attachment. |
| 126 void drawBuffersIfNecessary(bool force); | 124 void drawBuffersIfNecessary(bool force); |
| 127 | 125 |
| 128 typedef WTF::HashMap<GLenum, RefPtr<WebGLAttachment> > AttachmentMap; | 126 typedef WTF::HashMap<GLenum, RefPtr<WebGLAttachment> > AttachmentMap; |
| 129 | 127 |
| 130 AttachmentMap m_attachments; | 128 AttachmentMap m_attachments; |
| 131 | 129 |
| 132 bool m_hasEverBeenBound; | 130 bool m_hasEverBeenBound; |
| 133 | 131 |
| 134 Vector<GLenum> m_drawBuffers; | 132 Vector<GLenum> m_drawBuffers; |
| 135 Vector<GLenum> m_filteredDrawBuffers; | 133 Vector<GLenum> m_filteredDrawBuffers; |
| 136 }; | 134 }; |
| 137 | 135 |
| 138 } // namespace WebCore | 136 } // namespace WebCore |
| 139 | 137 |
| 140 #endif // WebGLFramebuffer_h | 138 #endif // WebGLFramebuffer_h |
| OLD | NEW |