| 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 if (fTexture->getContext() != ctx) { |
| 87 return nullptr; |
| 88 } |
| 86 return GrImageTextureAdjuster(as_IB(this)).refTextureSafeForParams(params, g
ammaTreatment, | 89 return GrImageTextureAdjuster(as_IB(this)).refTextureSafeForParams(params, g
ammaTreatment, |
| 87 nullptr); | 90 nullptr); |
| 88 } | 91 } |
| 89 | 92 |
| 90 bool SkImage_Gpu::isOpaque() const { | 93 bool SkImage_Gpu::isOpaque() const { |
| 91 return GrPixelConfigIsOpaque(fTexture->config()) || fAlphaType == kOpaque_Sk
AlphaType; | 94 return GrPixelConfigIsOpaque(fTexture->config()) || fAlphaType == kOpaque_Sk
AlphaType; |
| 92 } | 95 } |
| 93 | 96 |
| 94 static void apply_premul(const SkImageInfo& info, void* pixels, size_t rowBytes)
{ | 97 static void apply_premul(const SkImageInfo& info, void* pixels, size_t rowBytes)
{ |
| 95 switch (info.colorType()) { | 98 switch (info.colorType()) { |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 return nullptr; | 549 return nullptr; |
| 547 } | 550 } |
| 548 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m
ipLevelCount)); | 551 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m
ipLevelCount)); |
| 549 if (!texture) { | 552 if (!texture) { |
| 550 return nullptr; | 553 return nullptr; |
| 551 } | 554 } |
| 552 return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew
ImageUniqueID, | 555 return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew
ImageUniqueID, |
| 553 info.alphaType(), texture, sk_ref_sp(info.col
orSpace()), | 556 info.alphaType(), texture, sk_ref_sp(info.col
orSpace()), |
| 554 budgeted); | 557 budgeted); |
| 555 } | 558 } |
| OLD | NEW |