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

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

Issue 1576983002: Make SkBitmap::CopyTo respect requested dst color type when bitmap is texture backed. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix size_t warnings 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 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 } 821 }
822 822
823 // if we have a texture, first get those pixels 823 // if we have a texture, first get those pixels
824 SkBitmap tmpSrc; 824 SkBitmap tmpSrc;
825 const SkBitmap* src = this; 825 const SkBitmap* src = this;
826 826
827 if (fPixelRef) { 827 if (fPixelRef) {
828 SkIRect subset; 828 SkIRect subset;
829 subset.setXYWH(fPixelRefOrigin.fX, fPixelRefOrigin.fY, 829 subset.setXYWH(fPixelRefOrigin.fX, fPixelRefOrigin.fY,
830 fInfo.width(), fInfo.height()); 830 fInfo.width(), fInfo.height());
831 if (fPixelRef->readPixels(&tmpSrc, &subset)) { 831 if (fPixelRef->readPixels(&tmpSrc, dstColorType, &subset)) {
832 if (fPixelRef->info().alphaType() == kUnpremul_SkAlphaType) { 832 if (fPixelRef->info().alphaType() == kUnpremul_SkAlphaType) {
833 // FIXME: The only meaningful implementation of readPixels 833 // FIXME: The only meaningful implementation of readPixels
834 // (GrPixelRef) assumes premultiplied pixels. 834 // (GrPixelRef) assumes premultiplied pixels.
835 return false; 835 return false;
836 } 836 }
837 SkASSERT(tmpSrc.width() == this->width()); 837 SkASSERT(tmpSrc.width() == this->width());
838 SkASSERT(tmpSrc.height() == this->height()); 838 SkASSERT(tmpSrc.height() == this->height());
839 839
840 // did we get lucky and we can just return tmpSrc? 840 // did we get lucky and we can just return tmpSrc?
841 if (tmpSrc.colorType() == dstColorType && nullptr == alloc) { 841 if (tmpSrc.colorType() == dstColorType && nullptr == alloc) {
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 /////////////////////////////////////////////////////////////////////////////// 1337 ///////////////////////////////////////////////////////////////////////////////
1338 1338
1339 #ifdef SK_DEBUG 1339 #ifdef SK_DEBUG
1340 void SkImageInfo::validate() const { 1340 void SkImageInfo::validate() const {
1341 SkASSERT(fWidth >= 0); 1341 SkASSERT(fWidth >= 0);
1342 SkASSERT(fHeight >= 0); 1342 SkASSERT(fHeight >= 0);
1343 SkASSERT(SkColorTypeIsValid(fColorType)); 1343 SkASSERT(SkColorTypeIsValid(fColorType));
1344 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); 1344 SkASSERT(SkAlphaTypeIsValid(fAlphaType));
1345 } 1345 }
1346 #endif 1346 #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