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

Side by Side Diff: core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp

Issue 2319343003: Switch to ValueOrDie (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_render/render_int.h" 7 #include "core/fpdfapi/fpdf_render/render_int.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 pdfium::base::CheckedNumeric<int> safeStartX = 1142 pdfium::base::CheckedNumeric<int> safeStartX =
1143 FXSYS_round(orig_x + left_offset); 1143 FXSYS_round(orig_x + left_offset);
1144 pdfium::base::CheckedNumeric<int> safeStartY = 1144 pdfium::base::CheckedNumeric<int> safeStartY =
1145 FXSYS_round(orig_y + top_offset); 1145 FXSYS_round(orig_y + top_offset);
1146 1146
1147 safeStartX -= clip_box.left; 1147 safeStartX -= clip_box.left;
1148 safeStartY -= clip_box.top; 1148 safeStartY -= clip_box.top;
1149 if (!safeStartX.IsValid() || !safeStartY.IsValid()) 1149 if (!safeStartX.IsValid() || !safeStartY.IsValid())
1150 return; 1150 return;
1151 1151
1152 start_x = safeStartX.ValueOrDefault(0); 1152 start_x = safeStartX.ValueOrDie();
1153 start_y = safeStartY.ValueOrDefault(0); 1153 start_y = safeStartY.ValueOrDie();
1154 } 1154 }
1155 if (width == 1 && height == 1) { 1155 if (width == 1 && height == 1) {
1156 if (start_x < 0 || start_x >= clip_box.Width() || start_y < 0 || 1156 if (start_x < 0 || start_x >= clip_box.Width() || start_y < 0 ||
1157 start_y >= clip_box.Height()) { 1157 start_y >= clip_box.Height()) {
1158 continue; 1158 continue;
1159 } 1159 }
1160 uint32_t* dest_buf = 1160 uint32_t* dest_buf =
1161 (uint32_t*)(screen.GetBuffer() + screen.GetPitch() * start_y + 1161 (uint32_t*)(screen.GetBuffer() + screen.GetPitch() * start_y +
1162 start_x * 4); 1162 start_x * 4);
1163 if (pPattern->colored()) 1163 if (pPattern->colored())
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 } 1206 }
1207 } 1207 }
1208 if (bStroke) { 1208 if (bStroke) {
1209 const CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor(); 1209 const CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor();
1210 if (StrokeColor.IsPattern()) { 1210 if (StrokeColor.IsPattern()) {
1211 DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE); 1211 DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE);
1212 bStroke = FALSE; 1212 bStroke = FALSE;
1213 } 1213 }
1214 } 1214 }
1215 } 1215 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698