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

Side by Side Diff: src/core/SkBitmap.cpp

Issue 1892543002: Make sure the color profile propagetes through the system. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Formatting. Created 4 years, 8 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 2008 The Android Open Source Project 2 * Copyright 2008 The Android Open Source Project
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 "SkAtomics.h" 8 #include "SkAtomics.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 srcRect.set(0, 0, this->width(), this->height()); 740 srcRect.set(0, 0, this->width(), this->height());
741 if (!r.intersect(srcRect, subset)) { 741 if (!r.intersect(srcRect, subset)) {
742 return false; // r is empty (i.e. no intersection) 742 return false; // r is empty (i.e. no intersection)
743 } 743 }
744 744
745 if (fPixelRef->getTexture() != nullptr) { 745 if (fPixelRef->getTexture() != nullptr) {
746 // Do a deep copy 746 // Do a deep copy
747 SkPixelRef* pixelRef = fPixelRef->deepCopy(this->colorType(), this->prof ileType(), &subset); 747 SkPixelRef* pixelRef = fPixelRef->deepCopy(this->colorType(), this->prof ileType(), &subset);
748 if (pixelRef != nullptr) { 748 if (pixelRef != nullptr) {
749 SkBitmap dst; 749 SkBitmap dst;
750 dst.setInfo(SkImageInfo::Make(subset.width(), subset.height(), 750 dst.setInfo(SkImageInfo::Make(subset.width(), subset.height(),
mtklein 2016/04/14 19:36:33 This is probably a good place to be using SkImageI
reed1 2016/04/14 19:59:17 +1
herb_g 2016/04/14 20:28:06 Done.
herb_g 2016/04/14 20:28:06 Done.
751 this->colorType(), this->alphaType())) ; 751 this->colorType(), this->alphaType(),
752 this->profileType()));
752 dst.setIsVolatile(this->isVolatile()); 753 dst.setIsVolatile(this->isVolatile());
753 dst.setPixelRef(pixelRef)->unref(); 754 dst.setPixelRef(pixelRef)->unref();
754 SkDEBUGCODE(dst.validate()); 755 SkDEBUGCODE(dst.validate());
755 result->swap(dst); 756 result->swap(dst);
756 return true; 757 return true;
757 } 758 }
758 } 759 }
759 760
760 // If the upper left of the rectangle was outside the bounds of this SkBitma p, we should have 761 // If the upper left of the rectangle was outside the bounds of this SkBitma p, we should have
761 // exited above. 762 // exited above.
762 SkASSERT(static_cast<unsigned>(r.fLeft) < static_cast<unsigned>(this->width( ))); 763 SkASSERT(static_cast<unsigned>(r.fLeft) < static_cast<unsigned>(this->width( )));
763 SkASSERT(static_cast<unsigned>(r.fTop) < static_cast<unsigned>(this->height( ))); 764 SkASSERT(static_cast<unsigned>(r.fTop) < static_cast<unsigned>(this->height( )));
764 765
765 SkBitmap dst; 766 SkBitmap dst;
766 dst.setInfo(SkImageInfo::Make(r.width(), r.height(), this->colorType(), this ->alphaType()), 767 dst.setInfo(SkImageInfo::Make(r.width(), r.height(), this->colorType(),
mtklein 2016/04/14 19:36:33 Ditto.
herb_g 2016/04/14 20:28:06 Done.
768 this->alphaType(), this->profileType()),
767 this->rowBytes()); 769 this->rowBytes());
768 dst.setIsVolatile(this->isVolatile()); 770 dst.setIsVolatile(this->isVolatile());
769 771
770 if (fPixelRef) { 772 if (fPixelRef) {
771 SkIPoint origin = fPixelRefOrigin; 773 SkIPoint origin = fPixelRefOrigin;
772 origin.fX += r.fLeft; 774 origin.fX += r.fLeft;
773 origin.fY += r.fTop; 775 origin.fY += r.fTop;
774 // share the pixelref with a custom offset 776 // share the pixelref with a custom offset
775 dst.setPixelRef(fPixelRef, origin); 777 dst.setPixelRef(fPixelRef, origin);
776 } 778 }
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 /////////////////////////////////////////////////////////////////////////////// 1353 ///////////////////////////////////////////////////////////////////////////////
1352 1354
1353 #ifdef SK_DEBUG 1355 #ifdef SK_DEBUG
1354 void SkImageInfo::validate() const { 1356 void SkImageInfo::validate() const {
1355 SkASSERT(fWidth >= 0); 1357 SkASSERT(fWidth >= 0);
1356 SkASSERT(fHeight >= 0); 1358 SkASSERT(fHeight >= 0);
1357 SkASSERT(SkColorTypeIsValid(fColorType)); 1359 SkASSERT(SkColorTypeIsValid(fColorType));
1358 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); 1360 SkASSERT(SkAlphaTypeIsValid(fAlphaType));
1359 } 1361 }
1360 #endif 1362 #endif
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