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
cfx_bitmapstorer.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/fxge/dib/cfx_bitmapstorer.h"
8
9#include <utility>
10
11#include "core/fxcrt/check_op.h"
12#include "core/fxcrt/stl_util.h"
13#include "core/fxge/dib/cfx_dibitmap.h"
14
15CFX_BitmapStorer::CFX_BitmapStorer() = default;
16
17CFX_BitmapStorer::~CFX_BitmapStorer() = default;
18
19RetainPtr<CFX_DIBitmap> CFX_BitmapStorer::Detach() {
20 return std::move(m_pBitmap);
21}
22
23void CFX_BitmapStorer::Replace(RetainPtr<CFX_DIBitmap>&& pBitmap) {
24 m_pBitmap = std::move(pBitmap);
25}
26
27void CFX_BitmapStorer::ComposeScanline(int line,
28 pdfium::span<const uint8_t> scanline) {
29 pdfium::span<uint8_t> dest_buf = m_pBitmap->GetWritableScanline(line);
30 if (!dest_buf.empty()) {
31 fxcrt::Copy(scanline, dest_buf);
32 }
33}
34
35bool CFX_BitmapStorer::SetInfo(int width,
36 int height,
37 FXDIB_Format src_format,
38 DataVector<uint32_t> src_palette) {
41 auto pBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
42 if (!pBitmap->Create(width, height, src_format))
43 return false;
44
45 if (!src_palette.empty()) {
46 pBitmap->TakePalette(std::move(src_palette));
47 }
48
49 m_pBitmap = std::move(pBitmap);
50 return true;
51}
#define DCHECK_NE(x, y)
Definition check_op.h:18
void ComposeScanline(int line, pdfium::span< const uint8_t > scanline) override
~CFX_BitmapStorer() override
void Replace(RetainPtr< CFX_DIBitmap > &&pBitmap)
RetainPtr< CFX_DIBitmap > Detach()
bool SetInfo(int width, int height, FXDIB_Format src_format, DataVector< uint32_t > src_palette) override
FXDIB_Format
Definition fx_dib.h:21