| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1140 desc.fWidth = resource_->size.width(); | 1140 desc.fWidth = resource_->size.width(); |
| 1141 desc.fHeight = resource_->size.height(); | 1141 desc.fHeight = resource_->size.height(); |
| 1142 desc.fConfig = ToGrPixelConfig(resource_->format); | 1142 desc.fConfig = ToGrPixelConfig(resource_->format); |
| 1143 desc.fOrigin = kTopLeft_GrSurfaceOrigin; | 1143 desc.fOrigin = kTopLeft_GrSurfaceOrigin; |
| 1144 desc.fTextureHandle = resource_->gl_id; | 1144 desc.fTextureHandle = resource_->gl_id; |
| 1145 desc.fSampleCnt = msaa_sample_count; | 1145 desc.fSampleCnt = msaa_sample_count; |
| 1146 | 1146 |
| 1147 class GrContext* gr_context = | 1147 class GrContext* gr_context = |
| 1148 resource_provider_->GrContext(use_worker_context); | 1148 resource_provider_->GrContext(use_worker_context); |
| 1149 skia::RefPtr<GrTexture> gr_texture = | 1149 skia::RefPtr<GrTexture> gr_texture = |
| 1150 skia::AdoptRef(gr_context->wrapBackendTexture(desc)); | 1150 skia::AdoptRef(gr_context->textureProvider()->wrapBackendTexture(desc)); |
| 1151 if (gr_texture) { | 1151 if (gr_texture) { |
| 1152 uint32_t flags = use_distance_field_text | 1152 uint32_t flags = use_distance_field_text |
| 1153 ? SkSurfaceProps::kUseDistanceFieldFonts_Flag | 1153 ? SkSurfaceProps::kUseDistanceFieldFonts_Flag |
| 1154 : 0; | 1154 : 0; |
| 1155 // Use unknown pixel geometry to disable LCD text. | 1155 // Use unknown pixel geometry to disable LCD text. |
| 1156 SkSurfaceProps surface_props(flags, kUnknown_SkPixelGeometry); | 1156 SkSurfaceProps surface_props(flags, kUnknown_SkPixelGeometry); |
| 1157 if (can_use_lcd_text) { | 1157 if (can_use_lcd_text) { |
| 1158 // LegacyFontHost will get LCD text and skia figures out what type to use. | 1158 // LegacyFontHost will get LCD text and skia figures out what type to use. |
| 1159 surface_props = | 1159 surface_props = |
| 1160 SkSurfaceProps(flags, SkSurfaceProps::kLegacyFontHost_InitType); | 1160 SkSurfaceProps(flags, SkSurfaceProps::kLegacyFontHost_InitType); |
| (...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2163 } | 2163 } |
| 2164 | 2164 |
| 2165 class GrContext* ResourceProvider::GrContext(bool worker_context) const { | 2165 class GrContext* ResourceProvider::GrContext(bool worker_context) const { |
| 2166 ContextProvider* context_provider = | 2166 ContextProvider* context_provider = |
| 2167 worker_context ? output_surface_->worker_context_provider() | 2167 worker_context ? output_surface_->worker_context_provider() |
| 2168 : output_surface_->context_provider(); | 2168 : output_surface_->context_provider(); |
| 2169 return context_provider ? context_provider->GrContext() : NULL; | 2169 return context_provider ? context_provider->GrContext() : NULL; |
| 2170 } | 2170 } |
| 2171 | 2171 |
| 2172 } // namespace cc | 2172 } // namespace cc |
| OLD | NEW |