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

Side by Side Diff: services/ui/public/cpp/bitmap_uploader.h

Issue 2162693002: Move bitmap uploader to ui service client lib (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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
« no previous file with comments | « services/ui/public/cpp/BUILD.gn ('k') | services/ui/public/cpp/lib/bitmap_uploader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 COMPONENTS_BITMAP_UPLOADER_BITMAP_UPLOADER_H_ 5 #ifndef SERVICES_UI_PUBLIC_CPP_BITMAP_UPLOADER_H_
6 #define COMPONENTS_BITMAP_UPLOADER_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 "components/bitmap_uploader/bitmap_uploader_export.h"
16 #include "gpu/GLES2/gl2chromium.h" 15 #include "gpu/GLES2/gl2chromium.h"
17 #include "gpu/GLES2/gl2extchromium.h" 16 #include "gpu/GLES2/gl2extchromium.h"
18 #include "services/ui/public/cpp/window_surface.h" 17 #include "services/ui/public/cpp/window_surface.h"
19 #include "services/ui/public/cpp/window_surface_client.h" 18 #include "services/ui/public/cpp/window_surface_client.h"
20 #include "services/ui/public/interfaces/surface.mojom.h" 19 #include "services/ui/public/interfaces/surface.mojom.h"
21 20
22 namespace ui {
23 class GLES2Context;
24 }
25
26 namespace shell { 21 namespace shell {
27 class Connector; 22 class Connector;
28 } 23 }
29 24
30 namespace bitmap_uploader { 25 namespace ui {
26 class GLES2Context;
31 27
32 BITMAP_UPLOADER_EXPORT extern const char kBitmapUploaderForAcceleratedWidget[]; 28 extern const char kBitmapUploaderForAcceleratedWidget[];
33 29
34 // BitmapUploader is useful if you want to draw a bitmap or color in a 30 // BitmapUploader is useful if you want to draw a bitmap or color in a
35 // ui::Window. 31 // Window.
36 class BITMAP_UPLOADER_EXPORT BitmapUploader 32 class BitmapUploader : public WindowSurfaceClient {
37 : public NON_EXPORTED_BASE(ui::WindowSurfaceClient) {
38 public: 33 public:
39 explicit BitmapUploader(ui::Window* window); 34 explicit BitmapUploader(Window* window);
40 ~BitmapUploader() override; 35 ~BitmapUploader() override;
41 36
42 void Init(shell::Connector* connector); 37 void Init(shell::Connector* connector);
43 38
44 // Sets the color which is RGBA. 39 // Sets the color which is RGBA.
45 void SetColor(uint32_t color); 40 void SetColor(uint32_t color);
46 41
47 enum Format { 42 enum Format {
48 RGBA, // Pixel layout on Android. 43 RGBA, // Pixel layout on Android.
49 BGRA, // Pixel layout everywhere else. 44 BGRA, // Pixel layout everywhere else.
(...skipping 11 matching lines...) Expand all
61 uint32_t BindTextureForSize(const gfx::Size& size); 56 uint32_t BindTextureForSize(const gfx::Size& size);
62 57
63 uint32_t TextureFormat() const { 58 uint32_t TextureFormat() const {
64 return format_ == BGRA ? GL_BGRA_EXT : GL_RGBA; 59 return format_ == BGRA ? GL_BGRA_EXT : GL_RGBA;
65 } 60 }
66 61
67 void SetIdNamespace(uint32_t id_namespace); 62 void SetIdNamespace(uint32_t id_namespace);
68 63
69 // WindowSurfaceClient implementation. 64 // WindowSurfaceClient implementation.
70 void OnResourcesReturned( 65 void OnResourcesReturned(
71 ui::WindowSurface* surface, 66 WindowSurface* surface,
72 mojo::Array<cc::ReturnedResource> resources) override; 67 mojo::Array<cc::ReturnedResource> resources) override;
73 68
74 ui::Window* window_; 69 ui::Window* window_;
75 std::unique_ptr<ui::WindowSurface> surface_; 70 std::unique_ptr<ui::WindowSurface> surface_;
76 // This may be null if there is an error contacting mus/initializing. We 71 // This may be null if there is an error contacting mus/initializing. We
77 // assume we'll be shutting down soon and do nothing in this case. 72 // assume we'll be shutting down soon and do nothing in this case.
78 std::unique_ptr<ui::GLES2Context> gles2_context_; 73 std::unique_ptr<ui::GLES2Context> gles2_context_;
79 74
80 uint32_t color_; 75 uint32_t color_;
81 int width_; 76 int width_;
82 int height_; 77 int height_;
83 Format format_; 78 Format format_;
84 std::unique_ptr<std::vector<unsigned char>> bitmap_; 79 std::unique_ptr<std::vector<unsigned char>> bitmap_;
85 uint32_t next_resource_id_; 80 uint32_t next_resource_id_;
86 uint32_t id_namespace_; 81 uint32_t id_namespace_;
87 base::hash_map<uint32_t, uint32_t> resource_to_texture_id_map_; 82 base::hash_map<uint32_t, uint32_t> resource_to_texture_id_map_;
88 83
89 DISALLOW_COPY_AND_ASSIGN(BitmapUploader); 84 DISALLOW_COPY_AND_ASSIGN(BitmapUploader);
90 }; 85 };
91 86
92 } // namespace bitmap_uploader 87 } // namespace ui
93 88
94 #endif // COMPONENTS_BITMAP_UPLOADER_BITMAP_UPLAODER_H_ 89 #endif // SERVICES_UI_PUBLIC_CPP_BITMAP_UPLOADER_H_
OLDNEW
« no previous file with comments | « services/ui/public/cpp/BUILD.gn ('k') | services/ui/public/cpp/lib/bitmap_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698