Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: core/fxge/ge/cfx_renderdevice.cpp

Issue 2640143003: Update safe numerics package to get bitwise ops (Closed)
Patch Set: Address reviewer comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/fxcrt/fx_extension.cpp ('k') | core/fxge/ge/fx_ge_text.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 =
1026 pdfium::base::ValueOrDieForType<int>(pdfium::base::CheckMax(left, 0));
1026 pdfium::base::CheckedNumeric<int> end_col_safe = left; 1027 pdfium::base::CheckedNumeric<int> end_col_safe = left;
1027 end_col_safe += ncols; 1028 end_col_safe += ncols;
1028 if (!end_col_safe.IsValid()) 1029 if (!end_col_safe.IsValid())
1029 return false; 1030 return false;
1030 1031
1031 int end_col = std::min(end_col_safe.ValueOrDie(), dest_width); 1032 int end_col =
1033 std::min(static_cast<int>(end_col_safe.ValueOrDie<int>()), dest_width);
1032 if (start_col >= end_col) 1034 if (start_col >= end_col)
1033 continue; 1035 continue;
1034 1036
1035 DrawNormalTextHelper(&bitmap, pGlyph, nrows, left.ValueOrDie(), 1037 DrawNormalTextHelper(&bitmap, pGlyph, nrows, left.ValueOrDie(),
1036 top.ValueOrDie(), start_col, end_col, bNormal, 1038 top.ValueOrDie(), start_col, end_col, bNormal,
1037 bBGRStripe, x_subpixel, a, r, g, b); 1039 bBGRStripe, x_subpixel, a, r, g, b);
1038 } 1040 }
1039 if (bitmap.IsAlphaMask()) 1041 if (bitmap.IsAlphaMask())
1040 SetBitMask(&bitmap, bmp_rect.left, bmp_rect.top, fill_color); 1042 SetBitMask(&bitmap, bmp_rect.left, bmp_rect.top, fill_color);
1041 else 1043 else
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 fill_color, stroke_color, fill_mode, 1081 fill_color, stroke_color, fill_mode,
1080 FXDIB_BLEND_NORMAL)) { 1082 FXDIB_BLEND_NORMAL)) {
1081 return false; 1083 return false;
1082 } 1084 }
1083 } 1085 }
1084 if (pClippingPath) 1086 if (pClippingPath)
1085 pClippingPath->Append(&TransformedPath, pUser2Device); 1087 pClippingPath->Append(&TransformedPath, pUser2Device);
1086 } 1088 }
1087 return true; 1089 return true;
1088 } 1090 }
OLDNEW
« no previous file with comments | « core/fxcrt/fx_extension.cpp ('k') | core/fxge/ge/fx_ge_text.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698