| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 dst->pixelRef()->setImmutableWithID(this->uniqueID()); | 75 dst->pixelRef()->setImmutableWithID(this->uniqueID()); |
| 76 if (kAllow_CachingHint == chint) { | 76 if (kAllow_CachingHint == chint) { |
| 77 SkBitmapCache::Add(this->uniqueID(), *dst); | 77 SkBitmapCache::Add(this->uniqueID(), *dst); |
| 78 fAddedRasterVersionToCache.store(true); | 78 fAddedRasterVersionToCache.store(true); |
| 79 } | 79 } |
| 80 return true; | 80 return true; |
| 81 } | 81 } |
| 82 | 82 |
| 83 GrTexture* SkImage_Gpu::asTextureRef(GrContext* ctx, const GrTextureParams& para
ms, | 83 GrTexture* SkImage_Gpu::asTextureRef(GrContext* ctx, const GrTextureParams& para
ms, |
| 84 SkSourceGammaTreatment gammaTreatment) cons
t { | 84 SkSourceGammaTreatment gammaTreatment) cons
t { |
| 85 GrTextureAdjuster adjuster(this->peekTexture(), this->bounds(), this->unique
ID(), | 85 GrTextureAdjuster adjuster(this->peekTexture(), this->alphaType(), this->bou
nds(), this->uniqueID(), |
| 86 this->onImageInfo().colorSpace()); | 86 this->onImageInfo().colorSpace()); |
| 87 return adjuster.refTextureSafeForParams(params, gammaTreatment, nullptr); | 87 return adjuster.refTextureSafeForParams(params, gammaTreatment, nullptr); |
| 88 } | 88 } |
| 89 | 89 |
| 90 static void apply_premul(const SkImageInfo& info, void* pixels, size_t rowBytes)
{ | 90 static void apply_premul(const SkImageInfo& info, void* pixels, size_t rowBytes)
{ |
| 91 switch (info.colorType()) { | 91 switch (info.colorType()) { |
| 92 case kRGBA_8888_SkColorType: | 92 case kRGBA_8888_SkColorType: |
| 93 case kBGRA_8888_SkColorType: | 93 case kBGRA_8888_SkColorType: |
| 94 break; | 94 break; |
| 95 default: | 95 default: |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 return nullptr; | 563 return nullptr; |
| 564 } | 564 } |
| 565 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m
ipLevelCount)); | 565 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m
ipLevelCount)); |
| 566 if (!texture) { | 566 if (!texture) { |
| 567 return nullptr; | 567 return nullptr; |
| 568 } | 568 } |
| 569 return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew
ImageUniqueID, | 569 return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew
ImageUniqueID, |
| 570 info.alphaType(), texture, sk_ref_sp(info.col
orSpace()), | 570 info.alphaType(), texture, sk_ref_sp(info.col
orSpace()), |
| 571 budgeted); | 571 budgeted); |
| 572 } | 572 } |
| OLD | NEW |