diff options
author | Lei Zhang <thestig@chromium.org> | 2018-04-19 20:55:44 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-04-19 20:55:44 +0000 |
commit | c84ea8eda5a53229cf1faaed7cb54013b9ea18c3 (patch) | |
tree | cd19301cc122aceb5258dcc2eca7a08f6376d82f /core/fpdfapi/render/cpdf_renderstatus.cpp | |
parent | efb23f332bb3c17c1fa9f4cd5a0cf830d7d63a66 (diff) | |
download | pdfium-c84ea8eda5a53229cf1faaed7cb54013b9ea18c3.tar.xz |
Change SHADING_STEPS from a #define to a constant.
Change-Id: I06eab59d7944309d6fe99b97956e8ffb11d64088
Reviewed-on: https://pdfium-review.googlesource.com/30991
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/render/cpdf_renderstatus.cpp')
-rw-r--r-- | core/fpdfapi/render/cpdf_renderstatus.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index 74e4797b73..abccde52b4 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -65,10 +65,10 @@ #include "core/fxge/skia/fx_skia_device.h" #endif -#define SHADING_STEPS 256 - namespace { +constexpr int kShadingSteps = 256; + void ReleaseCachedType3(CPDF_Type3Font* pFont) { CPDF_Document* pDoc = pFont->GetDocument(); if (!pDoc) @@ -152,9 +152,9 @@ void DrawAxialShading(const RetainPtr<CFX_DIBitmap>& pBitmap, CFX_FixedBufGrow<float, 16> result_array(total_results); float* pResults = result_array; memset(pResults, 0, total_results * sizeof(float)); - uint32_t rgb_array[SHADING_STEPS]; - for (int i = 0; i < SHADING_STEPS; i++) { - float input = (t_max - t_min) * i / SHADING_STEPS + t_min; + uint32_t rgb_array[kShadingSteps]; + for (int i = 0; i < kShadingSteps; i++) { + float input = (t_max - t_min) * i / kShadingSteps + t_min; int offset = 0; for (const auto& func : funcs) { if (func) { @@ -181,17 +181,17 @@ void DrawAxialShading(const RetainPtr<CFX_DIBitmap>& pBitmap, float scale = (((pos.x - start_x) * x_span) + ((pos.y - start_y) * y_span)) / axis_len_square; - int index = (int32_t)(scale * (SHADING_STEPS - 1)); + int index = (int32_t)(scale * (kShadingSteps - 1)); if (index < 0) { if (!bStartExtend) continue; index = 0; - } else if (index >= SHADING_STEPS) { + } else if (index >= kShadingSteps) { if (!bEndExtend) continue; - index = SHADING_STEPS - 1; + index = kShadingSteps - 1; } dib_buf[column] = rgb_array[index]; } @@ -238,9 +238,9 @@ void DrawRadialShading(const RetainPtr<CFX_DIBitmap>& pBitmap, CFX_FixedBufGrow<float, 16> result_array(total_results); float* pResults = result_array; memset(pResults, 0, total_results * sizeof(float)); - uint32_t rgb_array[SHADING_STEPS]; - for (int i = 0; i < SHADING_STEPS; i++) { - float input = (t_max - t_min) * i / SHADING_STEPS + t_min; + uint32_t rgb_array[kShadingSteps]; + for (int i = 0; i < kShadingSteps; i++) { + float input = (t_max - t_min) * i / kShadingSteps + t_min; int offset = 0; for (const auto& func : funcs) { if (func) { @@ -316,18 +316,18 @@ void DrawRadialShading(const RetainPtr<CFX_DIBitmap>& pBitmap, continue; } } - int index = (int32_t)(s * (SHADING_STEPS - 1)); + int index = (int32_t)(s * (kShadingSteps - 1)); if (index < 0) { if (!bStartExtend) { continue; } index = 0; } - if (index >= SHADING_STEPS) { + if (index >= kShadingSteps) { if (!bEndExtend) { continue; } - index = SHADING_STEPS - 1; + index = kShadingSteps - 1; } dib_buf[column] = rgb_array[index]; } |