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

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: Set target type in from mailbox in skcanvas_video_renderer 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
« no previous file with comments | « cc/output/gl_renderer.cc ('k') | content/renderer/media/android/webmediaplayer_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 13 matching lines...) Expand all
24 #include "base/trace_event/trace_event.h" 24 #include "base/trace_event/trace_event.h"
25 #include "cc/resources/platform_color.h" 25 #include "cc/resources/platform_color.h"
26 #include "cc/resources/resource_util.h" 26 #include "cc/resources/resource_util.h"
27 #include "cc/resources/returned_resource.h" 27 #include "cc/resources/returned_resource.h"
28 #include "cc/resources/shared_bitmap_manager.h" 28 #include "cc/resources/shared_bitmap_manager.h"
29 #include "cc/resources/transferable_resource.h" 29 #include "cc/resources/transferable_resource.h"
30 #include "gpu/GLES2/gl2extchromium.h" 30 #include "gpu/GLES2/gl2extchromium.h"
31 #include "gpu/command_buffer/client/context_support.h" 31 #include "gpu/command_buffer/client/context_support.h"
32 #include "gpu/command_buffer/client/gles2_interface.h" 32 #include "gpu/command_buffer/client/gles2_interface.h"
33 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" 33 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
34 #include "skia/ext/texture_handle.h"
34 #include "third_party/khronos/GLES2/gl2.h" 35 #include "third_party/khronos/GLES2/gl2.h"
35 #include "third_party/khronos/GLES2/gl2ext.h" 36 #include "third_party/khronos/GLES2/gl2ext.h"
36 #include "third_party/skia/include/core/SkSurface.h" 37 #include "third_party/skia/include/core/SkSurface.h"
37 #include "third_party/skia/include/gpu/GrContext.h" 38 #include "third_party/skia/include/gpu/GrContext.h"
38 #include "third_party/skia/include/gpu/GrTextureProvider.h" 39 #include "third_party/skia/include/gpu/GrTextureProvider.h"
40 #include "third_party/skia/include/gpu/gl/GrGLTypes.h"
39 #include "ui/gfx/geometry/rect.h" 41 #include "ui/gfx/geometry/rect.h"
40 #include "ui/gfx/geometry/vector2d.h" 42 #include "ui/gfx/geometry/vector2d.h"
41 #include "ui/gl/trace_util.h" 43 #include "ui/gl/trace_util.h"
42 44
43 using gpu::gles2::GLES2Interface; 45 using gpu::gles2::GLES2Interface;
44 46
45 namespace cc { 47 namespace cc {
46 48
47 class IdAllocator { 49 class IdAllocator {
48 public: 50 public:
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 1104
1103 resource_provider_->UnlockForWrite(resource_); 1105 resource_provider_->UnlockForWrite(resource_);
1104 } 1106 }
1105 1107
1106 void ResourceProvider::ScopedWriteLockGr::InitSkSurface( 1108 void ResourceProvider::ScopedWriteLockGr::InitSkSurface(
1107 bool use_distance_field_text, 1109 bool use_distance_field_text,
1108 bool can_use_lcd_text, 1110 bool can_use_lcd_text,
1109 int msaa_sample_count) { 1111 int msaa_sample_count) {
1110 DCHECK(resource_->locked_for_write); 1112 DCHECK(resource_->locked_for_write);
1111 1113
1114 GrGLTextureInfo texture_info;
1115 texture_info.fID = resource_->gl_id;
1116 texture_info.fTarget = resource_->target;
1112 GrBackendTextureDesc desc; 1117 GrBackendTextureDesc desc;
1113 desc.fFlags = kRenderTarget_GrBackendTextureFlag; 1118 desc.fFlags = kRenderTarget_GrBackendTextureFlag;
1114 desc.fWidth = resource_->size.width(); 1119 desc.fWidth = resource_->size.width();
1115 desc.fHeight = resource_->size.height(); 1120 desc.fHeight = resource_->size.height();
1116 desc.fConfig = ToGrPixelConfig(resource_->format); 1121 desc.fConfig = ToGrPixelConfig(resource_->format);
1117 desc.fOrigin = kTopLeft_GrSurfaceOrigin; 1122 desc.fOrigin = kTopLeft_GrSurfaceOrigin;
1118 desc.fTextureHandle = resource_->gl_id; 1123 desc.fTextureHandle = skia::GrGLTextureInfoToGrBackendObject(texture_info);
1119 desc.fSampleCnt = msaa_sample_count; 1124 desc.fSampleCnt = msaa_sample_count;
1120 1125
1121 bool use_worker_context = true; 1126 bool use_worker_context = true;
1122 class GrContext* gr_context = 1127 class GrContext* gr_context =
1123 resource_provider_->GrContext(use_worker_context); 1128 resource_provider_->GrContext(use_worker_context);
1124 uint32_t flags = 1129 uint32_t flags =
1125 use_distance_field_text ? SkSurfaceProps::kUseDistanceFieldFonts_Flag : 0; 1130 use_distance_field_text ? SkSurfaceProps::kUseDistanceFieldFonts_Flag : 0;
1126 // Use unknown pixel geometry to disable LCD text. 1131 // Use unknown pixel geometry to disable LCD text.
1127 SkSurfaceProps surface_props(flags, kUnknown_SkPixelGeometry); 1132 SkSurfaceProps surface_props(flags, kUnknown_SkPixelGeometry);
1128 if (can_use_lcd_text) { 1133 if (can_use_lcd_text) {
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
1942 1947
1943 const int kImportance = 2; 1948 const int kImportance = 2;
1944 pmd->CreateSharedGlobalAllocatorDump(guid); 1949 pmd->CreateSharedGlobalAllocatorDump(guid);
1945 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); 1950 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
1946 } 1951 }
1947 1952
1948 return true; 1953 return true;
1949 } 1954 }
1950 1955
1951 } // namespace cc 1956 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/gl_renderer.cc ('k') | content/renderer/media/android/webmediaplayer_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698