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

Unified Diff: samples/pdfium_test.cc

Issue 1292653002: Merge to XFA: Remove if checks after new. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@xfa
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/src/pdfwindow/PWL_Wnd.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/pdfium_test.cc
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index 7ecd9a2aee9a75aab4e15af674610979e1ddd683..83a8f7620b6fadc0079cbd22689ba5a22b2a00dd 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -145,22 +145,20 @@ static void WritePpm(const char* pdf_name, int num, const void* buffer_void,
// Source data is B, G, R, unused.
// Dest data is R, G, B.
char* result = new char[out_len];
- if (result) {
- for (int h = 0; h < height; ++h) {
- const char* src_line = buffer + (stride * h);
- char* dest_line = result + (width * h * 3);
- for (int w = 0; w < width; ++w) {
- // R
- dest_line[w * 3] = src_line[(w * 4) + 2];
- // G
- dest_line[(w * 3) + 1] = src_line[(w * 4) + 1];
- // B
- dest_line[(w * 3) + 2] = src_line[w * 4];
- }
+ for (int h = 0; h < height; ++h) {
+ const char* src_line = buffer + (stride * h);
+ char* dest_line = result + (width * h * 3);
+ for (int w = 0; w < width; ++w) {
+ // R
+ dest_line[w * 3] = src_line[(w * 4) + 2];
+ // G
+ dest_line[(w * 3) + 1] = src_line[(w * 4) + 1];
+ // B
+ dest_line[(w * 3) + 2] = src_line[w * 4];
}
- fwrite(result, out_len, 1, fp);
- delete [] result;
}
+ fwrite(result, out_len, 1, fp);
+ delete[] result;
fclose(fp);
}
« no previous file with comments | « fpdfsdk/src/pdfwindow/PWL_Wnd.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698