Chromium Code Reviews| 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 <cstddef> | 8 #include <cstddef> |
| 9 #include <cstring> | 9 #include <cstring> |
| 10 #include <type_traits> | 10 #include <type_traits> |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 479 int ctCount = 0; | 479 int ctCount = 0; |
| 480 if (!isScaled && this->peekPixels(&pixmap)) { | 480 if (!isScaled && this->peekPixels(&pixmap)) { |
| 481 info = pixmap.info(); | 481 info = pixmap.info(); |
| 482 pixelSize = SkAlign8(pixmap.getSafeSize()); | 482 pixelSize = SkAlign8(pixmap.getSafeSize()); |
| 483 if (pixmap.ctable()) { | 483 if (pixmap.ctable()) { |
| 484 ctCount = pixmap.ctable()->count(); | 484 ctCount = pixmap.ctable()->count(); |
| 485 ctSize = SkAlign8(pixmap.ctable()->count() * 4); | 485 ctSize = SkAlign8(pixmap.ctable()->count() * 4); |
| 486 } | 486 } |
| 487 } else { | 487 } else { |
| 488 // Here we're just using presence of data to know whether there is a cod ec behind the image. | 488 // Here we're just using presence of data to know whether there is a cod ec behind the image. |
| 489 // In the future we will access the cacherator and get the exact data th at we want to (e.g. | 489 // In the future we will access the cacherator and get the exact data th at we want to (e.g. |
|
vmpstr
2016/09/12 23:35:27
nit: You should update the comment.
cblume
2016/09/13 00:02:26
Done.
| |
| 490 // yuv planes) upload. | 490 // yuv planes) upload. |
| 491 sk_sp<SkData> data(this->refEncoded()); | 491 SkImageCacherator* data(as_IB(this)->peekCacherator()); |
|
vmpstr
2016/09/12 23:35:27
Can we just inline this in the if? I don't think w
cblume
2016/09/13 00:02:26
Done. This actually makes it read much more easily
| |
| 492 if (!data && !this->peekPixels(nullptr)) { | 492 if (!data && !this->peekPixels(nullptr)) { |
| 493 return 0; | 493 return 0; |
| 494 } | 494 } |
| 495 info = SkImageInfo::MakeN32(scaledSize.width(), scaledSize.height(), thi s->alphaType()); | 495 info = SkImageInfo::MakeN32(scaledSize.width(), scaledSize.height(), thi s->alphaType()); |
| 496 pixelSize = SkAlign8(SkAutoPixmapStorage::AllocSize(info, nullptr)); | 496 pixelSize = SkAlign8(SkAutoPixmapStorage::AllocSize(info, nullptr)); |
| 497 if (fillMode) { | 497 if (fillMode) { |
| 498 pixmap.alloc(info); | 498 pixmap.alloc(info); |
| 499 if (isScaled) { | 499 if (isScaled) { |
| 500 if (!this->scalePixels(pixmap, scaleFilterQuality, | 500 if (!this->scalePixels(pixmap, scaleFilterQuality, |
| 501 SkImage::kDisallow_CachingHint)) { | 501 SkImage::kDisallow_CachingHint)) { |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 709 } | 709 } |
| 710 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m ipLevelCount)); | 710 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m ipLevelCount)); |
| 711 if (!texture) { | 711 if (!texture) { |
| 712 return nullptr; | 712 return nullptr; |
| 713 } | 713 } |
| 714 texture->texturePriv().setGammaTreatment(gammaTreatment); | 714 texture->texturePriv().setGammaTreatment(gammaTreatment); |
| 715 return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew ImageUniqueID, | 715 return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew ImageUniqueID, |
| 716 info.alphaType(), texture, sk_ref_sp(info.col orSpace()), | 716 info.alphaType(), texture, sk_ref_sp(info.col orSpace()), |
| 717 budgeted); | 717 budgeted); |
| 718 } | 718 } |
| OLD | NEW |