Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2008 The Android Open Source Project | 3 * Copyright 2008 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| (...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1042 memcpy(tmpDst.getPixels(), src->getPixels(), src->getSafeSize()); | 1042 memcpy(tmpDst.getPixels(), src->getPixels(), src->getSafeSize()); |
| 1043 SkPixelRef* pixelRef = tmpDst.pixelRef(); | 1043 SkPixelRef* pixelRef = tmpDst.pixelRef(); |
| 1044 | 1044 |
| 1045 // In order to reach this point, we know that the width, config and | 1045 // In order to reach this point, we know that the width, config and |
| 1046 // rowbytes of the SkPixelRefs are the same, but it is possible for | 1046 // rowbytes of the SkPixelRefs are the same, but it is possible for |
| 1047 // the heights to differ, if this SkBitmap's height is a subset of | 1047 // the heights to differ, if this SkBitmap's height is a subset of |
| 1048 // fPixelRef. Only if the SkPixelRefs' heights match are we | 1048 // fPixelRef. Only if the SkPixelRefs' heights match are we |
| 1049 // guaranteed that this is an exact copy, meaning we should clone | 1049 // guaranteed that this is an exact copy, meaning we should clone |
| 1050 // the genID. | 1050 // the genID. |
| 1051 if (pixelRef->info().fHeight == fPixelRef->info().fHeight) { | 1051 if (pixelRef->info().fHeight == fPixelRef->info().fHeight) { |
| 1052 SkASSERT(pixelRef->info() == fPixelRef->info()); | 1052 // TODO: what to do if the two infos match, BUT |
| 1053 // fPixelRef is premul and pixelRef is opaque? | |
| 1054 // skipping assert for now | |
| 1055 // https://code.google.com/p/skia/issues/detail?id=2012 | |
|
hal.canary
2014/01/10 18:46:09
Should we put in some less strict asserts? info.f
| |
| 1056 // SkASSERT(pixelRef->info() == fPixelRef->info()); | |
| 1053 pixelRef->cloneGenID(*fPixelRef); | 1057 pixelRef->cloneGenID(*fPixelRef); |
| 1054 } | 1058 } |
| 1055 } else { | 1059 } else { |
| 1056 const char* srcP = reinterpret_cast<const char*>(src->getPixels()); | 1060 const char* srcP = reinterpret_cast<const char*>(src->getPixels()); |
| 1057 char* dstP = reinterpret_cast<char*>(tmpDst.getPixels()); | 1061 char* dstP = reinterpret_cast<char*>(tmpDst.getPixels()); |
| 1058 // to be sure we don't read too much, only copy our logical pixels | 1062 // to be sure we don't read too much, only copy our logical pixels |
| 1059 size_t bytesToCopy = tmpDst.width() * tmpDst.bytesPerPixel(); | 1063 size_t bytesToCopy = tmpDst.width() * tmpDst.bytesPerPixel(); |
| 1060 for (int y = 0; y < tmpDst.height(); y++) { | 1064 for (int y = 0; y < tmpDst.height(); y++) { |
| 1061 memcpy(dstP, srcP, bytesToCopy); | 1065 memcpy(dstP, srcP, bytesToCopy); |
| 1062 srcP += src->rowBytes(); | 1066 srcP += src->rowBytes(); |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1652 if (NULL != uri) { | 1656 if (NULL != uri) { |
| 1653 str->appendf(" uri:\"%s\"", uri); | 1657 str->appendf(" uri:\"%s\"", uri); |
| 1654 } else { | 1658 } else { |
| 1655 str->appendf(" pixelref:%p", pr); | 1659 str->appendf(" pixelref:%p", pr); |
| 1656 } | 1660 } |
| 1657 } | 1661 } |
| 1658 | 1662 |
| 1659 str->append(")"); | 1663 str->append(")"); |
| 1660 } | 1664 } |
| 1661 #endif | 1665 #endif |
| OLD | NEW |