OLD | NEW |
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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 &filterOffset, &filterLength); | 398 &filterOffset, &filterLength); |
399 | 399 |
400 // Generate output rows until we have enough to run the current filter. | 400 // Generate output rows until we have enough to run the current filter. |
401 while (nextXRow < filterOffset + filterLength) { | 401 while (nextXRow < filterOffset + filterLength) { |
402 if (convolveProcs.fConvolve4RowsHorizontally && | 402 if (convolveProcs.fConvolve4RowsHorizontally && |
403 nextXRow + 3 < lastFilterOffset + lastFilterLength - | 403 nextXRow + 3 < lastFilterOffset + lastFilterLength - |
404 avoidSimdRows) { | 404 avoidSimdRows) { |
405 const unsigned char* src[4]; | 405 const unsigned char* src[4]; |
406 unsigned char* outRow[4]; | 406 unsigned char* outRow[4]; |
407 for (int i = 0; i < 4; ++i) { | 407 for (int i = 0; i < 4; ++i) { |
408 src[i] = &sourceData[(nextXRow + i) * sourceByteRowStride]; | 408 src[i] = &sourceData[(uint64_t)(nextXRow + i) * sourceByteRo
wStride]; |
409 outRow[i] = rowBuffer.advanceRow(); | 409 outRow[i] = rowBuffer.advanceRow(); |
410 } | 410 } |
411 convolveProcs.fConvolve4RowsHorizontally(src, filterX, outRow); | 411 convolveProcs.fConvolve4RowsHorizontally(src, filterX, outRow); |
412 nextXRow += 4; | 412 nextXRow += 4; |
413 } else { | 413 } else { |
414 // Check if we need to avoid SSE2 for this row. | 414 // Check if we need to avoid SSE2 for this row. |
415 if (convolveProcs.fConvolveHorizontally && | 415 if (convolveProcs.fConvolveHorizontally && |
416 nextXRow < lastFilterOffset + lastFilterLength - | 416 nextXRow < lastFilterOffset + lastFilterLength - |
417 avoidSimdRows) { | 417 avoidSimdRows) { |
418 convolveProcs.fConvolveHorizontally( | 418 convolveProcs.fConvolveHorizontally( |
419 &sourceData[nextXRow * sourceByteRowStride], | 419 &sourceData[(uint64_t)nextXRow * sourceByteRowStride], |
420 filterX, rowBuffer.advanceRow(), sourceHasAlpha); | 420 filterX, rowBuffer.advanceRow(), sourceHasAlpha); |
421 } else { | 421 } else { |
422 if (sourceHasAlpha) { | 422 if (sourceHasAlpha) { |
423 ConvolveHorizontally<true>( | 423 ConvolveHorizontally<true>( |
424 &sourceData[nextXRow * sourceByteRowStride], | 424 &sourceData[(uint64_t)nextXRow * sourceByteRowStride
], |
425 filterX, rowBuffer.advanceRow()); | 425 filterX, rowBuffer.advanceRow()); |
426 } else { | 426 } else { |
427 ConvolveHorizontally<false>( | 427 ConvolveHorizontally<false>( |
428 &sourceData[nextXRow * sourceByteRowStride], | 428 &sourceData[(uint64_t)nextXRow * sourceByteRowStride
], |
429 filterX, rowBuffer.advanceRow()); | 429 filterX, rowBuffer.advanceRow()); |
430 } | 430 } |
431 } | 431 } |
432 nextXRow++; | 432 nextXRow++; |
433 } | 433 } |
434 } | 434 } |
435 | 435 |
436 // Compute where in the output image this row of final data will go. | 436 // Compute where in the output image this row of final data will go. |
437 unsigned char* curOutputRow = &output[outY * outputByteRowStride]; | 437 unsigned char* curOutputRow = &output[outY * outputByteRowStride]; |
438 | 438 |
(...skipping 13 matching lines...) Expand all Loading... |
452 filterX.numValues(), curOutputRow
, | 452 filterX.numValues(), curOutputRow
, |
453 sourceHasAlpha); | 453 sourceHasAlpha); |
454 } else { | 454 } else { |
455 ConvolveVertically(filterValues, filterLength, | 455 ConvolveVertically(filterValues, filterLength, |
456 firstRowForFilter, | 456 firstRowForFilter, |
457 filterX.numValues(), curOutputRow, | 457 filterX.numValues(), curOutputRow, |
458 sourceHasAlpha); | 458 sourceHasAlpha); |
459 } | 459 } |
460 } | 460 } |
461 } | 461 } |
OLD | NEW |