| Index: mojo/skia/ganesh_image_factory.h
|
| diff --git a/mojo/skia/ganesh_image_factory.h b/mojo/skia/ganesh_image_factory.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ae4bfc037b1c5c5585ed396ef640b3d22c8049a4
|
| --- /dev/null
|
| +++ b/mojo/skia/ganesh_image_factory.h
|
| @@ -0,0 +1,56 @@
|
| +// Copyright 2016 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 MOJO_SKIA_GANESH_IMAGE_FACTORY_H_
|
| +#define MOJO_SKIA_GANESH_IMAGE_FACTORY_H_
|
| +
|
| +#include <GLES2/gl2.h>
|
| +#include <GLES2/gl2extmojo.h>
|
| +
|
| +#include "base/callback.h"
|
| +#include "mojo/skia/ganesh_context.h"
|
| +#include "skia/ext/refptr.h"
|
| +#include "third_party/skia/include/core/SkImageGenerator.h"
|
| +
|
| +class SkImage;
|
| +
|
| +namespace mojo {
|
| +namespace skia {
|
| +
|
| +// Creates an SkImage from a GL texture.
|
| +// The underlying texture must be kept alive for as long as the SkImage exists.
|
| +// Invokes |release_callback| when the SkImage is deleted.
|
| +::skia::RefPtr<SkImage> CreateImageFromTexture(
|
| + const GaneshContext::Scope& scope,
|
| + uint32_t texture_id,
|
| + uint32_t width,
|
| + uint32_t height,
|
| + const base::Closure& release_callback);
|
| +
|
| +// Generates backing content for SkImages from a texture mailbox.
|
| +// If |sync_point| is non-zero, inserts a sync point into the command stream
|
| +// before the image is first drawn.
|
| +// It is the responsibility of the client of this class to ensure that
|
| +// the mailbox name is valid at the time when the image is being drawn.
|
| +class MailboxTextureImageGenerator : public SkImageGenerator {
|
| + public:
|
| + MailboxTextureImageGenerator(
|
| + const GLbyte mailbox_name[GL_MAILBOX_SIZE_CHROMIUM],
|
| + GLuint sync_point,
|
| + uint32_t width,
|
| + uint32_t height);
|
| + ~MailboxTextureImageGenerator() override;
|
| +
|
| + GrTexture* onGenerateTexture(GrContext* context,
|
| + const SkIRect* subset) override;
|
| +
|
| + private:
|
| + GLbyte mailbox_name_[GL_MAILBOX_SIZE_CHROMIUM];
|
| + GLuint sync_point_;
|
| +};
|
| +
|
| +} // namespace skia
|
| +} // namespace mojo
|
| +
|
| +#endif // MOJO_SKIA_GANESH_IMAGE_FACTORY_H_
|
|
|