0

Return early in PDFiumEngine::DrawSelections()

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}
This commit is contained in:
Lei Zhang
2023-11-01 18:35:40 +00:00
committed by Chromium LUCI CQ
parent f790a9b238
commit 5a1d57281c

@ -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();
@ -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)