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

Side by Side Diff: src/core/SkConvolver.cpp

Issue 1187173005: Plumb through out_row byte length so we can assert we stay underneath it. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « src/core/SkConvolver.h ('k') | src/opts/SkBitmapFilter_opts_SSE2.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "SkConvolver.h" 5 #include "SkConvolver.h"
6 #include "SkSize.h" 6 #include "SkSize.h"
7 #include "SkTypes.h" 7 #include "SkTypes.h"
8 8
9 namespace { 9 namespace {
10 10
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 while (nextXRow < filterOffset + filterLength) { 429 while (nextXRow < filterOffset + filterLength) {
430 if (convolveProcs.fConvolve4RowsHorizontally && 430 if (convolveProcs.fConvolve4RowsHorizontally &&
431 nextXRow + 3 < lastFilterOffset + lastFilterLength - 431 nextXRow + 3 < lastFilterOffset + lastFilterLength -
432 avoidSimdRows) { 432 avoidSimdRows) {
433 const unsigned char* src[4]; 433 const unsigned char* src[4];
434 unsigned char* outRow[4]; 434 unsigned char* outRow[4];
435 for (int i = 0; i < 4; ++i) { 435 for (int i = 0; i < 4; ++i) {
436 src[i] = &sourceData[(uint64_t)(nextXRow + i) * sourceByteRo wStride]; 436 src[i] = &sourceData[(uint64_t)(nextXRow + i) * sourceByteRo wStride];
437 outRow[i] = rowBuffer.advanceRow(); 437 outRow[i] = rowBuffer.advanceRow();
438 } 438 }
439 convolveProcs.fConvolve4RowsHorizontally(src, filterX, outRow); 439 convolveProcs.fConvolve4RowsHorizontally(src, filterX, outRow, 4 *rowBufferWidth);
440 nextXRow += 4; 440 nextXRow += 4;
441 } else { 441 } else {
442 // Check if we need to avoid SSE2 for this row. 442 // Check if we need to avoid SSE2 for this row.
443 if (convolveProcs.fConvolveHorizontally && 443 if (convolveProcs.fConvolveHorizontally &&
444 nextXRow < lastFilterOffset + lastFilterLength - 444 nextXRow < lastFilterOffset + lastFilterLength -
445 avoidSimdRows) { 445 avoidSimdRows) {
446 convolveProcs.fConvolveHorizontally( 446 convolveProcs.fConvolveHorizontally(
447 &sourceData[(uint64_t)nextXRow * sourceByteRowStride], 447 &sourceData[(uint64_t)nextXRow * sourceByteRowStride],
448 filterX, rowBuffer.advanceRow(), sourceHasAlpha); 448 filterX, rowBuffer.advanceRow(), sourceHasAlpha);
449 } else { 449 } else {
(...skipping 30 matching lines...) Expand all
480 filterX.numValues(), curOutputRow , 480 filterX.numValues(), curOutputRow ,
481 sourceHasAlpha); 481 sourceHasAlpha);
482 } else { 482 } else {
483 ConvolveVertically(filterValues, filterLength, 483 ConvolveVertically(filterValues, filterLength,
484 firstRowForFilter, 484 firstRowForFilter,
485 filterX.numValues(), curOutputRow, 485 filterX.numValues(), curOutputRow,
486 sourceHasAlpha); 486 sourceHasAlpha);
487 } 487 }
488 } 488 }
489 } 489 }
OLDNEW
« no previous file with comments | « src/core/SkConvolver.h ('k') | src/opts/SkBitmapFilter_opts_SSE2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698