0

[PDF] Change PaintReadyRect:image() to return a pointer

All the callers want a pointer, so give them a pointer instead of a
reference.

Change-Id: Id93decdffe30bb125f5e35da8883b8fdc8c5e52c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5939859
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Andy Phan <andyphan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1370117}
This commit is contained in:
Lei Zhang
2024-10-17 17:29:40 +00:00
committed by Chromium LUCI CQ
parent eb02464a92
commit 82ccba7269
3 changed files with 4 additions and 4 deletions

@ -285,7 +285,7 @@ void PaintManager::DoPaint() {
for (const auto& ready_rect : ready_now) {
SkRect skia_rect = gfx::RectToSkRect(ready_rect.rect());
surface_->getCanvas()->drawImageRect(
&ready_rect.image(), skia_rect, skia_rect, SkSamplingOptions(), nullptr,
ready_rect.image(), skia_rect, skia_rect, SkSamplingOptions(), nullptr,
SkCanvas::kStrict_SrcRectConstraint);
}

@ -26,7 +26,7 @@ class PaintReadyRect {
const gfx::Rect& rect() const { return rect_; }
void set_rect(const gfx::Rect& rect) { rect_ = rect; }
const SkImage& image() const { return *image_; }
const SkImage* image() const { return image_.get(); }
// Whether to flush to screen immediately; otherwise, when the rest of the
// plugin viewport is ready.

@ -1267,8 +1267,8 @@ TEST_F(PdfViewWebPluginTest, OnPaintWithMultiplePaintRects) {
EXPECT_FALSE(ready[2].flush_now());
// All the requested paints should share the same `SkImage`.
EXPECT_NE(&ready[0].image(), &ready[1].image());
EXPECT_EQ(&ready[1].image(), &ready[2].image());
EXPECT_NE(ready[0].image(), ready[1].image());
EXPECT_EQ(ready[1].image(), ready[2].image());
}
TEST_F(PdfViewWebPluginTest, UpdateLayerTransformWithIdentity) {