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

Unified Diff: src/codec/SkCodecPriv.h

Issue 1287423002: Scanline decoding for bmp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Scaling for all types of bmps Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698