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 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1112 for (int y = 0; y < src->height(); ++y) { | 1112 for (int y = 0; y < src->height(); ++y) { |
| 1113 SkPMColor16* SK_RESTRICT dstRow = (SkPMColor16*) tmpDst.getAddr16(0, y); | 1113 SkPMColor16* SK_RESTRICT dstRow = (SkPMColor16*) tmpDst.getAddr16(0, y); |
| 1114 SkPMColor* SK_RESTRICT srcRow = (SkPMColor*) src->getAddr32(0, y); | 1114 SkPMColor* SK_RESTRICT srcRow = (SkPMColor*) src->getAddr32(0, y); |
| 1115 DITHER_4444_SCAN(y); | 1115 DITHER_4444_SCAN(y); |
| 1116 for (int x = 0; x < src->width(); ++x) { | 1116 for (int x = 0; x < src->width(); ++x) { |
| 1117 dstRow[x] = SkDitherARGB32To4444(srcRow[x], | 1117 dstRow[x] = SkDitherARGB32To4444(srcRow[x], |
| 1118 DITHER_VALUE(x)); | 1118 DITHER_VALUE(x)); |
| 1119 } | 1119 } |
| 1120 } | 1120 } |
| 1121 } else { | 1121 } else { |
| 1122 // if the src has alpha, we have to clear the dst first | 1122 // Always clear the dest in case one of the blitters accesses it |
| 1123 if (!src->isOpaque()) { | 1123 tmpDst.eraseColor(SK_ColorTRANSPARENT); |
|
reed1
2013/10/10 15:16:38
// TODO: switch the allocation of tmpDst to call s
robertphillips
2013/10/10 15:48:34
Done.
| |
| 1124 tmpDst.eraseColor(SK_ColorTRANSPARENT); | |
| 1125 } | |
| 1126 | 1124 |
| 1127 SkCanvas canvas(tmpDst); | 1125 SkCanvas canvas(tmpDst); |
| 1128 SkPaint paint; | 1126 SkPaint paint; |
| 1129 | 1127 |
| 1130 paint.setDither(true); | 1128 paint.setDither(true); |
| 1131 canvas.drawBitmap(*src, 0, 0, &paint); | 1129 canvas.drawBitmap(*src, 0, 0, &paint); |
| 1132 } | 1130 } |
| 1133 | 1131 |
| 1134 tmpDst.setIsOpaque(src->isOpaque()); | 1132 tmpDst.setIsOpaque(src->isOpaque()); |
| 1135 | 1133 |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1694 if (NULL != uri) { | 1692 if (NULL != uri) { |
| 1695 str->appendf(" uri:\"%s\"", uri); | 1693 str->appendf(" uri:\"%s\"", uri); |
| 1696 } else { | 1694 } else { |
| 1697 str->appendf(" pixelref:%p", pr); | 1695 str->appendf(" pixelref:%p", pr); |
| 1698 } | 1696 } |
| 1699 } | 1697 } |
| 1700 | 1698 |
| 1701 str->append(")"); | 1699 str->append(")"); |
| 1702 } | 1700 } |
| 1703 #endif | 1701 #endif |
| OLD | NEW |