| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium 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 #include "pdf/pdfium/pdfium_range.h" | 5 #include "pdf/pdfium/pdfium_range.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "pdf/pdfium/pdfium_api_string_buffer_adapter.h" | 9 #include "pdf/pdfium/pdfium_api_string_buffer_adapter.h" |
| 10 | 10 |
| 11 namespace chrome_pdf { | 11 namespace chrome_pdf { |
| 12 | 12 |
| 13 PDFiumRange::PDFiumRange(PDFiumPage* page, int char_index, int char_count) | 13 PDFiumRange::PDFiumRange(PDFiumPage* page, int char_index, int char_count) |
| 14 : page_(page), | 14 : page_(page), |
| 15 char_index_(char_index), | 15 char_index_(char_index), |
| 16 char_count_(char_count), | 16 char_count_(char_count), |
| 17 cached_screen_rects_zoom_(0) { | 17 cached_screen_rects_zoom_(0) { |
| 18 } | 18 } |
| 19 | 19 |
| 20 PDFiumRange::~PDFiumRange() { | 20 PDFiumRange::PDFiumRange(const PDFiumRange& that) = default; |
| 21 } | 21 |
| 22 PDFiumRange::~PDFiumRange() = default; |
| 22 | 23 |
| 23 void PDFiumRange::SetCharCount(int char_count) { | 24 void PDFiumRange::SetCharCount(int char_count) { |
| 24 char_count_ = char_count; | 25 char_count_ = char_count; |
| 25 | 26 |
| 26 cached_screen_rects_offset_ = pp::Point(); | 27 cached_screen_rects_offset_ = pp::Point(); |
| 27 cached_screen_rects_zoom_ = 0; | 28 cached_screen_rects_zoom_ = 0; |
| 28 } | 29 } |
| 29 | 30 |
| 30 std::vector<pp::Rect> PDFiumRange::GetScreenRects(const pp::Point& offset, | 31 std::vector<pp::Rect> PDFiumRange::GetScreenRects(const pp::Point& offset, |
| 31 double zoom, | 32 double zoom, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 unsigned short* data = | 74 unsigned short* data = |
| 74 reinterpret_cast<unsigned short*>(api_string_adapter.GetData()); | 75 reinterpret_cast<unsigned short*>(api_string_adapter.GetData()); |
| 75 int written = FPDFText_GetText(page_->GetTextPage(), index, count, data); | 76 int written = FPDFText_GetText(page_->GetTextPage(), index, count, data); |
| 76 api_string_adapter.Close(written); | 77 api_string_adapter.Close(written); |
| 77 } | 78 } |
| 78 | 79 |
| 79 return rv; | 80 return rv; |
| 80 } | 81 } |
| 81 | 82 |
| 82 } // namespace chrome_pdf | 83 } // namespace chrome_pdf |
| OLD | NEW |