Chromium Code Reviews| 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_DEMO_BITMAP_UPLOADER_H_ | 5 #ifndef SERVICES_UI_DEMO_BITMAP_UPLOADER_H_ |
| 6 #define SERVICES_UI_DEMO_BITMAP_UPLOADER_H_ | 6 #define SERVICES_UI_DEMO_BITMAP_UPLOADER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 namespace ui { | 21 namespace ui { |
| 22 class GLES2Context; | 22 class GLES2Context; |
| 23 class GpuService; | 23 class GpuService; |
| 24 | 24 |
| 25 extern const char kBitmapUploaderForAcceleratedWidget[]; | 25 extern const char kBitmapUploaderForAcceleratedWidget[]; |
| 26 | 26 |
| 27 // BitmapUploader is useful if you want to draw a bitmap or color in a | 27 // BitmapUploader is useful if you want to draw a bitmap or color in a |
| 28 // Window. | 28 // Window. |
| 29 class BitmapUploader : public WindowSurfaceClient { | 29 class BitmapUploader : public WindowSurfaceClient { |
| 30 public: | 30 public: |
| 31 BitmapUploader(Window* window, GpuService* gpu_service); | 31 BitmapUploader(Window* window); |
|
sky
2016/08/18 19:12:09
explicit
sadrul
2016/08/18 20:53:28
Done.
| |
| 32 ~BitmapUploader() override; | 32 ~BitmapUploader() override; |
| 33 | 33 |
| 34 void Init(); | 34 void Init(GpuService* gpu_service); |
| 35 | |
| 36 // Sets the color which is RGBA. | 35 // Sets the color which is RGBA. |
| 37 void SetColor(uint32_t color); | 36 void SetColor(uint32_t color); |
| 38 | 37 |
| 39 enum Format { | 38 enum Format { |
| 40 RGBA, // Pixel layout on Android. | 39 RGBA, // Pixel layout on Android. |
| 41 BGRA, // Pixel layout everywhere else. | 40 BGRA, // Pixel layout everywhere else. |
| 42 }; | 41 }; |
| 43 | 42 |
| 44 // Sets a bitmap. | 43 // Sets a bitmap. |
| 45 void SetBitmap(int width, | 44 void SetBitmap(int width, |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 61 // WindowSurfaceClient implementation. | 60 // WindowSurfaceClient implementation. |
| 62 void OnResourcesReturned( | 61 void OnResourcesReturned( |
| 63 WindowSurface* surface, | 62 WindowSurface* surface, |
| 64 mojo::Array<cc::ReturnedResource> resources) override; | 63 mojo::Array<cc::ReturnedResource> resources) override; |
| 65 | 64 |
| 66 Window* window_; | 65 Window* window_; |
| 67 std::unique_ptr<WindowSurface> surface_; | 66 std::unique_ptr<WindowSurface> surface_; |
| 68 // This may be null if there is an error contacting mus/initializing. We | 67 // This may be null if there is an error contacting mus/initializing. We |
| 69 // assume we'll be shutting down soon and do nothing in this case. | 68 // assume we'll be shutting down soon and do nothing in this case. |
| 70 std::unique_ptr<GLES2Context> gles2_context_; | 69 std::unique_ptr<GLES2Context> gles2_context_; |
| 71 GpuService* gpu_service_; | |
| 72 | 70 |
| 73 uint32_t color_; | 71 uint32_t color_; |
| 74 int width_; | 72 int width_; |
| 75 int height_; | 73 int height_; |
| 76 Format format_; | 74 Format format_; |
| 77 std::unique_ptr<std::vector<unsigned char>> bitmap_; | 75 std::unique_ptr<std::vector<unsigned char>> bitmap_; |
| 78 uint32_t next_resource_id_; | 76 uint32_t next_resource_id_; |
| 79 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_; |
| 80 | 78 |
| 81 DISALLOW_COPY_AND_ASSIGN(BitmapUploader); | 79 DISALLOW_COPY_AND_ASSIGN(BitmapUploader); |
| 82 }; | 80 }; |
| 83 | 81 |
| 84 } // namespace ui | 82 } // namespace ui |
| 85 | 83 |
| 86 #endif // SERVICES_UI_DEMO_BITMAP_UPLOADER_H_ | 84 #endif // SERVICES_UI_DEMO_BITMAP_UPLOADER_H_ |
| OLD | NEW |