From b4a261855b34b4c8d938118762ae609a34a3ae99 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 1 Mar 2017 12:15:00 -0800 Subject: Create virtual codec APIs so chrome/fuzzers can link separately The one step to make an actual concrete class is conditionalized in fpdfview and is unconditional in the fuzzer. Also replace the clumsy C-style callbacks with a delegate interface as long as we are making new interfaces. Change-Id: I733a437483ce5e0c34211cfbbda05105336f55b5 Reviewed-on: https://pdfium-review.googlesource.com/2887 Commit-Queue: Tom Sepez Commit-Queue: dsinclair Reviewed-by: dsinclair --- core/fxcodec/codec/ccodec_pngmodule.h | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'core/fxcodec/codec/ccodec_pngmodule.h') diff --git a/core/fxcodec/codec/ccodec_pngmodule.h b/core/fxcodec/codec/ccodec_pngmodule.h index 77c4af3946..1f3a3d96cc 100644 --- a/core/fxcodec/codec/ccodec_pngmodule.h +++ b/core/fxcodec/codec/ccodec_pngmodule.h @@ -7,33 +7,22 @@ #ifndef CORE_FXCODEC_CODEC_CCODEC_PNGMODULE_H_ #define CORE_FXCODEC_CODEC_CCODEC_PNGMODULE_H_ +#include "core/fxcodec/codec/icodec_pngmodule.h" #include "core/fxcrt/fx_system.h" -class CFX_DIBAttribute; -struct FXPNG_Context; - #define PNG_ERROR_SIZE 256 -class CCodec_PngModule { +class CCodec_PngModule : public ICodec_PngModule { public: - CCodec_PngModule() { FXSYS_memset(m_szLastError, 0, sizeof(m_szLastError)); } + CCodec_PngModule(); + ~CCodec_PngModule() override; - FXPNG_Context* Start(void* pModule); - void Finish(FXPNG_Context* pContext); + FXPNG_Context* Start() override; + void Finish(FXPNG_Context* pContext) override; bool Input(FXPNG_Context* pContext, const uint8_t* src_buf, uint32_t src_size, - CFX_DIBAttribute* pAttribute); - - bool (*ReadHeaderCallback)(void* pModule, - int width, - int height, - int bpc, - int pass, - int* color_type, - double* gamma); - bool (*AskScanlineBufCallback)(void* pModule, int line, uint8_t*& src_buf); - void (*FillScanlineBufCompletedCallback)(void* pModule, int pass, int line); + CFX_DIBAttribute* pAttribute) override; protected: FX_CHAR m_szLastError[PNG_ERROR_SIZE]; -- cgit v1.2.3