[go: nahoru, domu]

blob: 9a78e689cd32e28e58b6872bf726181e6019218f [file] [log] [blame]
Avi Drissmandb497b32022-09-15 19:47:281// Copyright 2020 The Chromium Authors
K. Moonad77a182020-07-16 19:30:492// 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
K. Moon950a85272022-04-29 23:34:038#include "third_party/skia/include/core/SkRefCnt.h"
K. Moon30466c92020-07-21 21:46:039#include "ui/gfx/geometry/rect.h"
10
K. Moon950a85272022-04-29 23:34:0311class SkImage;
12
K. Moonad77a182020-07-16 19:30:4913namespace 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.
K. Moon70565f62020-07-22 00:39:5418class PaintReadyRect {
19 public:
Hui Yingstac4f9f9b2021-01-05 20:59:0020 PaintReadyRect(const gfx::Rect& rect,
K. Moon950a85272022-04-29 23:34:0321 sk_sp<SkImage> image,
K. Moon944dd5f2020-07-29 00:36:4322 bool flush_now = false);
23
K. Moonad77a182020-07-16 19:30:4924 PaintReadyRect(const PaintReadyRect& other);
25 PaintReadyRect& operator=(const PaintReadyRect& other);
K. Moon70565f62020-07-22 00:39:5426 ~PaintReadyRect();
K. Moonad77a182020-07-16 19:30:4927
K. Moon70565f62020-07-22 00:39:5428 const gfx::Rect& rect() const { return rect_; }
29 void set_rect(const gfx::Rect& rect) { rect_ = rect; }
30
K. Moon950a85272022-04-29 23:34:0331 const SkImage& image() const { return *image_; }
K. Moonad77a182020-07-16 19:30:4932
33 // Whether to flush to screen immediately; otherwise, when the rest of the
34 // plugin viewport is ready.
K. Moon70565f62020-07-22 00:39:5435 bool flush_now() const { return flush_now_; }
36
37 private:
38 gfx::Rect rect_;
K. Moon950a85272022-04-29 23:34:0339 sk_sp<SkImage> image_;
K. Moon70565f62020-07-22 00:39:5440 bool flush_now_;
K. Moonad77a182020-07-16 19:30:4941};
42
43} // namespace chrome_pdf
44
45#endif // PDF_PAINT_READY_RECT_H_