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

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

Issue 1577393002: Make SkBitmap::CopyTo respect requested dst color type when bitmap is texture backed. (Closed) Base URL: https://skia.googlesource.com/skia.git@m48
Patch Set: Fix up test for older Created 4 years, 11 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 | « include/gpu/SkGrPixelRef.h ('k') | src/core/SkBitmapDevice.cpp » ('j') | 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 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 } 799 }
800 800
801 // if we have a texture, first get those pixels 801 // if we have a texture, first get those pixels
802 SkBitmap tmpSrc; 802 SkBitmap tmpSrc;
803 const SkBitmap* src = this; 803 const SkBitmap* src = this;
804 804
805 if (fPixelRef) { 805 if (fPixelRef) {
806 SkIRect subset; 806 SkIRect subset;
807 subset.setXYWH(fPixelRefOrigin.fX, fPixelRefOrigin.fY, 807 subset.setXYWH(fPixelRefOrigin.fX, fPixelRefOrigin.fY,
808 fInfo.width(), fInfo.height()); 808 fInfo.width(), fInfo.height());
809 if (fPixelRef->readPixels(&tmpSrc, &subset)) { 809 if (fPixelRef->readPixels(&tmpSrc, dstColorType, &subset)) {
810 if (fPixelRef->info().alphaType() == kUnpremul_SkAlphaType) { 810 if (fPixelRef->info().alphaType() == kUnpremul_SkAlphaType) {
811 // FIXME: The only meaningful implementation of readPixels 811 // FIXME: The only meaningful implementation of readPixels
812 // (GrPixelRef) assumes premultiplied pixels. 812 // (GrPixelRef) assumes premultiplied pixels.
813 return false; 813 return false;
814 } 814 }
815 SkASSERT(tmpSrc.width() == this->width()); 815 SkASSERT(tmpSrc.width() == this->width());
816 SkASSERT(tmpSrc.height() == this->height()); 816 SkASSERT(tmpSrc.height() == this->height());
817 817
818 // did we get lucky and we can just return tmpSrc? 818 // did we get lucky and we can just return tmpSrc?
819 if (tmpSrc.colorType() == dstColorType && nullptr == alloc) { 819 if (tmpSrc.colorType() == dstColorType && nullptr == alloc) {
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 /////////////////////////////////////////////////////////////////////////////// 1316 ///////////////////////////////////////////////////////////////////////////////
1317 1317
1318 #ifdef SK_DEBUG 1318 #ifdef SK_DEBUG
1319 void SkImageInfo::validate() const { 1319 void SkImageInfo::validate() const {
1320 SkASSERT(fWidth >= 0); 1320 SkASSERT(fWidth >= 0);
1321 SkASSERT(fHeight >= 0); 1321 SkASSERT(fHeight >= 0);
1322 SkASSERT(SkColorTypeIsValid(fColorType)); 1322 SkASSERT(SkColorTypeIsValid(fColorType));
1323 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); 1323 SkASSERT(SkAlphaTypeIsValid(fAlphaType));
1324 } 1324 }
1325 #endif 1325 #endif
OLDNEW
« no previous file with comments | « include/gpu/SkGrPixelRef.h ('k') | src/core/SkBitmapDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698