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

Side by Side Diff: core/src/fxcodec/codec/fx_codec_jpeg.cpp

Issue 1296043002: Merge to XFA: Use override in more classes in core/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@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 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 <setjmp.h> 7 #include <setjmp.h>
8 8
9 #include "../../../include/fxcodec/fx_codec.h" 9 #include "../../../include/fxcodec/fx_codec.h"
10 #include "../../../include/fxcrt/fx_safe_types.h" 10 #include "../../../include/fxcrt/fx_safe_types.h"
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 bits_per_components = cinfo.data_precision; 355 bits_per_components = cinfo.data_precision;
356 if (icc_buf_ptr != NULL) { 356 if (icc_buf_ptr != NULL) {
357 *icc_buf_ptr = NULL; 357 *icc_buf_ptr = NULL;
358 } 358 }
359 if (icc_length != NULL) { 359 if (icc_length != NULL) {
360 *icc_length = 0; 360 *icc_length = 0;
361 } 361 }
362 jpeg_destroy_decompress(&cinfo); 362 jpeg_destroy_decompress(&cinfo);
363 return TRUE; 363 return TRUE;
364 } 364 }
365
365 class CCodec_JpegDecoder : public CCodec_ScanlineDecoder { 366 class CCodec_JpegDecoder : public CCodec_ScanlineDecoder {
366 public: 367 public:
367 CCodec_JpegDecoder(); 368 CCodec_JpegDecoder();
368 ~CCodec_JpegDecoder(); 369 ~CCodec_JpegDecoder() override;
370
369 FX_BOOL Create(const uint8_t* src_buf, 371 FX_BOOL Create(const uint8_t* src_buf,
370 FX_DWORD src_size, 372 FX_DWORD src_size,
371 int width, 373 int width,
372 int height, 374 int height,
373 int nComps, 375 int nComps,
374 FX_BOOL ColorTransform, 376 FX_BOOL ColorTransform,
375 IFX_JpegProvider* pJP); 377 IFX_JpegProvider* pJP);
376 virtual void Destroy() { delete this; } 378 void Destroy() { delete this; }
377 virtual void v_DownScale(int dest_width, int dest_height); 379
378 virtual FX_BOOL v_Rewind(); 380 // CCodec_ScanlineDecoder
379 virtual uint8_t* v_GetNextLine(); 381 void v_DownScale(int dest_width, int dest_height) override;
380 virtual FX_DWORD GetSrcOffset(); 382 FX_BOOL v_Rewind() override;
383 uint8_t* v_GetNextLine() override;
384 FX_DWORD GetSrcOffset() override;
385
386 FX_BOOL InitDecode();
387
381 jmp_buf m_JmpBuf; 388 jmp_buf m_JmpBuf;
382 struct jpeg_decompress_struct cinfo; 389 struct jpeg_decompress_struct cinfo;
383 struct jpeg_error_mgr jerr; 390 struct jpeg_error_mgr jerr;
384 struct jpeg_source_mgr src; 391 struct jpeg_source_mgr src;
385 const uint8_t* m_SrcBuf; 392 const uint8_t* m_SrcBuf;
386 FX_DWORD m_SrcSize; 393 FX_DWORD m_SrcSize;
387 uint8_t* m_pScanlineBuf; 394 uint8_t* m_pScanlineBuf;
388 FX_BOOL InitDecode(); 395
389 FX_BOOL m_bInited, m_bStarted, m_bJpegTransform; 396 FX_BOOL m_bInited;
397 FX_BOOL m_bStarted;
398 FX_BOOL m_bJpegTransform;
390 399
391 protected: 400 protected:
392 IFX_JpegProvider* m_pExtProvider; 401 IFX_JpegProvider* m_pExtProvider;
393 void* m_pExtContext; 402 void* m_pExtContext;
394 FX_DWORD m_nDefaultScaleDenom; 403 FX_DWORD m_nDefaultScaleDenom;
395 }; 404 };
405
396 CCodec_JpegDecoder::CCodec_JpegDecoder() { 406 CCodec_JpegDecoder::CCodec_JpegDecoder() {
397 m_pScanlineBuf = NULL; 407 m_pScanlineBuf = NULL;
398 m_DownScale = 1; 408 m_DownScale = 1;
399 m_bStarted = FALSE; 409 m_bStarted = FALSE;
400 m_bInited = FALSE; 410 m_bInited = FALSE;
401 m_pExtProvider = NULL; 411 m_pExtProvider = NULL;
402 m_pExtContext = NULL; 412 m_pExtContext = NULL;
403 FXSYS_memset(&cinfo, 0, sizeof(cinfo)); 413 FXSYS_memset(&cinfo, 0, sizeof(cinfo));
404 FXSYS_memset(&jerr, 0, sizeof(jerr)); 414 FXSYS_memset(&jerr, 0, sizeof(jerr));
405 FXSYS_memset(&src, 0, sizeof(src)); 415 FXSYS_memset(&src, 0, sizeof(src));
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 } 790 }
781 if (avail_buf_ptr != NULL) { 791 if (avail_buf_ptr != NULL) {
782 *avail_buf_ptr = NULL; 792 *avail_buf_ptr = NULL;
783 if (((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer > 0) { 793 if (((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer > 0) {
784 *avail_buf_ptr = 794 *avail_buf_ptr =
785 (uint8_t*)((FXJPEG_Context*)pContext)->m_SrcMgr.next_input_byte; 795 (uint8_t*)((FXJPEG_Context*)pContext)->m_SrcMgr.next_input_byte;
786 } 796 }
787 } 797 }
788 return (FX_DWORD)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer; 798 return (FX_DWORD)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer;
789 } 799 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698