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

Unified Diff: ui/gfx/buffer_format_util.cc

Issue 2545523002: Fix RowSizeForBufferFormatChecked use of base/numerics (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/buffer_format_util.cc
diff --git a/ui/gfx/buffer_format_util.cc b/ui/gfx/buffer_format_util.cc
index 931b36d7947ecb151335cf2d9b0d6a42e923f026..4432b3e9a6c88568fe60ea4165f99b42816cd981 100644
--- a/ui/gfx/buffer_format_util.cc
+++ b/ui/gfx/buffer_format_util.cc
@@ -53,7 +53,7 @@ bool RowSizeForBufferFormatChecked(
checked_size += 3;
if (!checked_size.IsValid())
return false;
- *size_in_bytes = checked_size.ValueOrDie() & ~0x3;
+ *size_in_bytes = (checked_size & ~0x3).ValueOrDie();
danakj 2016/11/30 23:13:20 I'm not clear why this is better. bitmask operatio
return true;
case BufferFormat::RG_88:
case BufferFormat::BGR_565:
@@ -63,7 +63,7 @@ bool RowSizeForBufferFormatChecked(
checked_size += 3;
if (!checked_size.IsValid())
return false;
- *size_in_bytes = checked_size.ValueOrDie() & ~0x3;
+ *size_in_bytes = (checked_size & ~0x3).ValueOrDie();
return true;
case BufferFormat::BGRX_8888:
case BufferFormat::RGBX_8888:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698