OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "core/fpdfapi/fpdf_page/pageint.h" | 7 #include "core/fpdfapi/fpdf_page/pageint.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 if (type == kTensorProductPatchMeshShading) | 51 if (type == kTensorProductPatchMeshShading) |
52 point_count = kTensorCoordinatePairs; | 52 point_count = kTensorCoordinatePairs; |
53 else if (type == kCoonsPatchMeshShading) | 53 else if (type == kCoonsPatchMeshShading) |
54 point_count = kCoonsCoordinatePairs; | 54 point_count = kCoonsCoordinatePairs; |
55 | 55 |
56 int color_count = kSingleColorPerPatch; | 56 int color_count = kSingleColorPerPatch; |
57 if (type == kCoonsPatchMeshShading || type == kTensorProductPatchMeshShading) | 57 if (type == kCoonsPatchMeshShading || type == kTensorProductPatchMeshShading) |
58 color_count = kQuadColorsPerPatch; | 58 color_count = kQuadColorsPerPatch; |
59 | 59 |
60 while (!stream.m_BitStream.IsEOF()) { | 60 while (!stream.m_BitStream.IsEOF()) { |
61 FX_DWORD flag = 0; | 61 uint32_t flag = 0; |
62 if (type != kLatticeFormGouraudTriangleMeshShading) | 62 if (type != kLatticeFormGouraudTriangleMeshShading) |
63 flag = stream.GetFlag(); | 63 flag = stream.GetFlag(); |
64 | 64 |
65 if (!bGouraud && flag) { | 65 if (!bGouraud && flag) { |
66 point_count -= 4; | 66 point_count -= 4; |
67 color_count -= 2; | 67 color_count -= 2; |
68 } | 68 } |
69 | 69 |
70 for (int i = 0; i < point_count; i++) { | 70 for (int i = 0; i < point_count; i++) { |
71 FX_FLOAT x, y; | 71 FX_FLOAT x, y; |
72 stream.GetCoords(x, y); | 72 stream.GetCoords(x, y); |
73 if (bStarted) { | 73 if (bStarted) { |
74 rect.UpdateRect(x, y); | 74 rect.UpdateRect(x, y); |
75 } else { | 75 } else { |
76 rect.InitRect(x, y); | 76 rect.InitRect(x, y); |
77 bStarted = TRUE; | 77 bStarted = TRUE; |
78 } | 78 } |
79 } | 79 } |
80 stream.m_BitStream.SkipBits(stream.m_nComps * stream.m_nCompBits * | 80 stream.m_BitStream.SkipBits(stream.m_nComps * stream.m_nCompBits * |
81 color_count); | 81 color_count); |
82 if (bGouraud) | 82 if (bGouraud) |
83 stream.m_BitStream.ByteAlign(); | 83 stream.m_BitStream.ByteAlign(); |
84 } | 84 } |
85 rect.Transform(pMatrix); | 85 rect.Transform(pMatrix); |
86 return rect; | 86 return rect; |
87 } | 87 } |
OLD | NEW |