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

Unified Diff: src/core/SkBlitMask_D32.cpp

Issue 1530743002: Fix UB function problems for shaders and mask. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix 16-bit masks Created 5 years 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/core/SkBlitMask.h ('k') | src/core/SkBlitter_ARGB32.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBlitMask_D32.cpp
diff --git a/src/core/SkBlitMask_D32.cpp b/src/core/SkBlitMask_D32.cpp
index 3cc791af4ed63417f2905a33fe6051e9ed63a46c..c39ecfb7595d00533b1355d6cda1d134f098c86d 100644
--- a/src/core/SkBlitMask_D32.cpp
+++ b/src/core/SkBlitMask_D32.cpp
@@ -76,9 +76,9 @@ bool SkBlitMask::BlitColor(const SkPixmap& device, const SkMask& mask,
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
-static void BW_RowProc_Blend(SkPMColor* SK_RESTRICT dst,
- const uint8_t* SK_RESTRICT mask,
- const SkPMColor* SK_RESTRICT src, int count) {
+static void BW_RowProc_Blend(
+ SkPMColor* SK_RESTRICT dst, const void* maskIn, const SkPMColor* SK_RESTRICT src, int count) {
+ const uint8_t* SK_RESTRICT mask = static_cast<const uint8_t*>(maskIn);
int i, octuple = (count + 7) >> 3;
for (i = 0; i < octuple; ++i) {
int m = *mask++;
@@ -105,9 +105,9 @@ static void BW_RowProc_Blend(SkPMColor* SK_RESTRICT dst,
}
}
-static void BW_RowProc_Opaque(SkPMColor* SK_RESTRICT dst,
- const uint8_t* SK_RESTRICT mask,
- const SkPMColor* SK_RESTRICT src, int count) {
+static void BW_RowProc_Opaque(
+ SkPMColor* SK_RESTRICT dst, const void* maskIn, const SkPMColor* SK_RESTRICT src, int count) {
+ const uint8_t* SK_RESTRICT mask = static_cast<const uint8_t*>(maskIn);
int i, octuple = (count + 7) >> 3;
for (i = 0; i < octuple; ++i) {
int m = *mask++;
@@ -134,9 +134,9 @@ static void BW_RowProc_Opaque(SkPMColor* SK_RESTRICT dst,
}
}
-static void A8_RowProc_Blend(SkPMColor* SK_RESTRICT dst,
- const uint8_t* SK_RESTRICT mask,
- const SkPMColor* SK_RESTRICT src, int count) {
+static void A8_RowProc_Blend(
+ SkPMColor* SK_RESTRICT dst, const void* maskIn, const SkPMColor* SK_RESTRICT src, int count) {
+ const uint8_t* SK_RESTRICT mask = static_cast<const uint8_t*>(maskIn);
for (int i = 0; i < count; ++i) {
if (mask[i]) {
dst[i] = SkBlendARGB32(src[i], dst[i], mask[i]);
@@ -153,9 +153,9 @@ static void A8_RowProc_Blend(SkPMColor* SK_RESTRICT dst,
#define EXPAND1(v, m, s) (((v) >> 8) & (m)) * (s)
#define COMBINE(e0, e1, m) ((((e0) >> 8) & (m)) | ((e1) & ~(m)))
-static void A8_RowProc_Opaque(SkPMColor* SK_RESTRICT dst,
- const uint8_t* SK_RESTRICT mask,
- const SkPMColor* SK_RESTRICT src, int count) {
+static void A8_RowProc_Opaque(
+ SkPMColor* SK_RESTRICT dst, const void* maskIn, const SkPMColor* SK_RESTRICT src, int count) {
+ const uint8_t* SK_RESTRICT mask = static_cast<const uint8_t*>(maskIn);
for (int i = 0; i < count; ++i) {
int m = mask[i];
if (m) {
@@ -188,9 +188,9 @@ static int src_alpha_blend(int src, int dst, int srcA, int mask) {
return dst + SkAlphaMul(src - SkAlphaMul(srcA, dst), mask);
}
-static void LCD16_RowProc_Blend(SkPMColor* SK_RESTRICT dst,
- const uint16_t* SK_RESTRICT mask,
- const SkPMColor* SK_RESTRICT src, int count) {
+static void LCD16_RowProc_Blend(
+ SkPMColor* SK_RESTRICT dst, const void* maskIn, const SkPMColor* SK_RESTRICT src, int count) {
+ const uint16_t* SK_RESTRICT mask = static_cast<const uint16_t*>(maskIn);
for (int i = 0; i < count; ++i) {
uint16_t m = mask[i];
if (0 == m) {
@@ -231,9 +231,9 @@ static void LCD16_RowProc_Blend(SkPMColor* SK_RESTRICT dst,
}
}
-static void LCD16_RowProc_Opaque(SkPMColor* SK_RESTRICT dst,
- const uint16_t* SK_RESTRICT mask,
- const SkPMColor* SK_RESTRICT src, int count) {
+static void LCD16_RowProc_Opaque(
+ SkPMColor* SK_RESTRICT dst, const void* maskIn, const SkPMColor* SK_RESTRICT src, int count) {
+ const uint16_t* SK_RESTRICT mask = static_cast<const uint16_t*>(maskIn);
for (int i = 0; i < count; ++i) {
uint16_t m = mask[i];
if (0 == m) {
« no previous file with comments | « src/core/SkBlitMask.h ('k') | src/core/SkBlitter_ARGB32.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698