| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright 2012 Google Inc. | 2  * Copyright 2012 Google Inc. | 
| 3  * | 3  * | 
| 4  * Use of this source code is governed by a BSD-style license that can be | 4  * Use of this source code is governed by a BSD-style license that can be | 
| 5  * found in the LICENSE file. | 5  * found in the LICENSE file. | 
| 6  */ | 6  */ | 
| 7 | 7 | 
| 8 #include "SkAutoPixmapStorage.h" | 8 #include "SkAutoPixmapStorage.h" | 
| 9 #include "GrCaps.h" | 9 #include "GrCaps.h" | 
| 10 #include "GrContext.h" | 10 #include "GrContext.h" | 
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 176                                         SkAlphaType at, TextureReleaseProc relea
     seP, | 176                                         SkAlphaType at, TextureReleaseProc relea
     seP, | 
| 177                                         ReleaseContext releaseC) { | 177                                         ReleaseContext releaseC) { | 
| 178     return new_wrapped_texture_common(ctx, desc, at, kBorrow_GrWrapOwnership, re
     leaseP, releaseC); | 178     return new_wrapped_texture_common(ctx, desc, at, kBorrow_GrWrapOwnership, re
     leaseP, releaseC); | 
| 179 } | 179 } | 
| 180 | 180 | 
| 181 sk_sp<SkImage> SkImage::MakeFromAdoptedTexture(GrContext* ctx, const GrBackendTe
     xtureDesc& desc, | 181 sk_sp<SkImage> SkImage::MakeFromAdoptedTexture(GrContext* ctx, const GrBackendTe
     xtureDesc& desc, | 
| 182                                                SkAlphaType at) { | 182                                                SkAlphaType at) { | 
| 183     return new_wrapped_texture_common(ctx, desc, at, kAdopt_GrWrapOwnership, nul
     lptr, nullptr); | 183     return new_wrapped_texture_common(ctx, desc, at, kAdopt_GrWrapOwnership, nul
     lptr, nullptr); | 
| 184 } | 184 } | 
| 185 | 185 | 
| 186 sk_sp<SkImage> SkImage::MakeFromTextureCopy(GrContext* ctx, const GrBackendTextu
     reDesc& desc, |  | 
| 187                                             SkAlphaType at) { |  | 
| 188     if (desc.fWidth <= 0 || desc.fHeight <= 0) { |  | 
| 189         return nullptr; |  | 
| 190     } |  | 
| 191 |  | 
| 192     SkAutoTUnref<GrTexture> src(ctx->textureProvider()->wrapBackendTexture( |  | 
| 193         desc, kBorrow_GrWrapOwnership)); |  | 
| 194     if (!src) { |  | 
| 195         return nullptr; |  | 
| 196     } |  | 
| 197 |  | 
| 198     SkAutoTUnref<GrTexture> dst(GrDeepCopyTexture(src, SkBudgeted::kYes)); |  | 
| 199     if (!dst) { |  | 
| 200         return nullptr; |  | 
| 201     } |  | 
| 202 |  | 
| 203     return sk_make_sp<SkImage_Gpu>(desc.fWidth, desc.fHeight, kNeedNewImageUniqu
     eID, at, dst, |  | 
| 204                                    SkBudgeted::kYes); |  | 
| 205 } |  | 
| 206 |  | 
| 207 static sk_sp<SkImage> make_from_yuv_textures_copy(GrContext* ctx, SkYUVColorSpac
     e colorSpace, | 186 static sk_sp<SkImage> make_from_yuv_textures_copy(GrContext* ctx, SkYUVColorSpac
     e colorSpace, | 
| 208                                                   bool nv12, | 187                                                   bool nv12, | 
| 209                                                   const GrBackendObject yuvTextu
     reHandles[], | 188                                                   const GrBackendObject yuvTextu
     reHandles[], | 
| 210                                                   const SkISize yuvSizes[], | 189                                                   const SkISize yuvSizes[], | 
| 211                                                   GrSurfaceOrigin origin) { | 190                                                   GrSurfaceOrigin origin) { | 
| 212     const SkBudgeted budgeted = SkBudgeted::kYes; | 191     const SkBudgeted budgeted = SkBudgeted::kYes; | 
| 213 | 192 | 
| 214     if (yuvSizes[0].fWidth <= 0 || yuvSizes[0].fHeight <= 0 || yuvSizes[1].fWidt
     h <= 0 || | 193     if (yuvSizes[0].fWidth <= 0 || yuvSizes[0].fHeight <= 0 || yuvSizes[1].fWidt
     h <= 0 || | 
| 215         yuvSizes[1].fHeight <= 0) { | 194         yuvSizes[1].fHeight <= 0) { | 
| 216         return nullptr; | 195         return nullptr; | 
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 560     if (!ctx) { | 539     if (!ctx) { | 
| 561         return nullptr; | 540         return nullptr; | 
| 562     } | 541     } | 
| 563     SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m
     ipLevelCount)); | 542     SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m
     ipLevelCount)); | 
| 564     if (!texture) { | 543     if (!texture) { | 
| 565         return nullptr; | 544         return nullptr; | 
| 566     } | 545     } | 
| 567     return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew
     ImageUniqueID, | 546     return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew
     ImageUniqueID, | 
| 568                                    info.alphaType(), texture, budgeted); | 547                                    info.alphaType(), texture, budgeted); | 
| 569 } | 548 } | 
| OLD | NEW | 
|---|