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

Unified Diff: src/core/SkBitmap.cpp

Issue 791823003: Add sRGB texture support. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add in changes for copy_to_new_texture_pixelref Created 6 years 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 side-by-side diff with in-line comments
Download patch
Index: src/core/SkBitmap.cpp
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index c1add1fed95e8c21d3bf1da63cce9ea6d8a6c547..9db596de9cc9023fe32ae9b5ba24ae473e041345 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -765,7 +765,7 @@ bool SkBitmap::extractSubset(SkBitmap* result, const SkIRect& subset) const {
if (fPixelRef->getTexture() != NULL) {
// Do a deep copy
- SkPixelRef* pixelRef = fPixelRef->deepCopy(this->colorType(), &subset);
+ SkPixelRef* pixelRef = fPixelRef->deepCopy(this->colorType(), this->profileType(), &subset);
if (pixelRef != NULL) {
SkBitmap dst;
dst.setInfo(SkImageInfo::Make(subset.width(), subset.height(),
@@ -976,6 +976,7 @@ bool SkBitmap::copyTo(SkBitmap* dst, SkColorType dstColorType, Allocator* alloc)
bool SkBitmap::deepCopyTo(SkBitmap* dst) const {
const SkColorType dstCT = this->colorType();
+ const SkColorProfileType dstPT = this->profileType();
if (!this->canCopyTo(dstCT)) {
return false;
@@ -984,10 +985,10 @@ bool SkBitmap::deepCopyTo(SkBitmap* dst) const {
// If we have a PixelRef, and it supports deep copy, use it.
// Currently supported only by texture-backed bitmaps.
if (fPixelRef) {
- SkPixelRef* pixelRef = fPixelRef->deepCopy(dstCT, NULL);
+ SkPixelRef* pixelRef = fPixelRef->deepCopy(dstCT, dstPT, NULL);
if (pixelRef) {
uint32_t rowBytes;
- if (this->colorType() == dstCT) {
+ if (this->colorType() == dstCT && this->profileType() == dstPT) {
// Since there is no subset to pass to deepCopy, and deepCopy
// succeeded, the new pixel ref must be identical.
SkASSERT(fPixelRef->info() == pixelRef->info());
« include/core/SkPixelRef.h ('K') | « samplecode/SampleApp.cpp ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698