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

Side by Side Diff: mojo/skia/ganesh_image_factory.h

Issue 1776643004: Mozart: Specify texture origin explicitly. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-3
Patch Set: Created 4 years, 9 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 MOJO_SKIA_GANESH_IMAGE_FACTORY_H_ 5 #ifndef MOJO_SKIA_GANESH_IMAGE_FACTORY_H_
6 #define MOJO_SKIA_GANESH_IMAGE_FACTORY_H_ 6 #define MOJO_SKIA_GANESH_IMAGE_FACTORY_H_
7 7
8 #include <GLES2/gl2.h> 8 #include <GLES2/gl2.h>
9 #include <GLES2/gl2extmojo.h> 9 #include <GLES2/gl2extmojo.h>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "mojo/skia/ganesh_context.h" 12 #include "mojo/skia/ganesh_context.h"
13 #include "skia/ext/refptr.h" 13 #include "skia/ext/refptr.h"
14 #include "third_party/skia/include/core/SkImageGenerator.h" 14 #include "third_party/skia/include/core/SkImageGenerator.h"
15 #include "third_party/skia/include/gpu/GrTypes.h"
15 16
16 class SkImage; 17 class SkImage;
17 18
18 namespace mojo { 19 namespace mojo {
19 namespace skia { 20 namespace skia {
20 21
21 // Creates an SkImage from a GL texture. 22 // Creates an SkImage from a GL texture.
22 // The underlying texture must be kept alive for as long as the SkImage exists. 23 // The underlying texture must be kept alive for as long as the SkImage exists.
23 // Invokes |release_callback| when the SkImage is deleted. 24 // Invokes |release_callback| when the SkImage is deleted.
24 ::skia::RefPtr<SkImage> CreateImageFromTexture( 25 ::skia::RefPtr<SkImage> CreateImageFromTexture(
25 const GaneshContext::Scope& scope, 26 const GaneshContext::Scope& scope,
26 uint32_t texture_id, 27 uint32_t texture_id,
27 uint32_t width, 28 uint32_t width,
28 uint32_t height, 29 uint32_t height,
30 GrSurfaceOrigin origin,
29 const base::Closure& release_callback); 31 const base::Closure& release_callback);
30 32
31 // Generates backing content for SkImages from a texture mailbox. 33 // Generates backing content for SkImages from a texture mailbox.
32 // If |sync_point| is non-zero, inserts a sync point into the command stream 34 // If |sync_point| is non-zero, inserts a sync point into the command stream
33 // before the image is first drawn. 35 // before the image is first drawn.
34 // It is the responsibility of the client of this class to ensure that 36 // It is the responsibility of the client of this class to ensure that
35 // the mailbox name is valid at the time when the image is being drawn. 37 // the mailbox name is valid at the time when the image is being drawn.
36 class MailboxTextureImageGenerator : public SkImageGenerator { 38 class MailboxTextureImageGenerator : public SkImageGenerator {
37 public: 39 public:
38 MailboxTextureImageGenerator( 40 MailboxTextureImageGenerator(
39 const GLbyte mailbox_name[GL_MAILBOX_SIZE_CHROMIUM], 41 const GLbyte mailbox_name[GL_MAILBOX_SIZE_CHROMIUM],
40 GLuint sync_point, 42 GLuint sync_point,
41 uint32_t width, 43 uint32_t width,
42 uint32_t height); 44 uint32_t height,
45 GrSurfaceOrigin origin);
43 ~MailboxTextureImageGenerator() override; 46 ~MailboxTextureImageGenerator() override;
44 47
45 GrTexture* onGenerateTexture(GrContext* context, 48 GrTexture* onGenerateTexture(GrContext* context,
46 const SkIRect* subset) override; 49 const SkIRect* subset) override;
47 50
48 private: 51 private:
49 GLbyte mailbox_name_[GL_MAILBOX_SIZE_CHROMIUM]; 52 GLbyte mailbox_name_[GL_MAILBOX_SIZE_CHROMIUM];
50 GLuint sync_point_; 53 GLuint sync_point_;
54 GrSurfaceOrigin origin_;
51 }; 55 };
52 56
53 } // namespace skia 57 } // namespace skia
54 } // namespace mojo 58 } // namespace mojo
55 59
56 #endif // MOJO_SKIA_GANESH_IMAGE_FACTORY_H_ 60 #endif // MOJO_SKIA_GANESH_IMAGE_FACTORY_H_
OLDNEW
« no previous file with comments | « mojo/services/gfx/composition/interfaces/resources.mojom ('k') | mojo/skia/ganesh_image_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698