Plumb through out_row byte length so we can assert we stay underneath it.
Sadly, not asserting for me yet. Can't hurt. BUG=chromium:491660 Review URL: https://codereview.chromium.org/1187173005
This commit is contained in:
parent
525e90ab92
commit
cd08effd00
@ -436,7 +436,7 @@ void BGRAConvolve2D(const unsigned char* sourceData,
|
||||
src[i] = &sourceData[(uint64_t)(nextXRow + i) * sourceByteRowStride];
|
||||
outRow[i] = rowBuffer.advanceRow();
|
||||
}
|
||||
convolveProcs.fConvolve4RowsHorizontally(src, filterX, outRow);
|
||||
convolveProcs.fConvolve4RowsHorizontally(src, filterX, outRow, 4*rowBufferWidth);
|
||||
nextXRow += 4;
|
||||
} else {
|
||||
// Check if we need to avoid SSE2 for this row.
|
||||
|
@ -153,7 +153,8 @@ typedef void (*SkConvolveVertically_pointer)(
|
||||
typedef void (*SkConvolve4RowsHorizontally_pointer)(
|
||||
const unsigned char* srcData[4],
|
||||
const SkConvolutionFilter1D& filter,
|
||||
unsigned char* outRow[4]);
|
||||
unsigned char* outRow[4],
|
||||
size_t outRowBytes);
|
||||
typedef void (*SkConvolveHorizontally_pointer)(
|
||||
const unsigned char* srcData,
|
||||
const SkConvolutionFilter1D& filter,
|
||||
|
@ -174,7 +174,10 @@ void convolveHorizontally_SSE2(const unsigned char* src_data,
|
||||
// refer to that function for detailed comments.
|
||||
void convolve4RowsHorizontally_SSE2(const unsigned char* src_data[4],
|
||||
const SkConvolutionFilter1D& filter,
|
||||
unsigned char* out_row[4]) {
|
||||
unsigned char* out_row[4],
|
||||
size_t outRowBytes) {
|
||||
SkDEBUGCODE(const unsigned char* out_row_0_start = out_row[0];)
|
||||
|
||||
int num_values = filter.numValues();
|
||||
|
||||
int filter_offset, filter_length;
|
||||
@ -275,6 +278,9 @@ void convolve4RowsHorizontally_SSE2(const unsigned char* src_data[4],
|
||||
accum3 = _mm_packs_epi32(accum3, zero);
|
||||
accum3 = _mm_packus_epi16(accum3, zero);
|
||||
|
||||
// We seem to be running off the edge here (chromium:491660).
|
||||
SkASSERT(((size_t)out_row[0] - (size_t)out_row_0_start) < outRowBytes);
|
||||
|
||||
*(reinterpret_cast<int*>(out_row[0])) = _mm_cvtsi128_si32(accum0);
|
||||
*(reinterpret_cast<int*>(out_row[1])) = _mm_cvtsi128_si32(accum1);
|
||||
*(reinterpret_cast<int*>(out_row[2])) = _mm_cvtsi128_si32(accum2);
|
||||
|
@ -19,7 +19,8 @@ void convolveVertically_SSE2(const SkConvolutionFilter1D::ConvolutionFixed* filt
|
||||
bool has_alpha);
|
||||
void convolve4RowsHorizontally_SSE2(const unsigned char* src_data[4],
|
||||
const SkConvolutionFilter1D& filter,
|
||||
unsigned char* out_row[4]);
|
||||
unsigned char* out_row[4],
|
||||
size_t outRowBytes);
|
||||
void convolveHorizontally_SSE2(const unsigned char* src_data,
|
||||
const SkConvolutionFilter1D& filter,
|
||||
unsigned char* out_row,
|
||||
|
@ -389,7 +389,8 @@ void convolveVertically_neon(const SkConvolutionFilter1D::ConvolutionFixed* filt
|
||||
// refer to that function for detailed comments.
|
||||
void convolve4RowsHorizontally_neon(const unsigned char* srcData[4],
|
||||
const SkConvolutionFilter1D& filter,
|
||||
unsigned char* outRow[4]) {
|
||||
unsigned char* outRow[4],
|
||||
size_t outRowBytes) {
|
||||
|
||||
uint8x8_t coeff_mask0 = vcreate_u8(0x0100010001000100);
|
||||
uint8x8_t coeff_mask1 = vcreate_u8(0x0302030203020302);
|
||||
|
Loading…
Reference in New Issue
Block a user