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

Unified Diff: services/gfx/compositor/render/render_image.h

Issue 1552963002: Initial checkin of the new Mozart compositor. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-11
Patch Set: fix android build Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/gfx/compositor/render/render_frame.cc ('k') | services/gfx/compositor/render/render_image.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/gfx/compositor/render/render_image.h
diff --git a/services/gfx/compositor/render/render_image.h b/services/gfx/compositor/render/render_image.h
new file mode 100644
index 0000000000000000000000000000000000000000..7cdbf16ad6a87ef7685ee6db9969956840328348
--- /dev/null
+++ b/services/gfx/compositor/render/render_image.h
@@ -0,0 +1,66 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SERVICES_GFX_COMPOSITOR_RENDER_RENDER_IMAGE_H_
+#define SERVICES_GFX_COMPOSITOR_RENDER_RENDER_IMAGE_H_
+
+#include <memory>
+
+#include <GLES2/gl2.h>
+#include <GLES2/gl2extmojo.h>
+
+#include "base/callback.h"
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/task_runner.h"
+#include "skia/ext/refptr.h"
+#include "third_party/skia/include/core/SkImage.h"
+
+namespace compositor {
+
+// Describes an image which can be rendered by the compositor.
+//
+// Render objects are thread-safe, immutable, and reference counted via
+// std::shared_ptr. They have no direct references to the scene graph.
+//
+// TODO(jeffbrown): Generalize this beyond mailbox textures.
+class RenderImage {
+ class Releaser;
+ class Generator;
+
+ public:
+ RenderImage(const skia::RefPtr<SkImage>& image,
+ const std::shared_ptr<Releaser>& releaser);
+ ~RenderImage();
+
+ // Creates a new image backed by a mailbox texture.
+ // If |sync_point| is non-zero, inserts a sync point into the command stream
+ // before the image is first drawn.
+ // When the last reference is released, the associated release task is
+ // posted to the task runner. Returns nullptr if the mailbox texture
+ // is invalid.
+ static std::shared_ptr<RenderImage> CreateFromMailboxTexture(
+ const GLbyte mailbox_name[GL_MAILBOX_SIZE_CHROMIUM],
+ GLuint sync_point,
+ uint32_t width,
+ uint32_t height,
+ const scoped_refptr<base::TaskRunner>& task_runner,
+ const base::Closure& release_task);
+
+ uint32_t width() const { return image_->width(); }
+ uint32_t height() const { return image_->height(); }
+
+ // Gets the underlying image to rasterize.
+ const skia::RefPtr<SkImage>& image() const { return image_; }
+
+ private:
+ skia::RefPtr<SkImage> image_;
+ std::shared_ptr<Releaser> releaser_;
+
+ DISALLOW_COPY_AND_ASSIGN(RenderImage);
+};
+
+} // namespace compositor
+
+#endif // SERVICES_GFX_COMPOSITOR_RENDER_RENDER_IMAGE_H_
« no previous file with comments | « services/gfx/compositor/render/render_frame.cc ('k') | services/gfx/compositor/render/render_image.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698