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 20 matching lines...) Expand all Loading... |
31 SkASSERT(tex->height() == h); | 31 SkASSERT(tex->height() == h); |
32 } | 32 } |
33 | 33 |
34 SkImage_Gpu::~SkImage_Gpu() { | 34 SkImage_Gpu::~SkImage_Gpu() { |
35 if (fAddedRasterVersionToCache.load()) { | 35 if (fAddedRasterVersionToCache.load()) { |
36 SkNotifyBitmapGenIDIsStale(this->uniqueID()); | 36 SkNotifyBitmapGenIDIsStale(this->uniqueID()); |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 extern void SkTextureImageApplyBudgetedDecision(SkImage* image) { | 40 extern void SkTextureImageApplyBudgetedDecision(SkImage* image) { |
41 if (as_IB(image)->peekTexture()) { | 41 if (image->isTextureBacked()) { |
42 ((SkImage_Gpu*)image)->applyBudgetDecision(); | 42 ((SkImage_Gpu*)image)->applyBudgetDecision(); |
43 } | 43 } |
44 } | 44 } |
45 | 45 |
46 static SkImageInfo make_info(int w, int h, bool isOpaque) { | 46 static SkImageInfo make_info(int w, int h, bool isOpaque) { |
47 return SkImageInfo::MakeN32(w, h, isOpaque ? kOpaque_SkAlphaType : kPremul_S
kAlphaType); | 47 return SkImageInfo::MakeN32(w, h, isOpaque ? kOpaque_SkAlphaType : kPremul_S
kAlphaType); |
48 } | 48 } |
49 | 49 |
50 bool SkImage_Gpu::getROPixels(SkBitmap* dst, CachingHint chint) const { | 50 bool SkImage_Gpu::getROPixels(SkBitmap* dst, CachingHint chint) const { |
51 if (SkBitmapCache::Find(this->uniqueID(), dst)) { | 51 if (SkBitmapCache::Find(this->uniqueID(), dst)) { |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 if (!ctx) { | 539 if (!ctx) { |
540 return nullptr; | 540 return nullptr; |
541 } | 541 } |
542 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m
ipLevelCount)); | 542 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m
ipLevelCount)); |
543 if (!texture) { | 543 if (!texture) { |
544 return nullptr; | 544 return nullptr; |
545 } | 545 } |
546 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, |
547 info.alphaType(), texture, budgeted); | 547 info.alphaType(), texture, budgeted); |
548 } | 548 } |
OLD | NEW |