OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "gpu/command_buffer/tests/texture_image_factory.h" | 5 #include "gpu/command_buffer/tests/texture_image_factory.h" |
6 | 6 |
7 #include "ui/gl/gl_bindings.h" | 7 #include "ui/gl/gl_bindings.h" |
8 #include "ui/gl/gl_image.h" | 8 #include "ui/gl/gl_image.h" |
9 | 9 |
10 namespace gpu { | 10 namespace gpu { |
11 | 11 |
12 // An image that allocates storage for the texture using glTexImage2D. | 12 // An image that allocates storage for the texture using glTexImage2D. |
13 class TextureImage : public gl::GLImage { | 13 class TextureImage : public gl::GLImage { |
14 public: | 14 public: |
15 explicit TextureImage(const gfx::Size& size) : size_(size) {} | 15 explicit TextureImage(const gfx::Size& size) : size_(size) {} |
16 | 16 |
17 void Destroy(bool have_context) override {} | |
18 gfx::Size GetSize() override { return size_; } | 17 gfx::Size GetSize() override { return size_; } |
19 unsigned GetInternalFormat() override { return GL_RGBA; } | 18 unsigned GetInternalFormat() override { return GL_RGBA; } |
20 bool BindTexImage(unsigned target) override { | 19 bool BindTexImage(unsigned target) override { |
21 glTexImage2D(target, | 20 glTexImage2D(target, |
22 0, // mip level | 21 0, // mip level |
23 GetInternalFormat(), size_.width(), size_.height(), | 22 GetInternalFormat(), size_.width(), size_.height(), |
24 0, // border | 23 0, // border |
25 GetInternalFormat(), GL_UNSIGNED_BYTE, nullptr); | 24 GetInternalFormat(), GL_UNSIGNED_BYTE, nullptr); |
26 return true; | 25 return true; |
27 } | 26 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 74 |
76 bool TextureImageFactory::SupportsFormatRGB() { | 75 bool TextureImageFactory::SupportsFormatRGB() { |
77 return false; | 76 return false; |
78 } | 77 } |
79 | 78 |
80 void TextureImageFactory::SetRequiredTextureType(unsigned type) { | 79 void TextureImageFactory::SetRequiredTextureType(unsigned type) { |
81 required_texture_type_ = type; | 80 required_texture_type_ = type; |
82 } | 81 } |
83 | 82 |
84 } // namespace gpu | 83 } // namespace gpu |
OLD | NEW |