mirror of
https://pdfium.googlesource.com/pdfium
synced 2026-08-03 13:06:13 +08:00
Updates old-style copyright headers to the new style, by removing "All rights reserved." Also inserts "The" before "PDFium Authors", which is required by both styles. Mechanically generated by this command: PATTERN='Copyright \([0-9]\+\) \(The \)\?PDFium Authors. All rights reserved.' git grep -l "$PATTERN" \ | xargs sed "s/$PATTERN/Copyright \1 The PDFium Authors/" -i'' Fixed: pdfium:1884 Change-Id: I6f781d811df8839e2e21b85f716529b813828bcd Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/100371 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: K. Moon <kmoon@chromium.org>
70 lines
1.9 KiB
C++
70 lines
1.9 KiB
C++
// Copyright 2017 The PDFium Authors
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
|
|
|
|
#include "core/fxcodec/scanlinedecoder.h"
|
|
|
|
#include "core/fxcrt/pauseindicator_iface.h"
|
|
|
|
namespace fxcodec {
|
|
|
|
ScanlineDecoder::ScanlineDecoder() : ScanlineDecoder(0, 0, 0, 0, 0, 0, 0) {}
|
|
|
|
ScanlineDecoder::ScanlineDecoder(int nOrigWidth,
|
|
int nOrigHeight,
|
|
int nOutputWidth,
|
|
int nOutputHeight,
|
|
int nComps,
|
|
int nBpc,
|
|
uint32_t nPitch)
|
|
: m_OrigWidth(nOrigWidth),
|
|
m_OrigHeight(nOrigHeight),
|
|
m_OutputWidth(nOutputWidth),
|
|
m_OutputHeight(nOutputHeight),
|
|
m_nComps(nComps),
|
|
m_bpc(nBpc),
|
|
m_Pitch(nPitch) {}
|
|
|
|
ScanlineDecoder::~ScanlineDecoder() = default;
|
|
|
|
pdfium::span<const uint8_t> ScanlineDecoder::GetScanline(int line) {
|
|
if (m_NextLine == line + 1)
|
|
return m_pLastScanline;
|
|
|
|
if (m_NextLine < 0 || m_NextLine > line) {
|
|
if (!Rewind())
|
|
return pdfium::span<const uint8_t>();
|
|
m_NextLine = 0;
|
|
}
|
|
while (m_NextLine < line) {
|
|
GetNextLine();
|
|
m_NextLine++;
|
|
}
|
|
m_pLastScanline = GetNextLine();
|
|
m_NextLine++;
|
|
return m_pLastScanline;
|
|
}
|
|
|
|
bool ScanlineDecoder::SkipToScanline(int line, PauseIndicatorIface* pPause) {
|
|
if (m_NextLine == line || m_NextLine == line + 1)
|
|
return false;
|
|
|
|
if (m_NextLine < 0 || m_NextLine > line) {
|
|
Rewind();
|
|
m_NextLine = 0;
|
|
}
|
|
m_pLastScanline = pdfium::span<uint8_t>();
|
|
while (m_NextLine < line) {
|
|
m_pLastScanline = GetNextLine();
|
|
m_NextLine++;
|
|
if (pPause && pPause->NeedToPauseNow()) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
} // namespace fxcodec
|