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
cpdf_psfunc.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/fpdfapi/page/cpdf_psfunc.h"
8
9#include "core/fpdfapi/parser/cpdf_stream.h"
10#include "core/fpdfapi/parser/cpdf_stream_acc.h"
11
13
14CPDF_PSFunc::~CPDF_PSFunc() = default;
15
16bool CPDF_PSFunc::v_Init(const CPDF_Object* pObj, VisitedSet* pVisited) {
17 auto pAcc =
18 pdfium::MakeRetain<CPDF_StreamAcc>(pdfium::WrapRetain(pObj->AsStream()));
19 pAcc->LoadAllDataFiltered();
20 return m_PS.Parse(pAcc->GetSpan());
21}
22
23bool CPDF_PSFunc::v_Call(pdfium::span<const float> inputs,
24 pdfium::span<float> results) const {
25 m_PS.Reset();
26 for (uint32_t i = 0; i < m_nInputs; i++)
27 m_PS.Push(inputs[i]);
28 m_PS.Execute();
29 if (m_PS.GetStackSize() < m_nOutputs)
30 return false;
31 for (uint32_t i = 0; i < m_nOutputs; i++)
32 results[m_nOutputs - i - 1] = m_PS.Pop();
33 return true;
34}
CPDF_Function(Type type)
const CPDF_Stream * AsStream() const
bool v_Init(const CPDF_Object *pObj, VisitedSet *pVisited) override
~CPDF_PSFunc() override
bool v_Call(pdfium::span< const float > inputs, pdfium::span< float > results) const override