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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 int32_t pixel = rowLine[x]; | 128 int32_t pixel = rowLine[x]; |
129 int32_t luminance = (306 * ((pixel >> 16) & 0xFF) + | 129 int32_t luminance = (306 * ((pixel >> 16) & 0xFF) + |
130 601 * ((pixel >> 8) & 0xFF) + 117 * (pixel & 0xFF)) >> | 130 601 * ((pixel >> 8) & 0xFF) + 117 * (pixel & 0xFF)) >> |
131 10; | 131 10; |
132 row[x] = (uint8_t)luminance; | 132 row[x] = (uint8_t)luminance; |
133 } | 133 } |
134 return &row; | 134 return &row; |
135 } | 135 } |
136 | 136 |
137 CFX_ByteArray* CBC_BufferedImageLuminanceSource::GetMatrix() { | 137 CFX_ByteArray* CBC_BufferedImageLuminanceSource::GetMatrix() { |
138 CFX_ByteArray* matirx = new CFX_ByteArray(); | 138 CFX_ByteArray* matrix = new CFX_ByteArray(); |
139 matirx->SetSize(m_bytesPerLine * m_height); | 139 matrix->SetSize(m_bytesPerLine * m_height); |
140 int32_t* rgb = (int32_t*)m_pBitmap->GetBuffer(); | 140 int32_t* rgb = (int32_t*)m_pBitmap->GetBuffer(); |
141 int32_t y; | 141 int32_t y; |
142 for (y = 0; y < m_height; y++) { | 142 for (y = 0; y < m_height; y++) { |
143 int32_t offset = y * m_width; | 143 int32_t offset = y * m_width; |
144 int32_t x; | 144 int32_t x; |
145 for (x = 0; x < m_width; x++) { | 145 for (x = 0; x < m_width; x++) { |
146 int32_t pixel = rgb[offset + x]; | 146 int32_t pixel = rgb[offset + x]; |
147 int32_t luminance = | 147 int32_t luminance = |
148 (306 * ((pixel >> 16) & 0xFF) + 601 * ((pixel >> 8) & 0xFF) + | 148 (306 * ((pixel >> 16) & 0xFF) + 601 * ((pixel >> 8) & 0xFF) + |
149 117 * (pixel & 0xFF)) >> | 149 117 * (pixel & 0xFF)) >> |
150 10; | 150 10; |
151 (*matirx)[offset + x] = (uint8_t)luminance; | 151 (*matrix)[offset + x] = (uint8_t)luminance; |
152 } | 152 } |
153 } | 153 } |
154 return matirx; | 154 return matrix; |
155 } | 155 } |
OLD | NEW |