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

Side by Side Diff: cc/resources/resource_provider.cc

Issue 1508903002: Use GrGLTextureInfo for Skia texture handles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ignore_gl_target
Patch Set: Address dcastagna's comments Created 5 years 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 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 <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/atomic_sequence_num.h" 10 #include "base/atomic_sequence_num.h"
(...skipping 14 matching lines...) Expand all
25 #include "cc/resources/transferable_resource.h" 25 #include "cc/resources/transferable_resource.h"
26 #include "gpu/GLES2/gl2extchromium.h" 26 #include "gpu/GLES2/gl2extchromium.h"
27 #include "gpu/command_buffer/client/context_support.h" 27 #include "gpu/command_buffer/client/context_support.h"
28 #include "gpu/command_buffer/client/gles2_interface.h" 28 #include "gpu/command_buffer/client/gles2_interface.h"
29 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" 29 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
30 #include "third_party/khronos/GLES2/gl2.h" 30 #include "third_party/khronos/GLES2/gl2.h"
31 #include "third_party/khronos/GLES2/gl2ext.h" 31 #include "third_party/khronos/GLES2/gl2ext.h"
32 #include "third_party/skia/include/core/SkSurface.h" 32 #include "third_party/skia/include/core/SkSurface.h"
33 #include "third_party/skia/include/gpu/GrContext.h" 33 #include "third_party/skia/include/gpu/GrContext.h"
34 #include "third_party/skia/include/gpu/GrTextureProvider.h" 34 #include "third_party/skia/include/gpu/GrTextureProvider.h"
35 #include "third_party/skia/include/gpu/gl/GrGLTypes.h"
35 #include "ui/gfx/geometry/rect.h" 36 #include "ui/gfx/geometry/rect.h"
36 #include "ui/gfx/geometry/vector2d.h" 37 #include "ui/gfx/geometry/vector2d.h"
37 #include "ui/gl/trace_util.h" 38 #include "ui/gl/trace_util.h"
38 39
39 using gpu::gles2::GLES2Interface; 40 using gpu::gles2::GLES2Interface;
40 41
41 namespace cc { 42 namespace cc {
42 43
43 class IdAllocator { 44 class IdAllocator {
44 public: 45 public:
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 DCHECK(resource_->locked_for_write); 953 DCHECK(resource_->locked_for_write);
953 resource_provider_->UnlockForWrite(resource_); 954 resource_provider_->UnlockForWrite(resource_);
954 } 955 }
955 956
956 void ResourceProvider::ScopedWriteLockGr::InitSkSurface( 957 void ResourceProvider::ScopedWriteLockGr::InitSkSurface(
957 bool use_distance_field_text, 958 bool use_distance_field_text,
958 bool can_use_lcd_text, 959 bool can_use_lcd_text,
959 int msaa_sample_count) { 960 int msaa_sample_count) {
960 DCHECK(resource_->locked_for_write); 961 DCHECK(resource_->locked_for_write);
961 962
963 GrGLTextureInfo texture_info;
964 texture_info.fID = resource_->gl_id;
965 texture_info.fTarget = resource_->target;
962 GrBackendTextureDesc desc; 966 GrBackendTextureDesc desc;
963 desc.fFlags = kRenderTarget_GrBackendTextureFlag; 967 desc.fFlags = kRenderTarget_GrBackendTextureFlag;
964 desc.fWidth = resource_->size.width(); 968 desc.fWidth = resource_->size.width();
965 desc.fHeight = resource_->size.height(); 969 desc.fHeight = resource_->size.height();
966 desc.fConfig = ToGrPixelConfig(resource_->format); 970 desc.fConfig = ToGrPixelConfig(resource_->format);
967 desc.fOrigin = kTopLeft_GrSurfaceOrigin; 971 desc.fOrigin = kTopLeft_GrSurfaceOrigin;
968 desc.fTextureHandle = resource_->gl_id; 972 desc.fTextureHandle = reinterpret_cast<GrBackendObject>(&texture_info);
969 desc.fSampleCnt = msaa_sample_count; 973 desc.fSampleCnt = msaa_sample_count;
970 974
971 bool use_worker_context = true; 975 bool use_worker_context = true;
972 class GrContext* gr_context = 976 class GrContext* gr_context =
973 resource_provider_->GrContext(use_worker_context); 977 resource_provider_->GrContext(use_worker_context);
974 uint32_t flags = 978 uint32_t flags =
975 use_distance_field_text ? SkSurfaceProps::kUseDistanceFieldFonts_Flag : 0; 979 use_distance_field_text ? SkSurfaceProps::kUseDistanceFieldFonts_Flag : 0;
976 // Use unknown pixel geometry to disable LCD text. 980 // Use unknown pixel geometry to disable LCD text.
977 SkSurfaceProps surface_props(flags, kUnknown_SkPixelGeometry); 981 SkSurfaceProps surface_props(flags, kUnknown_SkPixelGeometry);
978 if (can_use_lcd_text) { 982 if (can_use_lcd_text) {
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
1688 const int kImportance = 2; 1692 const int kImportance = 2;
1689 pmd->CreateSharedGlobalAllocatorDump(guid); 1693 pmd->CreateSharedGlobalAllocatorDump(guid);
1690 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); 1694 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
1691 } 1695 }
1692 } 1696 }
1693 1697
1694 return true; 1698 return true;
1695 } 1699 }
1696 1700
1697 } // namespace cc 1701 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698