clang-format all pdfium code.
[pdfium.git] / core / include / fxcodec / fx_codec_provider.h
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #ifndef CORE_INCLUDE_FXCODEC_FX_CODEC_PROVIDER_H_
8 #define CORE_INCLUDE_FXCODEC_FX_CODEC_PROVIDER_H_
9
10 #include "../fxcrt/fx_system.h"
11
12 class IFX_JpegProvider {
13  public:
14   virtual void Release() = 0;
15
16   virtual void* CreateDecoder(const uint8_t* src_buf,
17                               FX_DWORD src_size,
18                               int width,
19                               int height,
20                               int nComps,
21                               FX_BOOL ColorTransform) = 0;
22
23   virtual void DestroyDecoder(void* pDecoder) = 0;
24
25   virtual void DownScale(void* pDecoder, int dest_width, int dest_height) = 0;
26
27   virtual FX_BOOL Rewind(void* pDecoder) = 0;
28
29   virtual uint8_t* GetNextLine(void* pDecoder) = 0;
30
31   virtual FX_DWORD GetSrcOffset(void* pDecoder) = 0;
32
33   virtual FX_BOOL LoadInfo(const uint8_t* src_buf,
34                            FX_DWORD src_size,
35                            int& width,
36                            int& height,
37                            int& num_components,
38                            int& bits_per_components,
39                            FX_BOOL& color_transform,
40                            uint8_t** icc_buf_ptr = NULL,
41                            FX_DWORD* icc_length = NULL) = 0;
42
43   virtual FX_BOOL Encode(const class CFX_DIBSource* pSource,
44                          uint8_t*& dest_buf,
45                          FX_STRSIZE& dest_size,
46                          int quality = 75,
47                          const uint8_t* icc_buf = NULL,
48                          FX_DWORD icc_length = 0) = 0;
49
50   virtual void* Start() = 0;
51
52   virtual void Finish(void* pContext) = 0;
53
54   virtual void Input(void* pContext,
55                      const uint8_t* src_buf,
56                      FX_DWORD src_size) = 0;
57
58   virtual int ReadHeader(void* pContext,
59                          int* width,
60                          int* height,
61                          int* nComps) = 0;
62
63   virtual int StartScanline(void* pContext, int down_scale) = 0;
64
65   virtual FX_BOOL ReadScanline(void* pContext, uint8_t* dest_buf) = 0;
66
67   virtual FX_DWORD GetAvailInput(void* pContext,
68                                  uint8_t** avail_buf_ptr = NULL) = 0;
69
70  protected:
71   ~IFX_JpegProvider() {}
72 };
73
74 #endif  // CORE_INCLUDE_FXCODEC_FX_CODEC_PROVIDER_H_