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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 478 size_t ctSize = 0; | 478 size_t ctSize = 0; |
| 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 if (!as_IB(this)->canGenerateTexture(proxy)) { |
|
reed1
2016/10/24 13:42:00
Is the predicate reversed here? If the image *can*
cblume
2016/10/25 02:51:01
Done.
| |
| 489 // In the future we will access the cacherator and get the exact data th at we want to (e.g. | |
| 490 // yuv planes) upload. | |
| 491 sk_sp<SkData> data(this->refEncoded()); | |
| 492 if (!data && !this->peekPixels(nullptr)) { | |
| 493 return 0; | 489 return 0; |
| 494 } | 490 } |
| 495 info = as_IB(this)->onImageInfo().makeWH(scaledSize.width(), scaledSize. height()); | 491 info = as_IB(this)->onImageInfo().makeWH(scaledSize.width(), scaledSize. height()); |
| 496 pixelSize = SkAlign8(SkAutoPixmapStorage::AllocSize(info, nullptr)); | 492 pixelSize = SkAlign8(SkAutoPixmapStorage::AllocSize(info, nullptr)); |
| 497 if (fillMode) { | 493 if (fillMode) { |
| 498 pixmap.alloc(info); | 494 pixmap.alloc(info); |
| 499 if (isScaled) { | 495 if (isScaled) { |
| 500 if (!this->scalePixels(pixmap, scaleFilterQuality, | 496 if (!this->scalePixels(pixmap, scaleFilterQuality, |
| 501 SkImage::kDisallow_CachingHint)) { | 497 SkImage::kDisallow_CachingHint)) { |
| 502 return 0; | 498 return 0; |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 704 } | 700 } |
| 705 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m ipLevelCount)); | 701 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m ipLevelCount)); |
| 706 if (!texture) { | 702 if (!texture) { |
| 707 return nullptr; | 703 return nullptr; |
| 708 } | 704 } |
| 709 texture->texturePriv().setGammaTreatment(gammaTreatment); | 705 texture->texturePriv().setGammaTreatment(gammaTreatment); |
| 710 return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew ImageUniqueID, | 706 return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew ImageUniqueID, |
| 711 info.alphaType(), texture, sk_ref_sp(info.col orSpace()), | 707 info.alphaType(), texture, sk_ref_sp(info.col orSpace()), |
| 712 budgeted); | 708 budgeted); |
| 713 } | 709 } |
| OLD | NEW |