Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
scanlinedecoder.cpp
Go to the documentation of this file.
1// Copyright 2017 The PDFium Authors
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#include "core/fxcodec/scanlinedecoder.h"
8
9#include "core/fxcrt/pauseindicator_iface.h"
10
11namespace fxcodec {
12
14
16 int nOrigHeight,
17 int nOutputWidth,
18 int nOutputHeight,
19 int nComps,
20 int nBpc,
21 uint32_t nPitch)
22 : m_OrigWidth(nOrigWidth),
23 m_OrigHeight(nOrigHeight),
24 m_OutputWidth(nOutputWidth),
25 m_OutputHeight(nOutputHeight),
26 m_nComps(nComps),
27 m_bpc(nBpc),
28 m_Pitch(nPitch) {}
29
31
32pdfium::span<const uint8_t> ScanlineDecoder::GetScanline(int line) {
33 if (m_NextLine == line + 1)
34 return m_pLastScanline;
35
36 if (m_NextLine < 0 || m_NextLine > line) {
37 if (!Rewind())
38 return pdfium::span<const uint8_t>();
39 m_NextLine = 0;
40 }
41 while (m_NextLine < line) {
43 m_NextLine++;
44 }
45 m_pLastScanline = GetNextLine();
46 m_NextLine++;
47 return m_pLastScanline;
48}
49
51 if (m_NextLine == line || m_NextLine == line + 1)
52 return false;
53
54 if (m_NextLine < 0 || m_NextLine > line) {
56 m_NextLine = 0;
57 }
58 m_pLastScanline = pdfium::span<uint8_t>();
59 while (m_NextLine < line) {
60 m_pLastScanline = GetNextLine();
61 m_NextLine++;
62 if (pPause && pPause->NeedToPauseNow()) {
63 return true;
64 }
65 }
66 return false;
67}
68
69} // namespace fxcodec
virtual bool NeedToPauseNow()=0
virtual pdfium::span< uint8_t > GetNextLine()=0
ScanlineDecoder(int nOrigWidth, int nOrigHeight, int nOutputWidth, int nOutputHeight, int nComps, int nBpc, uint32_t nPitch)
bool SkipToScanline(int line, PauseIndicatorIface *pPause)
pdfium::span< const uint8_t > GetScanline(int line)
virtual bool Rewind()=0