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

Unified Diff: src/codec/SkMaskSwizzler.cpp

Issue 1557403002: Delete reallyHasAlpha() from SkCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/codec/SkMaskSwizzler.h ('k') | src/codec/SkSampledCodec.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkMaskSwizzler.cpp
diff --git a/src/codec/SkMaskSwizzler.cpp b/src/codec/SkMaskSwizzler.cpp
index e5facc1f0c7a70283d4518fbe9b4d725314372d9..01502cbd4ab875ac3ca24e26a61ff85288556423 100644
--- a/src/codec/SkMaskSwizzler.cpp
+++ b/src/codec/SkMaskSwizzler.cpp
@@ -9,7 +9,7 @@
#include "SkColorPriv.h"
#include "SkMaskSwizzler.h"
-static SkSwizzler::ResultAlpha swizzle_mask16_to_n32_opaque(
+static void swizzle_mask16_to_n32_opaque(
void* dstRow, const uint8_t* srcRow, int width, SkMasks* masks,
uint32_t startX, uint32_t sampleX) {
@@ -24,54 +24,47 @@ static SkSwizzler::ResultAlpha swizzle_mask16_to_n32_opaque(
dstPtr[i] = SkPackARGB32NoCheck(0xFF, red, green, blue);
srcPtr += sampleX;
}
- return SkSwizzler::kOpaque_ResultAlpha;
}
-static SkSwizzler::ResultAlpha swizzle_mask16_to_n32_unpremul(
+static void swizzle_mask16_to_n32_unpremul(
void* dstRow, const uint8_t* srcRow, int width, SkMasks* masks,
uint32_t startX, uint32_t sampleX) {
// Use the masks to decode to the destination
uint16_t* srcPtr = ((uint16_t*) srcRow) + startX;
SkPMColor* dstPtr = (SkPMColor*) dstRow;
- INIT_RESULT_ALPHA;
for (int i = 0; i < width; i++) {
uint16_t p = srcPtr[0];
uint8_t red = masks->getRed(p);
uint8_t green = masks->getGreen(p);
uint8_t blue = masks->getBlue(p);
uint8_t alpha = masks->getAlpha(p);
- UPDATE_RESULT_ALPHA(alpha);
dstPtr[i] = SkPackARGB32NoCheck(alpha, red, green, blue);
srcPtr += sampleX;
}
- return COMPUTE_RESULT_ALPHA;
}
-static SkSwizzler::ResultAlpha swizzle_mask16_to_n32_premul(
+static void swizzle_mask16_to_n32_premul(
void* dstRow, const uint8_t* srcRow, int width, SkMasks* masks,
uint32_t startX, uint32_t sampleX) {
// Use the masks to decode to the destination
uint16_t* srcPtr = ((uint16_t*) srcRow) + startX;
SkPMColor* dstPtr = (SkPMColor*) dstRow;
- INIT_RESULT_ALPHA;
for (int i = 0; i < width; i++) {
uint16_t p = srcPtr[0];
uint8_t red = masks->getRed(p);
uint8_t green = masks->getGreen(p);
uint8_t blue = masks->getBlue(p);
uint8_t alpha = masks->getAlpha(p);
- UPDATE_RESULT_ALPHA(alpha);
dstPtr[i] = SkPreMultiplyARGB(alpha, red, green, blue);
srcPtr += sampleX;
}
- return COMPUTE_RESULT_ALPHA;
}
// TODO (msarett): We have promoted a two byte per pixel image to 8888, only to
// convert it back to 565. Instead, we should swizzle to 565 directly.
-static SkSwizzler::ResultAlpha swizzle_mask16_to_565(
+static void swizzle_mask16_to_565(
void* dstRow, const uint8_t* srcRow, int width, SkMasks* masks,
uint32_t startX, uint32_t sampleX) {
@@ -86,10 +79,9 @@ static SkSwizzler::ResultAlpha swizzle_mask16_to_565(
dstPtr[i] = SkPack888ToRGB16(red, green, blue);
srcPtr += sampleX;
}
- return SkSwizzler::kOpaque_ResultAlpha;
}
-static SkSwizzler::ResultAlpha swizzle_mask24_to_n32_opaque(
+static void swizzle_mask24_to_n32_opaque(
void* dstRow, const uint8_t* srcRow, int width, SkMasks* masks,
uint32_t startX, uint32_t sampleX) {
@@ -104,52 +96,45 @@ static SkSwizzler::ResultAlpha swizzle_mask24_to_n32_opaque(
dstPtr[i] = SkPackARGB32NoCheck(0xFF, red, green, blue);
srcRow += 3 * sampleX;
}
- return SkSwizzler::kOpaque_ResultAlpha;
}
-static SkSwizzler::ResultAlpha swizzle_mask24_to_n32_unpremul(
+static void swizzle_mask24_to_n32_unpremul(
void* dstRow, const uint8_t* srcRow, int width, SkMasks* masks,
uint32_t startX, uint32_t sampleX) {
// Use the masks to decode to the destination
srcRow += 3 * startX;
SkPMColor* dstPtr = (SkPMColor*) dstRow;
- INIT_RESULT_ALPHA;
for (int i = 0; i < width; i++) {
uint32_t p = srcRow[0] | (srcRow[1] << 8) | srcRow[2] << 16;
uint8_t red = masks->getRed(p);
uint8_t green = masks->getGreen(p);
uint8_t blue = masks->getBlue(p);
uint8_t alpha = masks->getAlpha(p);
- UPDATE_RESULT_ALPHA(alpha);
dstPtr[i] = SkPackARGB32NoCheck(alpha, red, green, blue);
srcRow += 3 * sampleX;
}
- return COMPUTE_RESULT_ALPHA;
}
-static SkSwizzler::ResultAlpha swizzle_mask24_to_n32_premul(
+static void swizzle_mask24_to_n32_premul(
void* dstRow, const uint8_t* srcRow, int width, SkMasks* masks,
uint32_t startX, uint32_t sampleX) {
// Use the masks to decode to the destination
srcRow += 3 * startX;
SkPMColor* dstPtr = (SkPMColor*) dstRow;
- INIT_RESULT_ALPHA;
for (int i = 0; i < width; i++) {
uint32_t p = srcRow[0] | (srcRow[1] << 8) | srcRow[2] << 16;
uint8_t red = masks->getRed(p);
uint8_t green = masks->getGreen(p);
uint8_t blue = masks->getBlue(p);
uint8_t alpha = masks->getAlpha(p);
- UPDATE_RESULT_ALPHA(alpha);
dstPtr[i] = SkPreMultiplyARGB(alpha, red, green, blue);
srcRow += 3 * sampleX;
}
- return COMPUTE_RESULT_ALPHA;
}
-static SkSwizzler::ResultAlpha swizzle_mask24_to_565(
+static void swizzle_mask24_to_565(
void* dstRow, const uint8_t* srcRow, int width, SkMasks* masks,
uint32_t startX, uint32_t sampleX) {
@@ -164,10 +149,9 @@ static SkSwizzler::ResultAlpha swizzle_mask24_to_565(
dstPtr[i] = SkPack888ToRGB16(red, green, blue);
srcRow += 3 * sampleX;
}
- return SkSwizzler::kOpaque_ResultAlpha;
}
-static SkSwizzler::ResultAlpha swizzle_mask32_to_n32_opaque(
+static void swizzle_mask32_to_n32_opaque(
void* dstRow, const uint8_t* srcRow, int width, SkMasks* masks,
uint32_t startX, uint32_t sampleX) {
@@ -182,52 +166,45 @@ static SkSwizzler::ResultAlpha swizzle_mask32_to_n32_opaque(
dstPtr[i] = SkPackARGB32NoCheck(0xFF, red, green, blue);
srcPtr += sampleX;
}
- return SkSwizzler::kOpaque_ResultAlpha;
}
-static SkSwizzler::ResultAlpha swizzle_mask32_to_n32_unpremul(
+static void swizzle_mask32_to_n32_unpremul(
void* dstRow, const uint8_t* srcRow, int width, SkMasks* masks,
uint32_t startX, uint32_t sampleX) {
// Use the masks to decode to the destination
uint32_t* srcPtr = ((uint32_t*) srcRow) + startX;
SkPMColor* dstPtr = (SkPMColor*) dstRow;
- INIT_RESULT_ALPHA;
for (int i = 0; i < width; i++) {
uint32_t p = srcPtr[0];
uint8_t red = masks->getRed(p);
uint8_t green = masks->getGreen(p);
uint8_t blue = masks->getBlue(p);
uint8_t alpha = masks->getAlpha(p);
- UPDATE_RESULT_ALPHA(alpha);
dstPtr[i] = SkPackARGB32NoCheck(alpha, red, green, blue);
srcPtr += sampleX;
}
- return COMPUTE_RESULT_ALPHA;
}
-static SkSwizzler::ResultAlpha swizzle_mask32_to_n32_premul(
+static void swizzle_mask32_to_n32_premul(
void* dstRow, const uint8_t* srcRow, int width, SkMasks* masks,
uint32_t startX, uint32_t sampleX) {
// Use the masks to decode to the destination
uint32_t* srcPtr = ((uint32_t*) srcRow) + startX;
SkPMColor* dstPtr = (SkPMColor*) dstRow;
- INIT_RESULT_ALPHA;
for (int i = 0; i < width; i++) {
uint32_t p = srcPtr[0];
uint8_t red = masks->getRed(p);
uint8_t green = masks->getGreen(p);
uint8_t blue = masks->getBlue(p);
uint8_t alpha = masks->getAlpha(p);
- UPDATE_RESULT_ALPHA(alpha);
dstPtr[i] = SkPreMultiplyARGB(alpha, red, green, blue);
srcPtr += sampleX;
}
- return COMPUTE_RESULT_ALPHA;
}
-static SkSwizzler::ResultAlpha swizzle_mask32_to_565(
+static void swizzle_mask32_to_565(
void* dstRow, const uint8_t* srcRow, int width, SkMasks* masks,
uint32_t startX, uint32_t sampleX) {
// Use the masks to decode to the destination
@@ -241,7 +218,6 @@ static SkSwizzler::ResultAlpha swizzle_mask32_to_565(
dstPtr[i] = SkPack888ToRGB16(red, green, blue);
srcPtr += sampleX;
}
- return SkSwizzler::kOpaque_ResultAlpha;
}
/*
@@ -394,7 +370,7 @@ int SkMaskSwizzler::onSetSampleX(int sampleX) {
* Swizzle the specified row
*
*/
-SkSwizzler::ResultAlpha SkMaskSwizzler::swizzle(void* dst, const uint8_t* SK_RESTRICT src) {
+void SkMaskSwizzler::swizzle(void* dst, const uint8_t* SK_RESTRICT src) {
SkASSERT(nullptr != dst && nullptr != src);
- return fRowProc(dst, src, fDstWidth, fMasks, fX0, fSampleX);
+ fRowProc(dst, src, fDstWidth, fMasks, fX0, fSampleX);
}
« no previous file with comments | « src/codec/SkMaskSwizzler.h ('k') | src/codec/SkSampledCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698