| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 // Original code is licensed as follows: | 6 // Original code is licensed as follows: |
| 7 /* | 7 /* |
| 8 * Copyright 2009 ZXing authors | 8 * Copyright 2009 ZXing authors |
| 9 * | 9 * |
| 10 * Licensed under the Apache License, Version 2.0 (the "License"); | 10 * Licensed under the Apache License, Version 2.0 (the "License"); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 const CFX_WideString& filename) | 92 const CFX_WideString& filename) |
| 93 : CBC_LuminanceSource(0, 0), m_filename(filename) { | 93 : CBC_LuminanceSource(0, 0), m_filename(filename) { |
| 94 m_height = 0; | 94 m_height = 0; |
| 95 m_width = 0; | 95 m_width = 0; |
| 96 m_bytesPerLine = 0; | 96 m_bytesPerLine = 0; |
| 97 m_top = 0; | 97 m_top = 0; |
| 98 m_left = 0; | 98 m_left = 0; |
| 99 } | 99 } |
| 100 | 100 |
| 101 void CBC_BufferedImageLuminanceSource::Init(int32_t& e) { | 101 void CBC_BufferedImageLuminanceSource::Init(int32_t& e) { |
| 102 IFX_FileRead* fileread = FX_CreateFileRead(m_filename); | 102 IFX_FileRead* fileread = FX_CreateFileRead(m_filename.c_str()); |
| 103 m_pBitmap = CreateDIBSource(fileread); | 103 m_pBitmap = CreateDIBSource(fileread); |
| 104 if (!m_pBitmap) { | 104 if (!m_pBitmap) { |
| 105 e = BCExceptionLoadFile; | 105 e = BCExceptionLoadFile; |
| 106 return; | 106 return; |
| 107 } | 107 } |
| 108 m_pBitmap->ConvertFormat(FXDIB_Argb); | 108 m_pBitmap->ConvertFormat(FXDIB_Argb); |
| 109 m_height = m_pBitmap->GetHeight(); | 109 m_height = m_pBitmap->GetHeight(); |
| 110 m_width = m_pBitmap->GetWidth(); | 110 m_width = m_pBitmap->GetWidth(); |
| 111 m_rgbData.SetSize(m_height * m_width); | 111 m_rgbData.SetSize(m_height * m_width); |
| 112 m_bytesPerLine = m_width * 4; | 112 m_bytesPerLine = m_width * 4; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 int32_t pixel = rgb[offset + x]; | 169 int32_t pixel = rgb[offset + x]; |
| 170 int32_t luminance = | 170 int32_t luminance = |
| 171 (306 * ((pixel >> 16) & 0xFF) + 601 * ((pixel >> 8) & 0xFF) + | 171 (306 * ((pixel >> 16) & 0xFF) + 601 * ((pixel >> 8) & 0xFF) + |
| 172 117 * (pixel & 0xFF)) >> | 172 117 * (pixel & 0xFF)) >> |
| 173 10; | 173 10; |
| 174 (*matirx)[offset + x] = (uint8_t)luminance; | 174 (*matirx)[offset + x] = (uint8_t)luminance; |
| 175 } | 175 } |
| 176 } | 176 } |
| 177 return matirx; | 177 return matirx; |
| 178 } | 178 } |
| OLD | NEW |