OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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/fxge/cfx_renderdevice.h" | 7 #include "core/fxge/cfx_renderdevice.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 nrows, pGlyph, fill_color, 0, 0, | 1015 nrows, pGlyph, fill_color, 0, 0, |
1016 FXDIB_BLEND_NORMAL, nullptr, false, 0, | 1016 FXDIB_BLEND_NORMAL, nullptr, false, 0, |
1017 nullptr)) { | 1017 nullptr)) { |
1018 return false; | 1018 return false; |
1019 } | 1019 } |
1020 continue; | 1020 continue; |
1021 } | 1021 } |
1022 bool bBGRStripe = !!(text_flags & FXTEXT_BGR_STRIPE); | 1022 bool bBGRStripe = !!(text_flags & FXTEXT_BGR_STRIPE); |
1023 ncols /= 3; | 1023 ncols /= 3; |
1024 int x_subpixel = (int)(glyph.m_fOriginX * 3) % 3; | 1024 int x_subpixel = (int)(glyph.m_fOriginX * 3) % 3; |
1025 int start_col = std::max(left.ValueOrDie(), 0); | 1025 int start_col = std::max(static_cast<int>(left.ValueOrDie<int>()), 0); |
1026 pdfium::base::CheckedNumeric<int> end_col_safe = left; | 1026 pdfium::base::CheckedNumeric<int> end_col_safe = left; |
1027 end_col_safe += ncols; | 1027 end_col_safe += ncols; |
1028 if (!end_col_safe.IsValid()) | 1028 if (!end_col_safe.IsValid()) |
1029 return false; | 1029 return false; |
1030 | 1030 |
1031 int end_col = std::min(end_col_safe.ValueOrDie(), dest_width); | 1031 int end_col = |
| 1032 std::min(static_cast<int>(end_col_safe.ValueOrDie<int>()), dest_width); |
1032 if (start_col >= end_col) | 1033 if (start_col >= end_col) |
1033 continue; | 1034 continue; |
1034 | 1035 |
1035 DrawNormalTextHelper(&bitmap, pGlyph, nrows, left.ValueOrDie(), | 1036 DrawNormalTextHelper(&bitmap, pGlyph, nrows, left.ValueOrDie(), |
1036 top.ValueOrDie(), start_col, end_col, bNormal, | 1037 top.ValueOrDie(), start_col, end_col, bNormal, |
1037 bBGRStripe, x_subpixel, a, r, g, b); | 1038 bBGRStripe, x_subpixel, a, r, g, b); |
1038 } | 1039 } |
1039 if (bitmap.IsAlphaMask()) | 1040 if (bitmap.IsAlphaMask()) |
1040 SetBitMask(&bitmap, bmp_rect.left, bmp_rect.top, fill_color); | 1041 SetBitMask(&bitmap, bmp_rect.left, bmp_rect.top, fill_color); |
1041 else | 1042 else |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1079 fill_color, stroke_color, fill_mode, | 1080 fill_color, stroke_color, fill_mode, |
1080 FXDIB_BLEND_NORMAL)) { | 1081 FXDIB_BLEND_NORMAL)) { |
1081 return false; | 1082 return false; |
1082 } | 1083 } |
1083 } | 1084 } |
1084 if (pClippingPath) | 1085 if (pClippingPath) |
1085 pClippingPath->Append(&TransformedPath, pUser2Device); | 1086 pClippingPath->Append(&TransformedPath, pUser2Device); |
1086 } | 1087 } |
1087 return true; | 1088 return true; |
1088 } | 1089 } |
OLD | NEW |