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

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

Issue 684543003: Move //mojo/examples to //examples (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « mojo/examples/bitmap_uploader/DEPS ('k') | mojo/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 MOJO_EXAMPLES_BITMAP_UPLOADER_BITMAP_UPLOADER_H_
6 #define MOJO_EXAMPLES_BITMAP_UPLOADER_BITMAP_UPLOADER_H_
7
8 #include "base/callback.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
11 #include "cc/surfaces/surface_id.h"
12 #include "mojo/public/c/gles2/gles2.h"
13 #include "mojo/services/public/interfaces/gpu/gpu.mojom.h"
14 #include "mojo/services/public/interfaces/surfaces/surfaces.mojom.h"
15 #include "mojo/services/public/interfaces/surfaces/surfaces_service.mojom.h"
16 #include "third_party/skia/include/core/SkBitmap.h"
17 #include "ui/gfx/geometry/size.h"
18
19 namespace cc {
20 class SurfaceIdAllocator;
21 }
22
23 namespace mojo {
24 class Shell;
25 class View;
26
27 // BitmapUploader is useful if you want to draw a bitmap or color in a View.
28 class BitmapUploader : public SurfaceClient {
29 public:
30 explicit BitmapUploader(View* view);
31 virtual ~BitmapUploader();
32
33 void Init(Shell* shell);
34
35 void SetColor(SkColor color);
36 void SetBitmap(const SkBitmap& bitmap);
37
38 private:
39 void Upload();
40 void OnSurfaceConnectionCreated(SurfacePtr surface, uint32_t id_namespace);
41 uint32_t BindTextureForSize(const gfx::Size size);
42
43 // SurfaceClient implementation.
44 virtual void ReturnResources(Array<ReturnedResourcePtr> resources) override;
45
46 View* view_;
47 SurfacesServicePtr surfaces_service_;
48 GpuPtr gpu_service_;
49 MojoGLES2Context gles2_context_;
50
51 gfx::Size size_;
52 SkColor color_;
53 SkBitmap bitmap_;
54 SurfacePtr surface_;
55 cc::SurfaceId id_;
56 scoped_ptr<cc::SurfaceIdAllocator> id_allocator_;
57 gfx::Size surface_size_;
58 uint32_t next_resource_id_;
59 base::hash_map<uint32_t, uint32_t> resource_to_texture_id_map_;
60
61 base::WeakPtrFactory<BitmapUploader> weak_factory_;
62
63 DISALLOW_COPY_AND_ASSIGN(BitmapUploader);
64 };
65
66 } // namespace mojo
67
68 #endif // MOJO_EXAMPLES_BITMAP_UPLOADER_BITMAP_UPLOADER_H_
OLDNEW
« no previous file with comments | « mojo/examples/bitmap_uploader/DEPS ('k') | mojo/examples/bitmap_uploader/bitmap_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698