| 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 SERVICES_UI_PUBLIC_CPP_BITMAP_UPLOADER_H_ | 5 #ifndef SERVICES_UI_PUBLIC_CPP_BITMAP_UPLOADER_H_ |
| 6 #define SERVICES_UI_PUBLIC_CPP_BITMAP_UPLOADER_H_ | 6 #define SERVICES_UI_PUBLIC_CPP_BITMAP_UPLOADER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "gpu/GLES2/gl2chromium.h" | 15 #include "gpu/GLES2/gl2chromium.h" |
| 16 #include "gpu/GLES2/gl2extchromium.h" | 16 #include "gpu/GLES2/gl2extchromium.h" |
| 17 #include "services/ui/public/cpp/window_surface.h" | 17 #include "services/ui/public/cpp/window_surface.h" |
| 18 #include "services/ui/public/cpp/window_surface_client.h" | 18 #include "services/ui/public/cpp/window_surface_client.h" |
| 19 #include "services/ui/public/interfaces/surface.mojom.h" | 19 #include "services/ui/public/interfaces/surface.mojom.h" |
| 20 | 20 |
| 21 namespace shell { | |
| 22 class Connector; | |
| 23 } | |
| 24 | |
| 25 namespace ui { | 21 namespace ui { |
| 26 class GLES2Context; | 22 class GLES2Context; |
| 27 | 23 |
| 28 extern const char kBitmapUploaderForAcceleratedWidget[]; | 24 extern const char kBitmapUploaderForAcceleratedWidget[]; |
| 29 | 25 |
| 30 // BitmapUploader is useful if you want to draw a bitmap or color in a | 26 // BitmapUploader is useful if you want to draw a bitmap or color in a |
| 31 // Window. | 27 // Window. |
| 32 class BitmapUploader : public WindowSurfaceClient { | 28 class BitmapUploader : public WindowSurfaceClient { |
| 33 public: | 29 public: |
| 34 explicit BitmapUploader(Window* window); | 30 explicit BitmapUploader(Window* window); |
| 35 ~BitmapUploader() override; | 31 ~BitmapUploader() override; |
| 36 | 32 |
| 37 void Init(shell::Connector* connector); | 33 void Init(); |
| 38 | 34 |
| 39 // Sets the color which is RGBA. | 35 // Sets the color which is RGBA. |
| 40 void SetColor(uint32_t color); | 36 void SetColor(uint32_t color); |
| 41 | 37 |
| 42 enum Format { | 38 enum Format { |
| 43 RGBA, // Pixel layout on Android. | 39 RGBA, // Pixel layout on Android. |
| 44 BGRA, // Pixel layout everywhere else. | 40 BGRA, // Pixel layout everywhere else. |
| 45 }; | 41 }; |
| 46 | 42 |
| 47 // Sets a bitmap. | 43 // Sets a bitmap. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 std::unique_ptr<std::vector<unsigned char>> bitmap_; | 75 std::unique_ptr<std::vector<unsigned char>> bitmap_; |
| 80 uint32_t next_resource_id_; | 76 uint32_t next_resource_id_; |
| 81 base::hash_map<uint32_t, uint32_t> resource_to_texture_id_map_; | 77 base::hash_map<uint32_t, uint32_t> resource_to_texture_id_map_; |
| 82 | 78 |
| 83 DISALLOW_COPY_AND_ASSIGN(BitmapUploader); | 79 DISALLOW_COPY_AND_ASSIGN(BitmapUploader); |
| 84 }; | 80 }; |
| 85 | 81 |
| 86 } // namespace ui | 82 } // namespace ui |
| 87 | 83 |
| 88 #endif // SERVICES_UI_PUBLIC_CPP_BITMAP_UPLOADER_H_ | 84 #endif // SERVICES_UI_PUBLIC_CPP_BITMAP_UPLOADER_H_ |
| OLD | NEW |