OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "cc/resources/resource_provider.h" | 5 #include "cc/resources/resource_provider.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 resource_provider_->GrContext(use_worker_context); | 990 resource_provider_->GrContext(use_worker_context); |
991 uint32_t flags = | 991 uint32_t flags = |
992 use_distance_field_text ? SkSurfaceProps::kUseDistanceFieldFonts_Flag : 0; | 992 use_distance_field_text ? SkSurfaceProps::kUseDistanceFieldFonts_Flag : 0; |
993 // Use unknown pixel geometry to disable LCD text. | 993 // Use unknown pixel geometry to disable LCD text. |
994 SkSurfaceProps surface_props(flags, kUnknown_SkPixelGeometry); | 994 SkSurfaceProps surface_props(flags, kUnknown_SkPixelGeometry); |
995 if (can_use_lcd_text) { | 995 if (can_use_lcd_text) { |
996 // LegacyFontHost will get LCD text and skia figures out what type to use. | 996 // LegacyFontHost will get LCD text and skia figures out what type to use. |
997 surface_props = | 997 surface_props = |
998 SkSurfaceProps(flags, SkSurfaceProps::kLegacyFontHost_InitType); | 998 SkSurfaceProps(flags, SkSurfaceProps::kLegacyFontHost_InitType); |
999 } | 999 } |
1000 sk_surface_ = skia::AdoptRef( | 1000 gr_surface_ = |
1001 SkSurface::NewWrappedRenderTarget(gr_context, desc, &surface_props)); | 1001 skia::AdoptRef(gr_context->textureProvider()->wrapBackendTexture( |
| 1002 desc, kBorrow_GrWrapOwnership)); |
| 1003 if (gr_surface_) |
| 1004 sk_surface_ = skia::AdoptRef(SkSurface::NewRenderTargetDirect( |
| 1005 gr_surface_->asRenderTarget(), &surface_props)); |
1002 } | 1006 } |
1003 | 1007 |
1004 void ResourceProvider::ScopedWriteLockGr::ReleaseSkSurface() { | 1008 void ResourceProvider::ScopedWriteLockGr::ReleaseSkSurface() { |
| 1009 DCHECK(gr_surface_); |
| 1010 gr_surface_->prepareForExternalIO(); |
| 1011 gr_surface_.clear(); |
1005 sk_surface_.clear(); | 1012 sk_surface_.clear(); |
1006 } | 1013 } |
1007 | 1014 |
1008 ResourceProvider::SynchronousFence::SynchronousFence( | 1015 ResourceProvider::SynchronousFence::SynchronousFence( |
1009 gpu::gles2::GLES2Interface* gl) | 1016 gpu::gles2::GLES2Interface* gl) |
1010 : gl_(gl), has_synchronized_(true) { | 1017 : gl_(gl), has_synchronized_(true) { |
1011 } | 1018 } |
1012 | 1019 |
1013 ResourceProvider::SynchronousFence::~SynchronousFence() { | 1020 ResourceProvider::SynchronousFence::~SynchronousFence() { |
1014 } | 1021 } |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1788 | 1795 |
1789 const int kImportance = 2; | 1796 const int kImportance = 2; |
1790 pmd->CreateSharedGlobalAllocatorDump(guid); | 1797 pmd->CreateSharedGlobalAllocatorDump(guid); |
1791 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | 1798 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
1792 } | 1799 } |
1793 | 1800 |
1794 return true; | 1801 return true; |
1795 } | 1802 } |
1796 | 1803 |
1797 } // namespace cc | 1804 } // namespace cc |
OLD | NEW |