| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 dst->pixelRef()->setImmutableWithID(this->uniqueID()); | 76 dst->pixelRef()->setImmutableWithID(this->uniqueID()); |
| 77 if (kAllow_CachingHint == chint) { | 77 if (kAllow_CachingHint == chint) { |
| 78 SkBitmapCache::Add(this->uniqueID(), *dst); | 78 SkBitmapCache::Add(this->uniqueID(), *dst); |
| 79 fAddedRasterVersionToCache.store(true); | 79 fAddedRasterVersionToCache.store(true); |
| 80 } | 80 } |
| 81 return true; | 81 return true; |
| 82 } | 82 } |
| 83 | 83 |
| 84 GrTexture* SkImage_Gpu::asTextureRef(GrContext* ctx, const GrTextureParams& para
ms, | 84 GrTexture* SkImage_Gpu::asTextureRef(GrContext* ctx, const GrTextureParams& para
ms, |
| 85 SkSourceGammaTreatment gammaTreatment) cons
t { | 85 SkSourceGammaTreatment gammaTreatment) cons
t { |
| 86 return GrImageTextureAdjuster(as_IB(this)).refTextureSafeForParams(params, g
ammaTreatment, | 86 GrTextureAdjuster adjuster(this->peekTexture(), this->bounds(), this->unique
ID(), |
| 87 nullptr); | 87 this->onImageInfo().colorSpace()); |
| 88 return adjuster.refTextureSafeForParams(params, gammaTreatment, nullptr); |
| 88 } | 89 } |
| 89 | 90 |
| 90 bool SkImage_Gpu::isOpaque() const { | 91 bool SkImage_Gpu::isOpaque() const { |
| 91 return GrPixelConfigIsOpaque(fTexture->config()) || fAlphaType == kOpaque_Sk
AlphaType; | 92 return GrPixelConfigIsOpaque(fTexture->config()) || fAlphaType == kOpaque_Sk
AlphaType; |
| 92 } | 93 } |
| 93 | 94 |
| 94 static void apply_premul(const SkImageInfo& info, void* pixels, size_t rowBytes)
{ | 95 static void apply_premul(const SkImageInfo& info, void* pixels, size_t rowBytes)
{ |
| 95 switch (info.colorType()) { | 96 switch (info.colorType()) { |
| 96 case kRGBA_8888_SkColorType: | 97 case kRGBA_8888_SkColorType: |
| 97 case kBGRA_8888_SkColorType: | 98 case kBGRA_8888_SkColorType: |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 return nullptr; | 571 return nullptr; |
| 571 } | 572 } |
| 572 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m
ipLevelCount)); | 573 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m
ipLevelCount)); |
| 573 if (!texture) { | 574 if (!texture) { |
| 574 return nullptr; | 575 return nullptr; |
| 575 } | 576 } |
| 576 return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew
ImageUniqueID, | 577 return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew
ImageUniqueID, |
| 577 info.alphaType(), texture, sk_ref_sp(info.col
orSpace()), | 578 info.alphaType(), texture, sk_ref_sp(info.col
orSpace()), |
| 578 budgeted); | 579 budgeted); |
| 579 } | 580 } |
| OLD | NEW |