| 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 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1220 ResourceProvider::ScopedReadLockSkImage::ScopedReadLockSkImage( | 1220 ResourceProvider::ScopedReadLockSkImage::ScopedReadLockSkImage( |
| 1221 ResourceProvider* resource_provider, | 1221 ResourceProvider* resource_provider, |
| 1222 ResourceId resource_id) | 1222 ResourceId resource_id) |
| 1223 : resource_provider_(resource_provider), resource_id_(resource_id) { | 1223 : resource_provider_(resource_provider), resource_id_(resource_id) { |
| 1224 const Resource* resource = resource_provider->LockForRead(resource_id); | 1224 const Resource* resource = resource_provider->LockForRead(resource_id); |
| 1225 if (resource->gl_id) { | 1225 if (resource->gl_id) { |
| 1226 GrGLTextureInfo texture_info; | 1226 GrGLTextureInfo texture_info; |
| 1227 texture_info.fID = resource->gl_id; | 1227 texture_info.fID = resource->gl_id; |
| 1228 texture_info.fTarget = resource->target; | 1228 texture_info.fTarget = resource->target; |
| 1229 GrBackendTextureDesc desc; | 1229 GrBackendTextureDesc desc; |
| 1230 desc.fFlags = kRenderTarget_GrBackendTextureFlag; | |
| 1231 desc.fWidth = resource->size.width(); | 1230 desc.fWidth = resource->size.width(); |
| 1232 desc.fHeight = resource->size.height(); | 1231 desc.fHeight = resource->size.height(); |
| 1233 desc.fConfig = ToGrPixelConfig(resource->format); | 1232 desc.fConfig = ToGrPixelConfig(resource->format); |
| 1234 desc.fOrigin = kTopLeft_GrSurfaceOrigin; | 1233 desc.fOrigin = kTopLeft_GrSurfaceOrigin; |
| 1235 desc.fTextureHandle = skia::GrGLTextureInfoToGrBackendObject(texture_info); | 1234 desc.fTextureHandle = skia::GrGLTextureInfoToGrBackendObject(texture_info); |
| 1236 sk_image_ = SkImage::MakeFromTexture( | 1235 sk_image_ = SkImage::MakeFromTexture( |
| 1237 resource_provider->compositor_context_provider_->GrContext(), desc, | 1236 resource_provider->compositor_context_provider_->GrContext(), desc, |
| 1238 kPremul_SkAlphaType, | 1237 kPremul_SkAlphaType, |
| 1239 resource_provider->GetResourceSkColorSpace(resource), nullptr, nullptr); | 1238 resource_provider->GetResourceSkColorSpace(resource), nullptr, nullptr); |
| 1240 } else if (resource->pixels) { | 1239 } else if (resource->pixels) { |
| (...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2059 | 2058 |
| 2060 const int kImportance = 2; | 2059 const int kImportance = 2; |
| 2061 pmd->CreateSharedGlobalAllocatorDump(guid); | 2060 pmd->CreateSharedGlobalAllocatorDump(guid); |
| 2062 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | 2061 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
| 2063 } | 2062 } |
| 2064 | 2063 |
| 2065 return true; | 2064 return true; |
| 2066 } | 2065 } |
| 2067 | 2066 |
| 2068 } // namespace cc | 2067 } // namespace cc |
| OLD | NEW |