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

Side by Side Diff: core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp

Issue 1356373003: Fix a bunch of sign mismatch warnings. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 5 years, 2 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 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 "../../../../third_party/base/nonstd_unique_ptr.h" 7 #include "../../../../third_party/base/nonstd_unique_ptr.h"
8 #include "../../../include/fpdfapi/fpdf_module.h" 8 #include "../../../include/fpdfapi/fpdf_module.h"
9 #include "../../../include/fpdfapi/fpdf_pageobj.h" 9 #include "../../../include/fpdfapi/fpdf_pageobj.h"
10 #include "../../../include/fpdfapi/fpdf_render.h" 10 #include "../../../include/fpdfapi/fpdf_render.h"
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 format = FXDIB_Rgb; 741 format = FXDIB_Rgb;
742 } 742 }
743 743
744 m_pCachedBitmap.reset(new CFX_DIBitmap); 744 m_pCachedBitmap.reset(new CFX_DIBitmap);
745 if (!m_pCachedBitmap->Create(width, height, format)) { 745 if (!m_pCachedBitmap->Create(width, height, format)) {
746 m_pCachedBitmap.reset(); 746 m_pCachedBitmap.reset();
747 return; 747 return;
748 } 748 }
749 m_pCachedBitmap->Clear(0xFFFFFFFF); 749 m_pCachedBitmap->Clear(0xFFFFFFFF);
750 context->set_output_offsets(FX_Alloc(uint8_t, components)); 750 context->set_output_offsets(FX_Alloc(uint8_t, components));
751 for (int i = 0; i < components; ++i) 751 for (FX_DWORD i = 0; i < components; ++i)
752 context->output_offsets()[i] = i; 752 context->output_offsets()[i] = i;
753 if (bSwapRGB) { 753 if (bSwapRGB) {
754 context->output_offsets()[0] = 2; 754 context->output_offsets()[0] = 2;
755 context->output_offsets()[2] = 0; 755 context->output_offsets()[2] = 0;
756 } 756 }
757 if (!pJpxModule->Decode(context->decoder(), m_pCachedBitmap->GetBuffer(), 757 if (!pJpxModule->Decode(context->decoder(), m_pCachedBitmap->GetBuffer(),
758 m_pCachedBitmap->GetPitch(), 758 m_pCachedBitmap->GetPitch(),
759 context->output_offsets())) { 759 context->output_offsets())) {
760 m_pCachedBitmap.reset(); 760 m_pCachedBitmap.reset();
761 return; 761 return;
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 temp[j] = (uint8_t)(_GetBits8(pSrcPixel, src_bit_pos, m_bpc) * 1485 temp[j] = (uint8_t)(_GetBits8(pSrcPixel, src_bit_pos, m_bpc) *
1486 unit_To8Bpc); 1486 unit_To8Bpc);
1487 src_bit_pos += m_bpc; 1487 src_bit_pos += m_bpc;
1488 } 1488 }
1489 m_pColorSpace->TranslateImageLine(color, temp, 1, 0, 0, bTransMask); 1489 m_pColorSpace->TranslateImageLine(color, temp, 1, 0, 0, bTransMask);
1490 } else { 1490 } else {
1491 m_pColorSpace->TranslateImageLine(color, pSrcPixel, 1, 0, 0, 1491 m_pColorSpace->TranslateImageLine(color, pSrcPixel, 1, 0, 0,
1492 bTransMask); 1492 bTransMask);
1493 } 1493 }
1494 } else { 1494 } else {
1495 for (int j = 0; j < m_nComponents; ++j) { 1495 for (FX_DWORD j = 0; j < m_nComponents; ++j) {
1496 int color_value = 1496 int color_value =
1497 (int)((m_pCompData[j].m_DecodeMin + 1497 (int)((m_pCompData[j].m_DecodeMin +
1498 m_pCompData[j].m_DecodeStep * (FX_FLOAT)pSrcPixel[j]) * 1498 m_pCompData[j].m_DecodeStep * (FX_FLOAT)pSrcPixel[j]) *
1499 255.0f + 1499 255.0f +
1500 0.5f); 1500 0.5f);
1501 temp[j] = 1501 temp[j] =
1502 color_value > 255 ? 255 : (color_value < 0 ? 0 : color_value); 1502 color_value > 255 ? 255 : (color_value < 0 ? 0 : color_value);
1503 } 1503 }
1504 m_pColorSpace->TranslateImageLine(color, temp, 1, 0, 0, bTransMask); 1504 m_pColorSpace->TranslateImageLine(color, temp, 1, 0, 0, bTransMask);
1505 } 1505 }
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1663 } 1663 }
1664 FX_BOOL CPDF_ImageLoader::Continue(void* LoadHandle, IFX_Pause* pPause) { 1664 FX_BOOL CPDF_ImageLoader::Continue(void* LoadHandle, IFX_Pause* pPause) {
1665 return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause); 1665 return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause);
1666 } 1666 }
1667 CPDF_ImageLoader::~CPDF_ImageLoader() { 1667 CPDF_ImageLoader::~CPDF_ImageLoader() {
1668 if (!m_bCached) { 1668 if (!m_bCached) {
1669 delete m_pBitmap; 1669 delete m_pBitmap;
1670 delete m_pMask; 1670 delete m_pMask;
1671 } 1671 }
1672 } 1672 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698