xref: /aosp_15_r20/external/skia/tools/viewer/SKPSlide.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1 /*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7 
8 #ifndef SKPSlide_DEFINED
9 #define SKPSlide_DEFINED
10 
11 #include "include/core/SkRect.h"
12 #include "include/core/SkRefCnt.h"
13 #include "include/core/SkScalar.h"
14 #include "include/core/SkSize.h"
15 #include "tools/viewer/Slide.h"
16 
17 #include <memory>
18 
19 class SkCanvas;
20 class SkPicture;
21 class SkStream;
22 class SkString;
23 
24 class SKPSlide : public Slide {
25 public:
26     SKPSlide(const SkString& name, const SkString& path);
27     SKPSlide(const SkString& name, std::unique_ptr<SkStream>);
28     ~SKPSlide() override;
29 
getDimensions()30     SkISize getDimensions() const override { return fCullRect.size(); }
31 
32     void draw(SkCanvas* canvas) override;
33     void load(SkScalar winWidth, SkScalar winHeight) override;
34     void unload() override;
35 
36 private:
37     std::unique_ptr<SkStream> fStream;
38     sk_sp<const SkPicture> fPic;
39     SkIRect fCullRect;
40 };
41 
42 #endif
43