summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec/ccodec_jpegmodule.h
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-09-25 20:06:50 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-09-25 20:06:50 +0000
commit958142efa4561b5efd52733ad6c3b889cf49b3ae (patch)
treeda605e08bceccbae3e23d87471c197b37ac48e28 /core/fxcodec/codec/ccodec_jpegmodule.h
parentfed6e124109f089a38e24e37b104d983231bee78 (diff)
downloadpdfium-958142efa4561b5efd52733ad6c3b889cf49b3ae.tar.xz
Introduce CodecModuleIface for progressive decoder modules.
Another step before trying to fix the memory issue. Forces common APIs on the bunch of decoders, though some methods are unused. Requires adding some arguments/return values to get to a common API which are not used in all cases (yet?). Required converting some args to spans. Required proxying a GetJumpMark() call through the public module API to the private context. Bug: pdfium:1082 Change-Id: I0c0b7415141ff2a6f4f44777ca3d05521f08130d Reviewed-on: https://pdfium-review.googlesource.com/41950 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fxcodec/codec/ccodec_jpegmodule.h')
-rw-r--r--core/fxcodec/codec/ccodec_jpegmodule.h23
1 files changed, 10 insertions, 13 deletions
diff --git a/core/fxcodec/codec/ccodec_jpegmodule.h b/core/fxcodec/codec/ccodec_jpegmodule.h
index 2c72db3316..45b1d1b6d1 100644
--- a/core/fxcodec/codec/ccodec_jpegmodule.h
+++ b/core/fxcodec/codec/ccodec_jpegmodule.h
@@ -10,25 +10,17 @@
#include <csetjmp>
#include <memory>
+#include "core/fxcodec/codec/codec_module_iface.h"
#include "core/fxcrt/fx_system.h"
#include "core/fxcrt/retain_ptr.h"
#include "third_party/base/span.h"
class CCodec_ScanlineDecoder;
-class CFX_DIBBase;
-
-#ifdef PDF_ENABLE_XFA
class CFX_DIBAttribute;
-#endif // PDF_ENABLE_XFA
+class CFX_DIBBase;
-class CCodec_JpegModule {
+class CCodec_JpegModule final : public CodecModuleIface {
public:
- class Context {
- public:
- virtual ~Context() {}
- virtual jmp_buf* GetJumpMark() = 0;
- };
-
std::unique_ptr<CCodec_ScanlineDecoder> CreateDecoder(
pdfium::span<const uint8_t> src_buf,
int width,
@@ -36,6 +28,13 @@ class CCodec_JpegModule {
int nComps,
bool ColorTransform);
+ // CodecModuleIface:
+ FX_FILESIZE GetAvailInput(Context* pContext) const override;
+ bool Input(Context* pContext,
+ pdfium::span<uint8_t> src_buf,
+ CFX_DIBAttribute* pAttribute) override;
+
+ jmp_buf* GetJumpMark(Context* pContext);
bool LoadInfo(pdfium::span<const uint8_t> src_span,
int* width,
int* height,
@@ -44,7 +43,6 @@ class CCodec_JpegModule {
bool* color_transform);
std::unique_ptr<Context> Start();
- void Input(Context* pContext, const uint8_t* src_buf, uint32_t src_size);
#ifdef PDF_ENABLE_XFA
int ReadHeader(Context* pContext,
@@ -56,7 +54,6 @@ class CCodec_JpegModule {
bool StartScanline(Context* pContext, int down_scale);
bool ReadScanline(Context* pContext, uint8_t* dest_buf);
- uint32_t GetAvailInput(Context* pContext) const;
#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
static bool JpegEncode(const RetainPtr<CFX_DIBBase>& pSource,