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/SkRefCnt.h" 12 13 class SkImage; 14 class SkMipmap; 15 class SkPixmap; 16 struct SkImageInfo; 17 18 class SkMipmapBuilder { 19 public: 20 SkMipmapBuilder(const SkImageInfo&); 21 ~SkMipmapBuilder(); 22 23 int countLevels() const; 24 SkPixmap level(int index) const; 25 26 /** 27 * If these levels are compatible with src, return a new Image that combines src's base level 28 * with these levels as mip levels. If not compatible, this returns nullptr. 29 */ 30 sk_sp<SkImage> attachTo(const sk_sp<const SkImage>& src); 31 32 private: 33 sk_sp<SkMipmap> fMM; 34 }; 35 36 #endif 37