summaryrefslogtreecommitdiff
path: root/chromium/pdf/thumbnail.h
blob: d62a56a509107ba69473a2e29b5dfc8fad3fd348 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef PDF_THUMBNAIL_H_
#define PDF_THUMBNAIL_H_

#include "third_party/skia/include/core/SkBitmap.h"

namespace gfx {
class Size;
}  // namespace gfx

namespace chrome_pdf {

class Thumbnail final {
 public:
  Thumbnail();
  Thumbnail(const gfx::Size& page_size, float device_pixel_ratio);
  Thumbnail(Thumbnail&& other);
  Thumbnail& operator=(Thumbnail&& other);
  ~Thumbnail();

  SkBitmap& bitmap() { return bitmap_; }

  float device_pixel_ratio() const { return device_pixel_ratio_; }

 private:
  // Raw image data of the thumbnail.
  SkBitmap bitmap_;

  // Intended resolution of the thumbnail image. The dimensions of `bitmap_`
  // are the dimensions of the thumbnail in CSS pixels multiplied by
  // `device_pixel_ratio_`.
  // Only values between 0.25 and 2 are supported.
  float device_pixel_ratio_ = 1;
};

}  // namespace chrome_pdf

#endif  // PDF_THUMBNAIL_H_