xref: /aosp_15_r20/external/pdfium/core/fxcodec/fx_codec.cpp (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2014 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/fx_codec.h"
8 
9 #include <utility>
10 
11 #include "core/fxge/dib/fx_dib.h"
12 
13 namespace fxcodec {
14 
15 #ifdef PDF_ENABLE_XFA
16 CFX_DIBAttribute::CFX_DIBAttribute() = default;
17 
18 CFX_DIBAttribute::~CFX_DIBAttribute() = default;
19 #endif  // PDF_ENABLE_XFA
20 
ReverseRGB(uint8_t * pDestBuf,const uint8_t * pSrcBuf,int pixels)21 void ReverseRGB(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels) {
22   if (pDestBuf == pSrcBuf) {
23     for (int i = 0; i < pixels; i++) {
24       std::swap(pDestBuf[0], pDestBuf[2]);
25       pDestBuf += 3;
26     }
27   } else {
28     for (int i = 0; i < pixels; i++) {
29       ReverseCopy3Bytes(pDestBuf, pSrcBuf);
30       pDestBuf += 3;
31       pSrcBuf += 3;
32     }
33   }
34 }
35 
36 }  // namespace fxcodec
37