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

Side by Side Diff: core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp

Issue 1520063002: Get rid of most instance of 'foo == NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@bstr_isnull
Patch Set: rebase Created 5 years 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/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp ('k') | core/src/fpdfapi/fpdf_font/fpdf_font.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 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/include/fpdfapi/fpdf_module.h" 7 #include "core/include/fpdfapi/fpdf_module.h"
8 #include "core/include/fpdfapi/fpdf_page.h" 8 #include "core/include/fpdfapi/fpdf_page.h"
9 #include "core/include/fpdfapi/fpdf_render.h" 9 #include "core/include/fpdfapi/fpdf_render.h"
10 #include "core/include/fxcodec/fx_codec.h" 10 #include "core/include/fxcodec/fx_codec.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 pDict->SetAtInteger("BitsPerComponent", bits); 44 pDict->SetAtInteger("BitsPerComponent", bits);
45 pDict->SetAtName("Filter", "DCTDecode"); 45 pDict->SetAtName("Filter", "DCTDecode");
46 if (!color_trans) { 46 if (!color_trans) {
47 CPDF_Dictionary* pParms = new CPDF_Dictionary; 47 CPDF_Dictionary* pParms = new CPDF_Dictionary;
48 pDict->SetAt("DecodeParms", pParms); 48 pDict->SetAt("DecodeParms", pParms);
49 pParms->SetAtInteger("ColorTransform", 0); 49 pParms->SetAtInteger("ColorTransform", 0);
50 } 50 }
51 m_bIsMask = FALSE; 51 m_bIsMask = FALSE;
52 m_Width = width; 52 m_Width = width;
53 m_Height = height; 53 m_Height = height;
54 if (m_pStream == NULL) { 54 if (!m_pStream) {
55 m_pStream = new CPDF_Stream(NULL, 0, NULL); 55 m_pStream = new CPDF_Stream(NULL, 0, NULL);
56 } 56 }
57 return pDict; 57 return pDict;
58 } 58 }
59 void CPDF_Image::SetJpegImage(uint8_t* pData, FX_DWORD size) { 59 void CPDF_Image::SetJpegImage(uint8_t* pData, FX_DWORD size) {
60 CPDF_Dictionary* pDict = InitJPEG(pData, size); 60 CPDF_Dictionary* pDict = InitJPEG(pData, size);
61 if (!pDict) { 61 if (!pDict) {
62 return; 62 return;
63 } 63 }
64 m_pStream->InitStream(pData, size, pDict); 64 m_pStream->InitStream(pData, size, pDict);
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 } else { 360 } else {
361 pDest += dest_pitch; 361 pDest += dest_pitch;
362 } 362 }
363 dest_offset = 0; 363 dest_offset = 0;
364 } 364 }
365 if (bStream) { 365 if (bStream) {
366 FX_Free(dest_buf); 366 FX_Free(dest_buf);
367 dest_buf = NULL; 367 dest_buf = NULL;
368 } 368 }
369 } 369 }
370 if (m_pStream == NULL) { 370 if (!m_pStream) {
371 m_pStream = new CPDF_Stream(NULL, 0, NULL); 371 m_pStream = new CPDF_Stream(NULL, 0, NULL);
372 } 372 }
373 if (!bStream) { 373 if (!bStream) {
374 m_pStream->InitStream(dest_buf, dest_size, pDict); 374 m_pStream->InitStream(dest_buf, dest_size, pDict);
375 } else { 375 } else {
376 pFileWrite->Flush(); 376 pFileWrite->Flush();
377 m_pStream->InitStreamFromFile(pFileRead, pDict); 377 m_pStream->InitStreamFromFile(pFileRead, pDict);
378 } 378 }
379 m_bIsMask = pBitmap->IsAlphaMask(); 379 m_bIsMask = pBitmap->IsAlphaMask();
380 m_Width = BitmapWidth; 380 m_Width = BitmapWidth;
381 m_Height = BitmapHeight; 381 m_Height = BitmapHeight;
382 FX_Free(dest_buf); 382 FX_Free(dest_buf);
383 } 383 }
384 void CPDF_Image::ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pBitmap) { 384 void CPDF_Image::ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pBitmap) {
385 pPage->GetRenderCache()->ResetBitmap(m_pStream, pBitmap); 385 pPage->GetRenderCache()->ResetBitmap(m_pStream, pBitmap);
386 } 386 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp ('k') | core/src/fpdfapi/fpdf_font/fpdf_font.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698