diff options
author | Lei Zhang <thestig@chromium.org> | 2018-09-20 12:56:04 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-09-20 12:56:04 +0000 |
commit | dd92aa5946259b3252beec2b4760adbfa9f985a4 (patch) | |
tree | 0b069943bcfb437ea35bc0da0abf771cda80a14e /core/fxge | |
parent | 109aa6d0f673aee11a398aae478fb758fc73a33f (diff) | |
download | pdfium-dd92aa5946259b3252beec2b4760adbfa9f985a4.tar.xz |
Fix misc lint errors and other cleanups.
Change-Id: I00ce0109251d1231858e87ffc3889abe6937fa26
Reviewed-on: https://pdfium-review.googlesource.com/42811
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxge')
-rw-r--r-- | core/fxge/apple/apple_int.h | 4 | ||||
-rw-r--r-- | core/fxge/dib/cfx_dibitmap.cpp | 12 |
2 files changed, 7 insertions, 9 deletions
diff --git a/core/fxge/apple/apple_int.h b/core/fxge/apple/apple_int.h index e84387a3c8..a53b91b00b 100644 --- a/core/fxge/apple/apple_int.h +++ b/core/fxge/apple/apple_int.h @@ -9,14 +9,14 @@ #include "core/fxcrt/fx_system.h" +#include <Carbon/Carbon.h> + #include "core/fxge/cfx_graphstatedata.h" #include "core/fxge/cfx_pathdata.h" #include "core/fxge/cfx_renderdevice.h" #include "core/fxge/fx_dib.h" #include "core/fxge/renderdevicedriver_iface.h" -#include <Carbon/Carbon.h> - class CQuartz2D { public: void* createGraphics(const RetainPtr<CFX_DIBitmap>& bitmap); diff --git a/core/fxge/dib/cfx_dibitmap.cpp b/core/fxge/dib/cfx_dibitmap.cpp index 89cfbb68d3..0dbf47cbf8 100644 --- a/core/fxge/dib/cfx_dibitmap.cpp +++ b/core/fxge/dib/cfx_dibitmap.cpp @@ -15,11 +15,10 @@ #include "core/fxge/dib/cfx_scanlinecompositor.h" #include "third_party/base/ptr_util.h" -#define MAX_OOM_LIMIT 12000000 - namespace { -const int8_t kChannelOffset[] = {0, 2, 1, 0, 0, 1, 2, 3, 3}; +constexpr size_t kMaxOOMLimit = 12000000; +constexpr int8_t kChannelOffset[] = {0, 2, 1, 0, 0, 1, 2, 3, 3}; } // namespace @@ -47,16 +46,14 @@ bool CFX_DIBitmap::Create(int width, m_Pitch = 0; uint32_t calculatedSize; - if (!CFX_DIBitmap::CalculatePitchAndSize(height, width, format, &pitch, - &calculatedSize)) + if (!CalculatePitchAndSize(height, width, format, &pitch, &calculatedSize)) return false; if (pBuffer) { m_pBuffer.Reset(pBuffer); } else { size_t bufferSize = calculatedSize + 4; - size_t oomlimit = MAX_OOM_LIMIT; - if (bufferSize >= oomlimit) { + if (bufferSize >= kMaxOOMLimit) { m_pBuffer = std::unique_ptr<uint8_t, FxFreeDeleter>( FX_TryAlloc(uint8_t, bufferSize)); if (!m_pBuffer) @@ -852,6 +849,7 @@ bool CFX_DIBitmap::ConvertColorScale(uint32_t forecolor, uint32_t backcolor) { return true; } +// static bool CFX_DIBitmap::CalculatePitchAndSize(int height, int width, FXDIB_Format format, |