fixup! [M120 Migration][NaCl][PPFWK] Upgradable pepper plugin requirement
[platform/framework/web/chromium-efl.git] / pdf / paint_ready_rect.h
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.
4
5 #ifndef PDF_PAINT_READY_RECT_H_
6 #define PDF_PAINT_READY_RECT_H_
7
8 #include "third_party/skia/include/core/SkRefCnt.h"
9 #include "ui/gfx/geometry/rect.h"
10
11 class SkImage;
12
13 namespace chrome_pdf {
14
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
17 // ready.
18 class PaintReadyRect {
19  public:
20   PaintReadyRect(const gfx::Rect& rect,
21                  sk_sp<SkImage> image,
22                  bool flush_now = false);
23
24   PaintReadyRect(const PaintReadyRect& other);
25   PaintReadyRect& operator=(const PaintReadyRect& other);
26   ~PaintReadyRect();
27
28   const gfx::Rect& rect() const { return rect_; }
29   void set_rect(const gfx::Rect& rect) { rect_ = rect; }
30
31   const SkImage& image() const { return *image_; }
32
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_; }
36
37  private:
38   gfx::Rect rect_;
39   sk_sp<SkImage> image_;
40   bool flush_now_;
41 };
42
43 }  // namespace chrome_pdf
44
45 #endif  // PDF_PAINT_READY_RECT_H_