OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "mojo/skia/ganesh_texture_surface.h" | 5 #include "mojo/skia/ganesh_texture_surface.h" |
6 | 6 |
7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "mojo/gpu/gl_texture.h" | 10 #include "mojo/gpu/gl_texture.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 GrBackendTextureDesc desc; | 28 GrBackendTextureDesc desc; |
29 desc.fFlags = kRenderTarget_GrBackendTextureFlag; | 29 desc.fFlags = kRenderTarget_GrBackendTextureFlag; |
30 desc.fOrigin = kTopLeft_GrSurfaceOrigin; | 30 desc.fOrigin = kTopLeft_GrSurfaceOrigin; |
31 desc.fWidth = texture_->size().width; | 31 desc.fWidth = texture_->size().width; |
32 desc.fHeight = texture_->size().height; | 32 desc.fHeight = texture_->size().height; |
33 desc.fConfig = kSkia8888_GrPixelConfig; | 33 desc.fConfig = kSkia8888_GrPixelConfig; |
34 desc.fSampleCnt = 0; | 34 desc.fSampleCnt = 0; |
35 desc.fTextureHandle = reinterpret_cast<GrBackendObject>(&info); | 35 desc.fTextureHandle = reinterpret_cast<GrBackendObject>(&info); |
36 | 36 |
37 surface_ = ::skia::AdoptRef(SkSurface::NewFromBackendTexture( | 37 surface_ = SkSurface::MakeFromBackendTexture(scope.gr_context().get(), desc, |
38 scope.gr_context().get(), desc, nullptr)); | 38 nullptr); |
39 DCHECK(surface_); | 39 DCHECK(surface_); |
40 } | 40 } |
41 | 41 |
42 GaneshTextureSurface::~GaneshTextureSurface() {} | 42 GaneshTextureSurface::~GaneshTextureSurface() {} |
43 | 43 |
44 std::unique_ptr<GLTexture> GaneshTextureSurface::TakeTexture() { | 44 std::unique_ptr<GLTexture> GaneshTextureSurface::TakeTexture() { |
45 surface_->getCanvas()->flush(); | 45 surface_->getCanvas()->flush(); |
46 surface_.clear(); | 46 surface_.reset(); |
47 return std::move(texture_); | 47 return std::move(texture_); |
48 } | 48 } |
49 | 49 |
50 } // namespace skia | 50 } // namespace skia |
51 } // namespace mojo | 51 } // namespace mojo |
OLD | NEW |