• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2020 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 SkMipmapBuilder_DEFINED
9 #define SkMipmapBuilder_DEFINED
10 
11 #include "include/core/SkImage.h"
12 
13 class SkMipmapBuilder {
14 public:
15     SkMipmapBuilder(const SkImageInfo&);
16     ~SkMipmapBuilder();
17 
18     int countLevels() const;
19     SkPixmap level(int index) const;
20 
21     /**
22      *  If these levels are compatible with src, return a new Image that combines src's base level
23      *  with these levels as mip levels. If not compatible, this returns nullptr.
24      */
25     sk_sp<SkImage> attachTo(const SkImage* src);
26 
attachTo(sk_sp<SkImage> src)27     sk_sp<SkImage> attachTo(sk_sp<SkImage> src) {
28         return this->attachTo(src.get());
29     }
30 
31 private:
32     sk_sp<SkMipmap> fMM;
33 
34     friend class SkImage;
35 };
36 
37 #endif
38