1 // Copyright 2020 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef PDF_PAINT_READY_RECT_H_
6 #define PDF_PAINT_READY_RECT_H_
8 #include "third_party/skia/include/core/SkRefCnt.h"
9 #include "ui/gfx/geometry/rect.h"
13 namespace chrome_pdf {
15 // Stores information about a rectangle that has finished painting. The
16 // `PaintManager` will paint it only when everything else on the screen is also
18 class PaintReadyRect {
20 PaintReadyRect(const gfx::Rect& rect,
22 bool flush_now = false);
24 PaintReadyRect(const PaintReadyRect& other);
25 PaintReadyRect& operator=(const PaintReadyRect& other);
28 const gfx::Rect& rect() const { return rect_; }
29 void set_rect(const gfx::Rect& rect) { rect_ = rect; }
31 const SkImage& image() const { return *image_; }
33 // Whether to flush to screen immediately; otherwise, when the rest of the
34 // plugin viewport is ready.
35 bool flush_now() const { return flush_now_; }
39 sk_sp<SkImage> image_;
43 } // namespace chrome_pdf
45 #endif // PDF_PAINT_READY_RECT_H_