rewrite SkMasks::CreateMasks to work in bytesPerPixel
This ought to make it a bit more clear that undefined
shifts (like 1<<31, 1<<32, 1<<33) are not possible,
only 1<<8, 1<<16, 1<<24.
Change-Id: Ia358f9204e5956ba6c23603c5961af86a991b659
Reviewed-on: https://skia-review.googlesource.com/c/192030
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-by: Greg Kaiser <gkaiser@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
diff --git a/src/codec/SkBmpCodec.cpp b/src/codec/SkBmpCodec.cpp
index e13dccb..b09d39e 100644
--- a/src/codec/SkBmpCodec.cpp
+++ b/src/codec/SkBmpCodec.cpp
@@ -520,7 +520,8 @@
if (codecOut) {
// Check that input bit masks are valid and create the masks object
- std::unique_ptr<SkMasks> masks(SkMasks::CreateMasks(inputMasks, bitsPerPixel));
+ SkASSERT(bitsPerPixel % 8 == 0);
+ std::unique_ptr<SkMasks> masks(SkMasks::CreateMasks(inputMasks, bitsPerPixel/8));
if (nullptr == masks) {
SkCodecPrintf("Error: invalid input masks.\n");
return kInvalidInput;