| 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 15 matching lines...) Expand all Loading... |
| 26 #ifndef WebGLTexture_h | 26 #ifndef WebGLTexture_h |
| 27 #define WebGLTexture_h | 27 #define WebGLTexture_h |
| 28 | 28 |
| 29 #include "bindings/v8/ScriptWrappable.h" | 29 #include "bindings/v8/ScriptWrappable.h" |
| 30 #include "core/html/canvas/WebGLSharedObject.h" | 30 #include "core/html/canvas/WebGLSharedObject.h" |
| 31 #include "wtf/PassRefPtr.h" | 31 #include "wtf/PassRefPtr.h" |
| 32 #include "wtf/Vector.h" | 32 #include "wtf/Vector.h" |
| 33 | 33 |
| 34 namespace WebCore { | 34 namespace WebCore { |
| 35 | 35 |
| 36 class WebGLTexture : public WebGLSharedObject, public ScriptWrappable { | 36 class WebGLTexture FINAL : public WebGLSharedObject, public ScriptWrappable { |
| 37 public: | 37 public: |
| 38 enum TextureExtensionFlag { | 38 enum TextureExtensionFlag { |
| 39 NoTextureExtensionEnabled = 0, | 39 NoTextureExtensionEnabled = 0, |
| 40 TextureFloatLinearExtensionEnabled = 1 << 0, | 40 TextureFloatLinearExtensionEnabled = 1 << 0, |
| 41 TextureHalfFloatLinearExtensionEnabled = 1 << 1 | 41 TextureHalfFloatLinearExtensionEnabled = 1 << 1 |
| 42 }; | 42 }; |
| 43 virtual ~WebGLTexture(); | 43 virtual ~WebGLTexture(); |
| 44 | 44 |
| 45 static PassRefPtr<WebGLTexture> create(WebGLRenderingContext*); | 45 static PassRefPtr<WebGLTexture> create(WebGLRenderingContext*); |
| 46 | 46 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 71 // Determine if texture sampling should always return [0, 0, 0, 1] (OpenGL E
S 2.0 Sec 3.8.2). | 71 // Determine if texture sampling should always return [0, 0, 0, 1] (OpenGL E
S 2.0 Sec 3.8.2). |
| 72 bool needToUseBlackTexture(TextureExtensionFlag) const; | 72 bool needToUseBlackTexture(TextureExtensionFlag) const; |
| 73 | 73 |
| 74 bool hasEverBeenBound() const { return object() && m_target; } | 74 bool hasEverBeenBound() const { return object() && m_target; } |
| 75 | 75 |
| 76 static GLint computeLevelCount(GLsizei width, GLsizei height); | 76 static GLint computeLevelCount(GLsizei width, GLsizei height); |
| 77 | 77 |
| 78 protected: | 78 protected: |
| 79 WebGLTexture(WebGLRenderingContext*); | 79 WebGLTexture(WebGLRenderingContext*); |
| 80 | 80 |
| 81 virtual void deleteObjectImpl(GraphicsContext3D*, Platform3DObject); | 81 virtual void deleteObjectImpl(GraphicsContext3D*, Platform3DObject) OVERRIDE
; |
| 82 | 82 |
| 83 private: | 83 private: |
| 84 class LevelInfo { | 84 class LevelInfo { |
| 85 public: | 85 public: |
| 86 LevelInfo() | 86 LevelInfo() |
| 87 : valid(false) | 87 : valid(false) |
| 88 , internalFormat(0) | 88 , internalFormat(0) |
| 89 , width(0) | 89 , width(0) |
| 90 , height(0) | 90 , height(0) |
| 91 , type(0) | 91 , type(0) |
| 92 { | 92 { |
| 93 } | 93 } |
| 94 | 94 |
| 95 void setInfo(GLenum internalFmt, GLsizei w, GLsizei h, GLenum tp) | 95 void setInfo(GLenum internalFmt, GLsizei w, GLsizei h, GLenum tp) |
| 96 { | 96 { |
| 97 valid = true; | 97 valid = true; |
| 98 internalFormat = internalFmt; | 98 internalFormat = internalFmt; |
| 99 width = w; | 99 width = w; |
| 100 height = h; | 100 height = h; |
| 101 type = tp; | 101 type = tp; |
| 102 } | 102 } |
| 103 | 103 |
| 104 bool valid; | 104 bool valid; |
| 105 GLenum internalFormat; | 105 GLenum internalFormat; |
| 106 GLsizei width; | 106 GLsizei width; |
| 107 GLsizei height; | 107 GLsizei height; |
| 108 GLenum type; | 108 GLenum type; |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 virtual bool isTexture() const { return true; } | 111 virtual bool isTexture() const OVERRIDE { return true; } |
| 112 | 112 |
| 113 void update(); | 113 void update(); |
| 114 | 114 |
| 115 int mapTargetToIndex(GLenum) const; | 115 int mapTargetToIndex(GLenum) const; |
| 116 | 116 |
| 117 const LevelInfo* getLevelInfo(GLenum target, GLint level) const; | 117 const LevelInfo* getLevelInfo(GLenum target, GLint level) const; |
| 118 | 118 |
| 119 GLenum m_target; | 119 GLenum m_target; |
| 120 | 120 |
| 121 GLenum m_minFilter; | 121 GLenum m_minFilter; |
| 122 GLenum m_magFilter; | 122 GLenum m_magFilter; |
| 123 GLenum m_wrapS; | 123 GLenum m_wrapS; |
| 124 GLenum m_wrapT; | 124 GLenum m_wrapT; |
| 125 | 125 |
| 126 Vector<Vector<LevelInfo> > m_info; | 126 Vector<Vector<LevelInfo> > m_info; |
| 127 | 127 |
| 128 bool m_isNPOT; | 128 bool m_isNPOT; |
| 129 bool m_isCubeComplete; | 129 bool m_isCubeComplete; |
| 130 bool m_isComplete; | 130 bool m_isComplete; |
| 131 bool m_needToUseBlackTexture; | 131 bool m_needToUseBlackTexture; |
| 132 bool m_isFloatType; | 132 bool m_isFloatType; |
| 133 bool m_isHalfFloatType; | 133 bool m_isHalfFloatType; |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 } // namespace WebCore | 136 } // namespace WebCore |
| 137 | 137 |
| 138 #endif // WebGLTexture_h | 138 #endif // WebGLTexture_h |
| OLD | NEW |