Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: services/ui/demo/bitmap_uploader.h

Issue 2257693002: services/ui: Use a gpu::GpuChannelHost when creating ui::OutputSurface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mus-demo Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 13 matching lines...) Expand all
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, GpuService* gpu_service);
32 ~BitmapUploader() override; 32 ~BitmapUploader() override;
33 33
34 void Init();
35
36 // Sets the color which is RGBA. 34 // Sets the color which is RGBA.
37 void SetColor(uint32_t color); 35 void SetColor(uint32_t color);
38 36
39 enum Format { 37 enum Format {
40 RGBA, // Pixel layout on Android. 38 RGBA, // Pixel layout on Android.
41 BGRA, // Pixel layout everywhere else. 39 BGRA, // Pixel layout everywhere else.
42 }; 40 };
43 41
44 // Sets a bitmap. 42 // Sets a bitmap.
45 void SetBitmap(int width, 43 void SetBitmap(int width,
(...skipping 15 matching lines...) Expand all
61 // WindowSurfaceClient implementation. 59 // WindowSurfaceClient implementation.
62 void OnResourcesReturned( 60 void OnResourcesReturned(
63 WindowSurface* surface, 61 WindowSurface* surface,
64 mojo::Array<cc::ReturnedResource> resources) override; 62 mojo::Array<cc::ReturnedResource> resources) override;
65 63
66 Window* window_; 64 Window* window_;
67 std::unique_ptr<WindowSurface> surface_; 65 std::unique_ptr<WindowSurface> surface_;
68 // This may be null if there is an error contacting mus/initializing. We 66 // 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. 67 // assume we'll be shutting down soon and do nothing in this case.
70 std::unique_ptr<GLES2Context> gles2_context_; 68 std::unique_ptr<GLES2Context> gles2_context_;
71 GpuService* gpu_service_;
72 69
73 uint32_t color_; 70 uint32_t color_;
74 int width_; 71 int width_;
75 int height_; 72 int height_;
76 Format format_; 73 Format format_;
77 std::unique_ptr<std::vector<unsigned char>> bitmap_; 74 std::unique_ptr<std::vector<unsigned char>> bitmap_;
78 uint32_t next_resource_id_; 75 uint32_t next_resource_id_;
79 base::hash_map<uint32_t, uint32_t> resource_to_texture_id_map_; 76 base::hash_map<uint32_t, uint32_t> resource_to_texture_id_map_;
80 77
81 DISALLOW_COPY_AND_ASSIGN(BitmapUploader); 78 DISALLOW_COPY_AND_ASSIGN(BitmapUploader);
82 }; 79 };
83 80
84 } // namespace ui 81 } // namespace ui
85 82
86 #endif // SERVICES_UI_DEMO_BITMAP_UPLOADER_H_ 83 #endif // SERVICES_UI_DEMO_BITMAP_UPLOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698