| OLD | NEW |
| 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 GL_GLEXT_PROTOTYPES | 5 #ifndef GL_GLEXT_PROTOTYPES |
| 6 #define GL_GLEXT_PROTOTYPES | 6 #define GL_GLEXT_PROTOTYPES |
| 7 #endif | 7 #endif |
| 8 | 8 |
| 9 #include "mojo/skia/ganesh_image_factory.h" | 9 #include "mojo/skia/ganesh_image_factory.h" |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 DCHECK(texture_id); | 34 DCHECK(texture_id); |
| 35 DCHECK(width); | 35 DCHECK(width); |
| 36 DCHECK(height); | 36 DCHECK(height); |
| 37 | 37 |
| 38 // TODO(jeffbrown): Give the caller more control over these parameters. | 38 // TODO(jeffbrown): Give the caller more control over these parameters. |
| 39 GrGLTextureInfo info; | 39 GrGLTextureInfo info; |
| 40 info.fTarget = GL_TEXTURE_2D; | 40 info.fTarget = GL_TEXTURE_2D; |
| 41 info.fID = texture_id; | 41 info.fID = texture_id; |
| 42 | 42 |
| 43 GrBackendTextureDesc desc; | 43 GrBackendTextureDesc desc; |
| 44 desc.fFlags = kRenderTarget_GrBackendTextureFlag; | 44 desc.fFlags = kNone_GrBackendTextureFlag; |
| 45 desc.fWidth = width; | 45 desc.fWidth = width; |
| 46 desc.fHeight = height; | 46 desc.fHeight = height; |
| 47 desc.fConfig = kSkia8888_GrPixelConfig; | 47 desc.fConfig = kSkia8888_GrPixelConfig; |
| 48 desc.fOrigin = origin; | 48 desc.fOrigin = origin; |
| 49 desc.fTextureHandle = reinterpret_cast<GrBackendObject>(&info); | 49 desc.fTextureHandle = reinterpret_cast<GrBackendObject>(&info); |
| 50 return ::skia::AdoptRef(SkImage::NewFromTexture( | 50 return ::skia::AdoptRef(SkImage::NewFromTexture( |
| 51 scope.gr_context().get(), desc, kPremul_SkAlphaType, &ReleaseThunk, | 51 scope.gr_context().get(), desc, kPremul_SkAlphaType, &ReleaseThunk, |
| 52 new base::Closure(release_callback))); | 52 new base::Closure(release_callback))); |
| 53 } | 53 } |
| 54 | 54 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 77 glCreateAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox_name_); | 77 glCreateAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox_name_); |
| 78 if (!texture_id) | 78 if (!texture_id) |
| 79 return nullptr; | 79 return nullptr; |
| 80 | 80 |
| 81 // TODO(jeffbrown): Give the caller more control over these parameters. | 81 // TODO(jeffbrown): Give the caller more control over these parameters. |
| 82 GrGLTextureInfo info; | 82 GrGLTextureInfo info; |
| 83 info.fTarget = GL_TEXTURE_2D; | 83 info.fTarget = GL_TEXTURE_2D; |
| 84 info.fID = texture_id; | 84 info.fID = texture_id; |
| 85 | 85 |
| 86 GrBackendTextureDesc desc; | 86 GrBackendTextureDesc desc; |
| 87 desc.fFlags = kRenderTarget_GrBackendTextureFlag; | 87 desc.fFlags = kNone_GrBackendTextureFlag; |
| 88 desc.fWidth = getInfo().width(); | 88 desc.fWidth = getInfo().width(); |
| 89 desc.fHeight = getInfo().height(); | 89 desc.fHeight = getInfo().height(); |
| 90 desc.fConfig = kSkia8888_GrPixelConfig; | 90 desc.fConfig = kSkia8888_GrPixelConfig; |
| 91 desc.fOrigin = origin_; | 91 desc.fOrigin = origin_; |
| 92 desc.fTextureHandle = reinterpret_cast<GrBackendObject>(&info); | 92 desc.fTextureHandle = reinterpret_cast<GrBackendObject>(&info); |
| 93 return context->textureProvider()->wrapBackendTexture(desc, | 93 return context->textureProvider()->wrapBackendTexture(desc, |
| 94 kAdopt_GrWrapOwnership); | 94 kAdopt_GrWrapOwnership); |
| 95 } | 95 } |
| 96 | 96 |
| 97 } // namespace skia | 97 } // namespace skia |
| 98 } // namespace mojo | 98 } // namespace mojo |
| OLD | NEW |