summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_render
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2015-10-27 13:24:54 -0400
committerDan Sinclair <dsinclair@chromium.org>2015-10-27 13:24:54 -0400
commitc5fd3e95fbc42f41479f803e4f2f0b4a7c4fc612 (patch)
treeac7aed27b7ec568b2d86863d8845beb0017dbb3e /core/src/fpdfapi/fpdf_render
parenteb815bf1c91d74bb03df52f8f7c586d2b2130341 (diff)
downloadpdfium-c5fd3e95fbc42f41479f803e4f2f0b4a7c4fc612.tar.xz
Merge to XFA: Give names to the shading types
Currently the shading types are referenced by number. This Cl creates and enum and updates the code to use the enum names instead of magic numbers. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1418623011 . (cherry picked from commit 468974316ed5f6b6f8e637ab2c7afedc7c2bfe6a) Review URL: https://codereview.chromium.org/1428573002 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_render')
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
index 4ed6c07675..467ffc900c 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
@@ -868,33 +868,37 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern,
pBitmap->Clear(background);
int fill_mode = m_Options.m_Flags;
switch (pPattern->m_ShadingType) {
- case 1:
+ case kInvalidShading:
+ case kMaxShading:
+ return;
+ case kFunctionBasedShading:
DrawFuncShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs, pColorSpace,
alpha);
break;
- case 2:
+ case kAxialShading:
DrawAxialShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs,
pColorSpace, alpha);
break;
- case 3:
+ case kRadialShading:
DrawRadialShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs,
pColorSpace, alpha);
break;
- case 4: {
+ case kFreeFormGouraudTriangleMeshShading: {
DrawFreeGouraudShading(pBitmap, &FinalMatrix,
ToStream(pPattern->m_pShadingObj), pFuncs, nFuncs,
pColorSpace, alpha);
} break;
- case 5: {
+ case kLatticeFormGouraudTriangleMeshShading: {
DrawLatticeGouraudShading(pBitmap, &FinalMatrix,
ToStream(pPattern->m_pShadingObj), pFuncs,
nFuncs, pColorSpace, alpha);
} break;
- case 6:
- case 7: {
- DrawCoonPatchMeshes(pPattern->m_ShadingType - 6, pBitmap, &FinalMatrix,
- ToStream(pPattern->m_pShadingObj), pFuncs, nFuncs,
- pColorSpace, fill_mode, alpha);
+ case kCoonsPatchMeshShading:
+ case kTensorProductPatchMeshShading: {
+ DrawCoonPatchMeshes(
+ pPattern->m_ShadingType == kTensorProductPatchMeshShading, pBitmap,
+ &FinalMatrix, ToStream(pPattern->m_pShadingObj), pFuncs, nFuncs,
+ pColorSpace, fill_mode, alpha);
} break;
}
if (bAlphaMode) {