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

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

Issue 2640143003: Update safe numerics package to get bitwise ops (Closed)
Patch Set: 0 is a perfectly fine value of zero Created 3 years, 11 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
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 = std::max(static_cast<int>(left.ValueOrDie<int>()), 0);
dsinclair 2017/01/23 14:46:33 If this is templated as <int> why do we need the c
jschuh 2017/01/23 17:05:19 Because the type returned from ValueOrDie is a Str
Tom Sepez 2017/01/23 18:19:14 done, used functional form rather than template ke
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698