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

Side by Side Diff: examples/ganesh_app/texture_uploader.h

Issue 1559723002: Update the UI examples. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-14
Patch Set: address feedback 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/ganesh_app/ganesh_view.cc ('k') | examples/ganesh_app/texture_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_GANESH_APP_TEXTURE_UPLOADER_H_
6 #define EXAMPLES_GANESH_APP_TEXTURE_UPLOADER_H_
7
8 #include "base/containers/hash_tables.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
11 #include "mojo/gpu/gl_context.h"
12 #include "mojo/gpu/gl_texture.h"
13 #include "mojo/public/cpp/bindings/binding.h"
14 #include "mojo/services/geometry/interfaces/geometry.mojom.h"
15 #include "mojo/services/surfaces/interfaces/surface_id.mojom.h"
16 #include "mojo/services/surfaces/interfaces/surfaces.mojom.h"
17
18 namespace mojo {
19 class Shell;
20 }
21
22 namespace examples {
23
24 class TextureUploader : public mojo::ResourceReturner,
25 public mojo::GLContext::Observer {
26 public:
27 class Client {
28 public:
29 virtual void OnSurfaceIdAvailable(mojo::SurfaceIdPtr surface_id) = 0;
30
31 protected:
32 virtual ~Client();
33 };
34
35 TextureUploader(Client* client,
36 mojo::Shell* shell,
37 base::WeakPtr<mojo::GLContext> context);
38 ~TextureUploader() override;
39
40 void Upload(scoped_ptr<mojo::GLTexture> texture);
41
42 private:
43 // mojo::GLContext::Observer
44 void OnContextLost() override;
45
46 // mojo::ResourceReturner
47 void ReturnResources(
48 mojo::Array<mojo::ReturnedResourcePtr> resources) override;
49
50 void SetIdNamespace(uint32_t id_namespace);
51 void EnsureSurfaceForSize(const mojo::Size& size);
52 void SendFullyQualifiedID();
53
54 Client* client_;
55 base::WeakPtr<mojo::GLContext> context_;
56 mojo::SurfacePtr surface_;
57 mojo::Size surface_size_;
58 uint32_t next_resource_id_;
59 uint32_t id_namespace_;
60 uint32_t local_id_;
61 base::hash_map<uint32_t, mojo::GLTexture*> resource_to_texture_map_;
62 mojo::Binding<mojo::ResourceReturner> returner_binding_;
63
64 DISALLOW_COPY_AND_ASSIGN(TextureUploader);
65 };
66
67 } // namespace examples
68
69 #endif // EXAMPLES_GANESH_APP_TEXTURE_UPLOADER_H_
OLDNEW
« no previous file with comments | « examples/ganesh_app/ganesh_view.cc ('k') | examples/ganesh_app/texture_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698