Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkMipmapAccessor.h
Go to the documentation of this file.
1/*
2 * Copyright 2015 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 SkMipmapAccessor_DEFINED
9#define SkMipmapAccessor_DEFINED
10
17#include "src/core/SkMipmap.h"
18
19#include <utility>
20
21class SkArenaAlloc;
22class SkImage;
23class SkImage_Base;
24enum class SkMipmapMode;
25
27public:
28 // Returns null on failure
30
31 std::pair<SkPixmap, SkMatrix> level() const {
32 SkASSERT(fUpper.addr() != nullptr);
33 return std::make_pair(fUpper, fUpperInv);
34 }
35
36 std::pair<SkPixmap, SkMatrix> lowerLevel() const {
37 SkASSERT(fLower.addr() != nullptr);
38 return std::make_pair(fLower, fLowerInv);
39 }
40
41 // 0....1. Will be 0 if there is no lowerLevel
42 float lowerWeight() const { return fLowerWeight; }
43
44private:
45 SkPixmap fUpper,
46 fLower; // only valid for mip_linear
47 float fLowerWeight; // lower * weight + upper * (1 - weight)
48 SkMatrix fUpperInv,
49 fLowerInv;
50
51 // these manage lifetime for the buffers
52 SkBitmap fBaseStorage;
53 sk_sp<const SkMipmap> fCurrMip;
54
55public:
56 // Don't call publicly -- this is only public for SkArenaAlloc to access it inside Make()
57 SkMipmapAccessor(const SkImage_Base*, const SkMatrix& inv, SkMipmapMode requestedMode);
58};
59
60#endif
static SkM44 inv(const SkM44 &m)
Definition 3d.cpp:26
#define SkASSERT(cond)
Definition SkAssert.h:116
SkMipmapMode
float lowerWeight() const
static SkMipmapAccessor * Make(SkArenaAlloc *, const SkImage *, const SkMatrix &inv, SkMipmapMode)
std::pair< SkPixmap, SkMatrix > lowerLevel() const
std::pair< SkPixmap, SkMatrix > level() const
const void * addr() const
Definition SkPixmap.h:153