OLD | NEW |
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_GFX_COMPOSITOR_RENDER_RENDER_IMAGE_H_ | 5 #ifndef SERVICES_GFX_COMPOSITOR_RENDER_RENDER_IMAGE_H_ |
6 #define SERVICES_GFX_COMPOSITOR_RENDER_RENDER_IMAGE_H_ | 6 #define SERVICES_GFX_COMPOSITOR_RENDER_RENDER_IMAGE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include <GLES2/gl2.h> | 10 #include <GLES2/gl2.h> |
11 #include <GLES2/gl2extmojo.h> | 11 #include <GLES2/gl2extmojo.h> |
12 | 12 |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/task_runner.h" | 16 #include "base/task_runner.h" |
| 17 #include "mojo/services/gfx/composition/interfaces/resources.mojom.h" |
17 #include "skia/ext/refptr.h" | 18 #include "skia/ext/refptr.h" |
18 #include "third_party/skia/include/core/SkImage.h" | 19 #include "third_party/skia/include/core/SkImage.h" |
19 | 20 |
20 namespace compositor { | 21 namespace compositor { |
21 | 22 |
22 // Describes an image which can be rendered by the compositor. | 23 // Describes an image which can be rendered by the compositor. |
23 // | 24 // |
24 // Render objects are thread-safe, immutable, and reference counted via | 25 // Render objects are thread-safe, immutable, and reference counted via |
25 // std::shared_ptr. They have no direct references to the scene graph. | 26 // std::shared_ptr. They have no direct references to the scene graph. |
26 // | 27 // |
(...skipping 11 matching lines...) Expand all Loading... |
38 // If |sync_point| is non-zero, inserts a sync point into the command stream | 39 // If |sync_point| is non-zero, inserts a sync point into the command stream |
39 // before the image is first drawn. | 40 // before the image is first drawn. |
40 // When the last reference is released, the associated release task is | 41 // When the last reference is released, the associated release task is |
41 // posted to the task runner. Returns nullptr if the mailbox texture | 42 // posted to the task runner. Returns nullptr if the mailbox texture |
42 // is invalid. | 43 // is invalid. |
43 static std::shared_ptr<RenderImage> CreateFromMailboxTexture( | 44 static std::shared_ptr<RenderImage> CreateFromMailboxTexture( |
44 const GLbyte mailbox_name[GL_MAILBOX_SIZE_CHROMIUM], | 45 const GLbyte mailbox_name[GL_MAILBOX_SIZE_CHROMIUM], |
45 GLuint sync_point, | 46 GLuint sync_point, |
46 uint32_t width, | 47 uint32_t width, |
47 uint32_t height, | 48 uint32_t height, |
| 49 mojo::gfx::composition::MailboxTextureResource::Origin origin, |
48 const scoped_refptr<base::TaskRunner>& task_runner, | 50 const scoped_refptr<base::TaskRunner>& task_runner, |
49 const base::Closure& release_task); | 51 const base::Closure& release_task); |
50 | 52 |
51 uint32_t width() const { return image_->width(); } | 53 uint32_t width() const { return image_->width(); } |
52 uint32_t height() const { return image_->height(); } | 54 uint32_t height() const { return image_->height(); } |
53 | 55 |
54 // Gets the underlying image to rasterize, never null. | 56 // Gets the underlying image to rasterize, never null. |
55 const skia::RefPtr<SkImage>& image() const { return image_; } | 57 const skia::RefPtr<SkImage>& image() const { return image_; } |
56 | 58 |
57 private: | 59 private: |
58 skia::RefPtr<SkImage> image_; | 60 skia::RefPtr<SkImage> image_; |
59 std::shared_ptr<Releaser> releaser_; | 61 std::shared_ptr<Releaser> releaser_; |
60 | 62 |
61 DISALLOW_COPY_AND_ASSIGN(RenderImage); | 63 DISALLOW_COPY_AND_ASSIGN(RenderImage); |
62 }; | 64 }; |
63 | 65 |
64 } // namespace compositor | 66 } // namespace compositor |
65 | 67 |
66 #endif // SERVICES_GFX_COMPOSITOR_RENDER_RENDER_IMAGE_H_ | 68 #endif // SERVICES_GFX_COMPOSITOR_RENDER_RENDER_IMAGE_H_ |
OLD | NEW |