summaryrefslogtreecommitdiff
path: root/core/fxge/dib/cfx_imagestretcher.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-09-25 20:06:50 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-09-25 20:06:50 +0000
commit30dc6aaf878b2c55efcf7598fdb8886e06d14e01 (patch)
tree2de58de8c2eddd4efb5dc8a8c5b54cd3faad4972 /core/fxge/dib/cfx_imagestretcher.cpp
parent958142efa4561b5efd52733ad6c3b889cf49b3ae (diff)
downloadpdfium-30dc6aaf878b2c55efcf7598fdb8886e06d14e01.tar.xz
Add FxAlignToBoundary<>() template helper function.
Because I nearly botched this trivial calculation in the previous CL. Change-Id: I7438f9d3476d93b7899c2d7d761234769f53f9e3 Reviewed-on: https://pdfium-review.googlesource.com/43010 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fxge/dib/cfx_imagestretcher.cpp')
-rw-r--r--core/fxge/dib/cfx_imagestretcher.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/core/fxge/dib/cfx_imagestretcher.cpp b/core/fxge/dib/cfx_imagestretcher.cpp
index 809d3b12dd..ea4dcaea49 100644
--- a/core/fxge/dib/cfx_imagestretcher.cpp
+++ b/core/fxge/dib/cfx_imagestretcher.cpp
@@ -160,10 +160,11 @@ bool CFX_ImageStretcher::StartQuickStretch() {
return false;
size *= m_DestBPP;
- m_pScanline.reset(FX_Alloc(uint8_t, (size / 8 + 3) / 4 * 4));
- if (m_pSource->m_pAlphaMask)
- m_pMaskScanline.reset(FX_Alloc(uint8_t, (m_ClipRect.Width() + 3) / 4 * 4));
-
+ m_pScanline.reset(FX_Alloc(uint8_t, FxAlignToBoundary<4>(size / 8)));
+ if (m_pSource->m_pAlphaMask) {
+ m_pMaskScanline.reset(
+ FX_Alloc(uint8_t, FxAlignToBoundary<4>(m_ClipRect.Width())));
+ }
if (SourceSizeWithinLimit(m_pSource->GetWidth(), m_pSource->GetHeight())) {
ContinueQuickStretch(nullptr);
return false;