Skip to content

Commit

Permalink
Return early in PDFiumEngine::DrawSelections()
Browse files Browse the repository at this point in the history
If there is no bitmap to draw highlights into, then just return early.

Change-Id: I165ca2705e33fa32259202204519259994afdcbc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4989079
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1218334}
  • Loading branch information
leizleiz authored and Chromium LUCI CQ committed Nov 1, 2023
1 parent f790a9b commit 5a1d572
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pdf/pdfium/pdfium_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3340,6 +3340,9 @@ void PDFiumEngine::DrawSelections(int progressive_index,
base::span<uint8_t> region;
size_t stride;
GetRegion(dirty_in_screen.origin(), image_data, region, stride);
if (region.empty()) {
return;
}

std::vector<gfx::Rect> highlighted_rects;
gfx::Rect visible_rect = GetVisibleRect();
Expand Down Expand Up @@ -3492,9 +3495,7 @@ void PDFiumEngine::Highlight(base::span<uint8_t> buffer,
int color_green,
int color_blue,
std::vector<gfx::Rect>& highlighted_rects) const {
if (buffer.empty()) {
return;
}
CHECK(!buffer.empty());

gfx::Rect new_rect = rect;
for (const auto& highlighted : highlighted_rects)
Expand Down

0 comments on commit 5a1d572

Please sign in to comment.