Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: src/image/SkImage_Gpu.cpp

Issue 2418643002: Preserve SkColorSpace when creating a scaled texture
Patch Set: Preserve SkColorSpace when creating a scaled texture Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.
490 // yuv planes) upload. 490 // yuv planes) upload.
491 sk_sp<SkData> data(this->refEncoded()); 491 sk_sp<SkData> data(this->refEncoded());
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 = as_IB(this)->onImageInfo().makeWH(scaledSize.width(), scaledSize. height());
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)) {
502 return 0; 502 return 0;
503 } 503 }
504 } else { 504 } else {
505 if (!this->readPixels(pixmap, 0, 0, SkImage::kDisallow_CachingHi nt)) { 505 if (!this->readPixels(pixmap, 0, 0, SkImage::kDisallow_CachingHi nt)) {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 } 700 }
701 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m ipLevelCount)); 701 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m ipLevelCount));
702 if (!texture) { 702 if (!texture) {
703 return nullptr; 703 return nullptr;
704 } 704 }
705 texture->texturePriv().setGammaTreatment(gammaTreatment); 705 texture->texturePriv().setGammaTreatment(gammaTreatment);
706 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,
707 info.alphaType(), texture, sk_ref_sp(info.col orSpace()), 707 info.alphaType(), texture, sk_ref_sp(info.col orSpace()),
708 budgeted); 708 budgeted);
709 } 709 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698