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

Side by Side Diff: examples/bitmap_uploader/bitmap_uploader.h

Issue 1536863002: Delete the Surfaces service. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-4
Patch Set: rebase Created 4 years, 10 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 | « examples/bitmap_uploader/BUILD.gn ('k') | examples/bitmap_uploader/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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef EXAMPLES_BITMAP_UPLOADER_BITMAP_UPLOADER_H_
6 #define EXAMPLES_BITMAP_UPLOADER_BITMAP_UPLOADER_H_
7
8 #include <MGL/mgl_types.h>
9
10 #include "base/callback.h"
11 #include "base/containers/hash_tables.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "mojo/public/cpp/bindings/binding.h"
14 #include "mojo/services/geometry/interfaces/geometry.mojom.h"
15 #include "mojo/services/gpu/interfaces/gpu.mojom.h"
16 #include "mojo/services/surfaces/interfaces/surface_id.mojom.h"
17 #include "mojo/services/surfaces/interfaces/surfaces.mojom.h"
18
19 namespace mojo {
20 class Shell;
21 class View;
22
23 // BitmapUploader is useful if you want to draw a bitmap or color in a View.
24 class BitmapUploader : public ResourceReturner {
25 public:
26 explicit BitmapUploader(View* view);
27 ~BitmapUploader() override;
28
29 void Init(Shell* shell);
30
31 // Sets the color which is RGBA.
32 void SetColor(uint32_t color);
33
34 enum Format {
35 RGBA, // Pixel layout on Android.
36 BGRA, // Pixel layout everywhere else.
37 };
38
39 // Sets a bitmap.
40 void SetBitmap(int width,
41 int height,
42 scoped_ptr<std::vector<unsigned char>> data,
43 Format format);
44
45 private:
46 void Upload();
47 uint32_t BindTextureForSize(const Size size);
48 uint32_t TextureFormat();
49
50 void SetIdNamespace(uint32_t id_namespace);
51
52 // ResourceReturner implementation.
53 void ReturnResources(Array<ReturnedResourcePtr> resources) override;
54
55 View* view_;
56 GpuPtr gpu_service_;
57 MGLContext mgl_context_;
58
59 Size size_;
60 uint32_t color_;
61 int width_;
62 int height_;
63 Format format_;
64 scoped_ptr<std::vector<unsigned char>> bitmap_;
65 SurfacePtr surface_;
66 Size surface_size_;
67 uint32_t next_resource_id_;
68 uint32_t id_namespace_;
69 uint32_t local_id_;
70 base::hash_map<uint32_t, uint32_t> resource_to_texture_id_map_;
71 mojo::Binding<mojo::ResourceReturner> returner_binding_;
72
73 DISALLOW_COPY_AND_ASSIGN(BitmapUploader);
74 };
75
76 } // namespace mojo
77
78 #endif // EXAMPLES_BITMAP_UPLOADER_BITMAP_UPLOADER_H_
OLDNEW
« no previous file with comments | « examples/bitmap_uploader/BUILD.gn ('k') | examples/bitmap_uploader/bitmap_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698