examples: Avoid undefined behavior

When 'int' is 32-bits, "1 << 31" is undefined.  So we avoid that
in these couple example programs.

Bug: 8968
Change-Id: Iacaa28bf46a4006de4aee90de33560911744925e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206691
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
Greg Kaiser 2019-04-08 14:31:15 -07:00 committed by Skia Commit-Bot
parent 187a91e363
commit 2f08a4043b
2 changed files with 2 additions and 2 deletions

View File

@ -4,7 +4,7 @@
// HASH=897230ecfb36095486beca324fd369f9
REG_FIDDLE(ImageInfo_minRowBytes, 256, 256, true, 0) {
void draw(SkCanvas* canvas) {
for (int shift = 24; shift < 32; ++shift) {
for (int shift = 24; shift < 31; ++shift) {
int width = 1 << shift;
SkImageInfo imageInfo =
SkImageInfo::Make(width, 1, kRGBA_F16_SkColorType, kPremul_SkAlphaType);

View File

@ -4,7 +4,7 @@
// HASH=4b5d3904476726a39f1c3e276d6b6ba7
REG_FIDDLE(ImageInfo_minRowBytes64, 256, 256, true, 0) {
void draw(SkCanvas* canvas) {
for (int shift = 24; shift < 32; ++shift) {
for (int shift = 24; shift < 31; ++shift) {
int width = 1 << shift;
SkImageInfo imageInfo =
SkImageInfo::Make(width, 1, kRGBA_F16_SkColorType, kPremul_SkAlphaType);