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