| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_ |
| 6 #define GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // An immutable description that can be used to create a texture that shares | 41 // An immutable description that can be used to create a texture that shares |
| 42 // the underlying image buffer(s). | 42 // the underlying image buffer(s). |
| 43 class TextureDefinition { | 43 class TextureDefinition { |
| 44 public: | 44 public: |
| 45 static void AvoidEGLTargetTextureReuse(); | 45 static void AvoidEGLTargetTextureReuse(); |
| 46 | 46 |
| 47 TextureDefinition(); | 47 TextureDefinition(); |
| 48 TextureDefinition(Texture* texture, | 48 TextureDefinition(Texture* texture, |
| 49 unsigned int version, | 49 unsigned int version, |
| 50 const scoped_refptr<NativeImageBuffer>& image); | 50 const scoped_refptr<NativeImageBuffer>& image); |
| 51 TextureDefinition(const TextureDefinition& other); |
| 51 virtual ~TextureDefinition(); | 52 virtual ~TextureDefinition(); |
| 52 | 53 |
| 53 Texture* CreateTexture() const; | 54 Texture* CreateTexture() const; |
| 54 | 55 |
| 55 void UpdateTexture(Texture* texture) const; | 56 void UpdateTexture(Texture* texture) const; |
| 56 | 57 |
| 57 unsigned int version() const { return version_; } | 58 unsigned int version() const { return version_; } |
| 58 bool IsOlderThan(unsigned int version) const { | 59 bool IsOlderThan(unsigned int version) const { |
| 59 return (version - version_) < 0x80000000; | 60 return (version - version_) < 0x80000000; |
| 60 } | 61 } |
| 61 bool Matches(const Texture* texture) const; | 62 bool Matches(const Texture* texture) const; |
| 62 | 63 |
| 63 scoped_refptr<NativeImageBuffer> image() const { return image_buffer_; } | 64 scoped_refptr<NativeImageBuffer> image() const { return image_buffer_; } |
| 64 | 65 |
| 65 private: | 66 private: |
| 66 bool SafeToRenderFrom() const; | 67 bool SafeToRenderFrom() const; |
| 67 void UpdateTextureInternal(Texture* texture) const; | 68 void UpdateTextureInternal(Texture* texture) const; |
| 68 | 69 |
| 69 struct LevelInfo { | 70 struct LevelInfo { |
| 70 LevelInfo(); | 71 LevelInfo(); |
| 71 LevelInfo(GLenum target, | 72 LevelInfo(GLenum target, |
| 72 GLenum internal_format, | 73 GLenum internal_format, |
| 73 GLsizei width, | 74 GLsizei width, |
| 74 GLsizei height, | 75 GLsizei height, |
| 75 GLsizei depth, | 76 GLsizei depth, |
| 76 GLint border, | 77 GLint border, |
| 77 GLenum format, | 78 GLenum format, |
| 78 GLenum type, | 79 GLenum type, |
| 79 const gfx::Rect& cleared_rect); | 80 const gfx::Rect& cleared_rect); |
| 81 LevelInfo(const LevelInfo& other); |
| 80 ~LevelInfo(); | 82 ~LevelInfo(); |
| 81 | 83 |
| 82 GLenum target; | 84 GLenum target; |
| 83 GLenum internal_format; | 85 GLenum internal_format; |
| 84 GLsizei width; | 86 GLsizei width; |
| 85 GLsizei height; | 87 GLsizei height; |
| 86 GLsizei depth; | 88 GLsizei depth; |
| 87 GLint border; | 89 GLint border; |
| 88 GLenum format; | 90 GLenum format; |
| 89 GLenum type; | 91 GLenum type; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 102 bool defined_; | 104 bool defined_; |
| 103 | 105 |
| 104 // Only support textures with one face and one level. | 106 // Only support textures with one face and one level. |
| 105 LevelInfo level_info_; | 107 LevelInfo level_info_; |
| 106 }; | 108 }; |
| 107 | 109 |
| 108 } // namespage gles2 | 110 } // namespage gles2 |
| 109 } // namespace gpu | 111 } // namespace gpu |
| 110 | 112 |
| 111 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_ | 113 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_ |
| OLD | NEW |