| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_BITMAP_UPLOADER_BITMAP_UPLOADER_H_ | 5 #ifndef COMPONENTS_BITMAP_UPLOADER_BITMAP_UPLOADER_H_ |
| 6 #define COMPONENTS_BITMAP_UPLOADER_BITMAP_UPLOADER_H_ | 6 #define COMPONENTS_BITMAP_UPLOADER_BITMAP_UPLOADER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 // Sets a bitmap. | 53 // Sets a bitmap. |
| 54 void SetBitmap(int width, | 54 void SetBitmap(int width, |
| 55 int height, | 55 int height, |
| 56 std::unique_ptr<std::vector<unsigned char>> data, | 56 std::unique_ptr<std::vector<unsigned char>> data, |
| 57 Format format); | 57 Format format); |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 void Upload(); | 60 void Upload(); |
| 61 | 61 |
| 62 uint32_t BindTextureForSize(const mojo::Size size); | 62 uint32_t BindTextureForSize(const gfx::Size& size); |
| 63 | 63 |
| 64 uint32_t TextureFormat() const { | 64 uint32_t TextureFormat() const { |
| 65 return format_ == BGRA ? GL_BGRA_EXT : GL_RGBA; | 65 return format_ == BGRA ? GL_BGRA_EXT : GL_RGBA; |
| 66 } | 66 } |
| 67 | 67 |
| 68 void SetIdNamespace(uint32_t id_namespace); | 68 void SetIdNamespace(uint32_t id_namespace); |
| 69 | 69 |
| 70 // WindowSurfaceClient implementation. | 70 // WindowSurfaceClient implementation. |
| 71 void OnResourcesReturned( | 71 void OnResourcesReturned( |
| 72 mus::WindowSurface* surface, | 72 mus::WindowSurface* surface, |
| 73 mojo::Array<mus::mojom::ReturnedResourcePtr> resources) override; | 73 mojo::Array<mus::mojom::ReturnedResourcePtr> resources) override; |
| 74 | 74 |
| 75 mus::Window* window_; | 75 mus::Window* window_; |
| 76 mus::mojom::GpuPtr gpu_service_; | 76 mus::mojom::GpuPtr gpu_service_; |
| 77 std::unique_ptr<mus::WindowSurface> surface_; | 77 std::unique_ptr<mus::WindowSurface> surface_; |
| 78 std::unique_ptr<mus::GLES2Context> gles2_context_; | 78 std::unique_ptr<mus::GLES2Context> gles2_context_; |
| 79 | 79 |
| 80 mojo::Size size_; | |
| 81 uint32_t color_; | 80 uint32_t color_; |
| 82 int width_; | 81 int width_; |
| 83 int height_; | 82 int height_; |
| 84 Format format_; | 83 Format format_; |
| 85 std::unique_ptr<std::vector<unsigned char>> bitmap_; | 84 std::unique_ptr<std::vector<unsigned char>> bitmap_; |
| 86 uint32_t next_resource_id_; | 85 uint32_t next_resource_id_; |
| 87 uint32_t id_namespace_; | 86 uint32_t id_namespace_; |
| 88 base::hash_map<uint32_t, uint32_t> resource_to_texture_id_map_; | 87 base::hash_map<uint32_t, uint32_t> resource_to_texture_id_map_; |
| 89 | 88 |
| 90 DISALLOW_COPY_AND_ASSIGN(BitmapUploader); | 89 DISALLOW_COPY_AND_ASSIGN(BitmapUploader); |
| 91 }; | 90 }; |
| 92 | 91 |
| 93 } // namespace bitmap_uploader | 92 } // namespace bitmap_uploader |
| 94 | 93 |
| 95 #endif // COMPONENTS_BITMAP_UPLOADER_BITMAP_UPLAODER_H_ | 94 #endif // COMPONENTS_BITMAP_UPLOADER_BITMAP_UPLAODER_H_ |
| OLD | NEW |