1*3ac0a46fSAndroid Build Coastguard Worker // Copyright 2014 The PDFium Authors 2*3ac0a46fSAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be 3*3ac0a46fSAndroid Build Coastguard Worker // found in the LICENSE file. 4*3ac0a46fSAndroid Build Coastguard Worker 5*3ac0a46fSAndroid Build Coastguard Worker // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6*3ac0a46fSAndroid Build Coastguard Worker // Original code is licensed as follows: 7*3ac0a46fSAndroid Build Coastguard Worker /* 8*3ac0a46fSAndroid Build Coastguard Worker * Copyright 2011 ZXing authors 9*3ac0a46fSAndroid Build Coastguard Worker * 10*3ac0a46fSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 11*3ac0a46fSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 12*3ac0a46fSAndroid Build Coastguard Worker * You may obtain a copy of the License at 13*3ac0a46fSAndroid Build Coastguard Worker * 14*3ac0a46fSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 15*3ac0a46fSAndroid Build Coastguard Worker * 16*3ac0a46fSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 17*3ac0a46fSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 18*3ac0a46fSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19*3ac0a46fSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 20*3ac0a46fSAndroid Build Coastguard Worker * limitations under the License. 21*3ac0a46fSAndroid Build Coastguard Worker */ 22*3ac0a46fSAndroid Build Coastguard Worker 23*3ac0a46fSAndroid Build Coastguard Worker #include "fxbarcode/pdf417/BC_PDF417BarcodeRow.h" 24*3ac0a46fSAndroid Build Coastguard Worker 25*3ac0a46fSAndroid Build Coastguard Worker #include "core/fxcrt/span_util.h" 26*3ac0a46fSAndroid Build Coastguard Worker #include "third_party/base/check_op.h" 27*3ac0a46fSAndroid Build Coastguard Worker CBC_BarcodeRow(size_t width)28*3ac0a46fSAndroid Build Coastguard WorkerCBC_BarcodeRow::CBC_BarcodeRow(size_t width) : row_(width) {} 29*3ac0a46fSAndroid Build Coastguard Worker 30*3ac0a46fSAndroid Build Coastguard Worker CBC_BarcodeRow::~CBC_BarcodeRow() = default; 31*3ac0a46fSAndroid Build Coastguard Worker AddBar(bool black,size_t width)32*3ac0a46fSAndroid Build Coastguard Workervoid CBC_BarcodeRow::AddBar(bool black, size_t width) { 33*3ac0a46fSAndroid Build Coastguard Worker pdfium::span<uint8_t> available = row_.writable_span().subspan(offset_); 34*3ac0a46fSAndroid Build Coastguard Worker CHECK_LE(width, available.size()); 35*3ac0a46fSAndroid Build Coastguard Worker fxcrt::spanset(available.first(width), black ? 1 : 0); 36*3ac0a46fSAndroid Build Coastguard Worker offset_ += width; 37*3ac0a46fSAndroid Build Coastguard Worker } 38