commit | bdd76190e54e6a0e11343dd19e4bf1d06956fa48 | [log] [tgz] |
---|---|---|
author | Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> | Wed Feb 13 01:02:27 2019 |
committer | Commit Bot <commit-bot@chromium.org> | Wed Feb 13 01:02:27 2019 |
tree | b9d9f12f58559ae4281d9dabfbf83dc66bcc4fa6 | |
parent | a3f9b35f9ba7831dfcfda55ad10b5a38af56fb1c [diff] |
BaseRenderingContext2D: Use base::CheckMul and simplify code in putImageData() Follow-up to commit e0b3253a56 ("Fix image conversion truncation issues"). The current code does not build with GCC due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89287: ../../third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc: In member function ‘void blink::BaseRenderingContext2D::putImageData(blink::ImageData*, int, int, int, int, int, int, blink::ExceptionState&)’: ../../third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc:1777:44: error: default type conversion can't deduce template argument for ‘template<class Dst, typename std::enable_if<base::internal::IsNumericRangeContained<Dst, long unsigned int, void>::value, void>::type* <anonymous> > constexpr base::internal::StrictNumeric<T>::operator Dst() const [with Dst = Dst; typename std::enable_if<base::internal::IsNumericRangeContained<Dst, T>::value>::type* <anonymous> = <enumerator>; T = long unsigned int]’ new uint8_t[data_length.ValueOrDie()]); ^ Work around it by using the more idiomatic base::CheckMul() with AssignIfValid, so that we can have |data_length| be a size_t again and not leave it to the compiler to figure out the type we want when creating the |converted_pixels| array. Bug: 819294 Change-Id: Id124cc4f3d749b45def4708e21e4badafd708578 Reviewed-on: https://chromium-review.googlesource.com/c/1467201 Auto-Submit: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> Commit-Queue: Kentaro Hara <haraken@chromium.org> Reviewed-by: Kentaro Hara <haraken@chromium.org> Cr-Commit-Position: refs/heads/master@{#631472}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure .