Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(416)

Side by Side Diff: pdf/pdfium/pdfium_range.cc

Issue 1555153003: Another round of PDF plugin cleanups. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moar Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pdf/pdfium/pdfium_range.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 for (int i = 0; i < count; ++i) { 50 for (int i = 0; i < count; ++i) {
51 double left, top, right, bottom; 51 double left, top, right, bottom;
52 FPDFText_GetRect(page_->GetTextPage(), i, &left, &top, &right, &bottom); 52 FPDFText_GetRect(page_->GetTextPage(), i, &left, &top, &right, &bottom);
53 cached_screen_rects_.push_back( 53 cached_screen_rects_.push_back(
54 page_->PageToScreen(offset, zoom, left, top, right, bottom, rotation)); 54 page_->PageToScreen(offset, zoom, left, top, right, bottom, rotation));
55 } 55 }
56 56
57 return cached_screen_rects_; 57 return cached_screen_rects_;
58 } 58 }
59 59
60 base::string16 PDFiumRange::GetText() { 60 base::string16 PDFiumRange::GetText() const {
61 int index = char_index_; 61 int index = char_index_;
62 int count = char_count_; 62 int count = char_count_;
63 base::string16 rv; 63 base::string16 rv;
64 if (count < 0) { 64 if (count < 0) {
65 count *= -1; 65 count *= -1;
66 index -= count - 1; 66 index -= count - 1;
67 } 67 }
68 68
69 if (count > 0) { 69 if (count > 0) {
70 PDFiumAPIStringBufferAdapter<base::string16> api_string_adapter(&rv, 70 PDFiumAPIStringBufferAdapter<base::string16> api_string_adapter(&rv,
71 count, 71 count,
72 false); 72 false);
73 unsigned short* data = 73 unsigned short* data =
74 reinterpret_cast<unsigned short*>(api_string_adapter.GetData()); 74 reinterpret_cast<unsigned short*>(api_string_adapter.GetData());
75 int written = FPDFText_GetText(page_->GetTextPage(), index, count, data); 75 int written = FPDFText_GetText(page_->GetTextPage(), index, count, data);
76 api_string_adapter.Close(written); 76 api_string_adapter.Close(written);
77 } 77 }
78 78
79 return rv; 79 return rv;
80 } 80 }
81 81
82 } // namespace chrome_pdf 82 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « pdf/pdfium/pdfium_range.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698