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> |
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 "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "cc/output/compositor_frame_sink_client.h" | 16 #include "cc/output/compositor_frame_sink_client.h" |
17 #include "gpu/GLES2/gl2chromium.h" | 17 #include "gpu/GLES2/gl2chromium.h" |
18 #include "gpu/GLES2/gl2extchromium.h" | 18 #include "gpu/GLES2/gl2extchromium.h" |
19 #include "services/ui/public/cpp/compositor_frame_sink.h" | 19 #include "services/ui/public/cpp/window_compositor_frame_sink.h" |
20 #include "services/ui/public/cpp/window_surface.h" | |
21 #include "services/ui/public/cpp/window_surface_client.h" | |
22 | 20 |
23 namespace gpu { | 21 namespace gpu { |
24 class GpuChannelHost; | 22 class GpuChannelHost; |
25 } | 23 } |
26 | 24 |
27 namespace ui { | 25 namespace ui { |
28 class GLES2Context; | 26 |
29 class GpuService; | 27 class GpuService; |
| 28 class Window; |
30 | 29 |
31 extern const char kBitmapUploaderForAcceleratedWidget[]; | 30 extern const char kBitmapUploaderForAcceleratedWidget[]; |
32 | 31 |
33 // BitmapUploader is useful if you want to draw a bitmap or color in a | 32 // BitmapUploader is useful if you want to draw a bitmap or color in a |
34 // Window. | 33 // Window. |
35 class BitmapUploader : public cc::CompositorFrameSinkClient { | 34 class BitmapUploader : public cc::CompositorFrameSinkClient { |
36 public: | 35 public: |
37 explicit BitmapUploader(Window* window); | 36 explicit BitmapUploader(Window* window); |
38 ~BitmapUploader() override; | 37 ~BitmapUploader() override; |
39 | 38 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 void DidLoseCompositorFrameSink() override; | 72 void DidLoseCompositorFrameSink() override; |
74 void OnDraw(const gfx::Transform& transform, | 73 void OnDraw(const gfx::Transform& transform, |
75 const gfx::Rect& viewport, | 74 const gfx::Rect& viewport, |
76 bool resourceless_software_draw) override; | 75 bool resourceless_software_draw) override; |
77 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override; | 76 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override; |
78 void SetExternalTilePriorityConstraints( | 77 void SetExternalTilePriorityConstraints( |
79 const gfx::Rect& viewport_rect, | 78 const gfx::Rect& viewport_rect, |
80 const gfx::Transform& transform) override; | 79 const gfx::Transform& transform) override; |
81 | 80 |
82 Window* window_; | 81 Window* window_; |
83 std::unique_ptr<CompositorFrameSink> compositor_frame_sink_; | 82 std::unique_ptr<WindowCompositorFrameSink> compositor_frame_sink_; |
84 | 83 |
85 uint32_t color_; | 84 uint32_t color_; |
86 int width_; | 85 int width_; |
87 int height_; | 86 int height_; |
88 Format format_; | 87 Format format_; |
89 std::unique_ptr<std::vector<unsigned char>> bitmap_; | 88 std::unique_ptr<std::vector<unsigned char>> bitmap_; |
90 uint32_t next_resource_id_; | 89 uint32_t next_resource_id_; |
91 base::hash_map<uint32_t, uint32_t> resource_to_texture_id_map_; | 90 base::hash_map<uint32_t, uint32_t> resource_to_texture_id_map_; |
92 | 91 |
93 base::WeakPtrFactory<BitmapUploader> weak_factory_; | 92 base::WeakPtrFactory<BitmapUploader> weak_factory_; |
94 | 93 |
95 DISALLOW_COPY_AND_ASSIGN(BitmapUploader); | 94 DISALLOW_COPY_AND_ASSIGN(BitmapUploader); |
96 }; | 95 }; |
97 | 96 |
98 } // namespace ui | 97 } // namespace ui |
99 | 98 |
100 #endif // SERVICES_UI_DEMO_BITMAP_UPLOADER_H_ | 99 #endif // SERVICES_UI_DEMO_BITMAP_UPLOADER_H_ |
OLD | NEW |