Don't add an aura tooltip to bubble close buttons on Windows.
[chromium-blink-merge.git] / gpu / command_buffer / service / texture_definition.h
blobdcab0b8455fee295f0a0c23ae6139b8864a8212a
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
3 // found in the LICENSE file.
5 #ifndef GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_
8 #include <vector>
10 #include "base/memory/ref_counted.h"
11 #include "gpu/command_buffer/service/gl_utils.h"
13 namespace gfx {
14 class GLImage;
17 namespace gpu {
18 namespace gles2 {
20 class Texture;
22 class NativeImageBuffer : public base::RefCountedThreadSafe<NativeImageBuffer> {
23 public:
24 static scoped_refptr<NativeImageBuffer> Create(GLuint texture_id);
26 virtual void AddClient(gfx::GLImage* client) = 0;
27 virtual void RemoveClient(gfx::GLImage* client) = 0;
28 virtual bool IsClient(gfx::GLImage* client) = 0;
29 virtual void BindToTexture(GLenum target) = 0;
31 protected:
32 friend class base::RefCountedThreadSafe<NativeImageBuffer>;
33 NativeImageBuffer() {}
34 virtual ~NativeImageBuffer() {}
36 DISALLOW_COPY_AND_ASSIGN(NativeImageBuffer);
39 // An immutable description that can be used to create a texture that shares
40 // the underlying image buffer(s).
41 class TextureDefinition {
42 public:
43 TextureDefinition();
44 TextureDefinition(Texture* texture,
45 unsigned int version,
46 const scoped_refptr<NativeImageBuffer>& image);
47 virtual ~TextureDefinition();
49 Texture* CreateTexture() const;
50 void UpdateTexture(Texture* texture) const;
52 unsigned int version() const { return version_; }
53 bool IsOlderThan(unsigned int version) const {
54 return (version - version_) < 0x80000000;
56 bool Matches(const Texture* texture) const;
58 scoped_refptr<NativeImageBuffer> image() const { return image_buffer_; }
60 private:
61 bool SafeToRenderFrom() const;
63 struct LevelInfo {
64 LevelInfo();
65 LevelInfo(GLenum target,
66 GLenum internal_format,
67 GLsizei width,
68 GLsizei height,
69 GLsizei depth,
70 GLint border,
71 GLenum format,
72 GLenum type,
73 bool cleared);
74 ~LevelInfo();
76 GLenum target;
77 GLenum internal_format;
78 GLsizei width;
79 GLsizei height;
80 GLsizei depth;
81 GLint border;
82 GLenum format;
83 GLenum type;
84 bool cleared;
87 unsigned int version_;
88 GLenum target_;
89 scoped_refptr<NativeImageBuffer> image_buffer_;
90 GLenum min_filter_;
91 GLenum mag_filter_;
92 GLenum wrap_s_;
93 GLenum wrap_t_;
94 GLenum usage_;
95 bool immutable_;
96 bool defined_;
98 // Only support textures with one face and one level.
99 LevelInfo level_info_;
102 } // namespage gles2
103 } // namespace gpu
105 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_