Index: src/codec/SkCodecPriv.h |
diff --git a/src/codec/SkCodecPriv.h b/src/codec/SkCodecPriv.h |
index 450457f630137c98b854be9f2ad8ad963f8c71d0..5f4b5651996bc0f9392a5f952722da75a968cadf 100644 |
--- a/src/codec/SkCodecPriv.h |
+++ b/src/codec/SkCodecPriv.h |
@@ -131,6 +131,16 @@ static inline size_t compute_row_bytes(int width, uint32_t bitsPerPixel) { |
} |
} |
+static bool is_coord_necessary(int srcCoord, int start, int sampleSize, int scaledDim) { |
+ // Check for edge cases on the first few rows or the last few rows |
+ if (srcCoord < start || srcCoord / sampleSize >= scaledDim) { |
+ return false; |
+ } |
+ |
+ // Every sampleY rows are necessary |
+ return ((srcCoord - start) % sampleSize) == 0; |
+} |
+ |
/* |
* Get a byte from a buffer |
* This method is unsafe, the caller is responsible for performing a check |