Alias two sets of enums

Change-Id: Id5104dea2987945d572d60135ee0fe374e980f26
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348182
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2020-12-29 12:23:46 -05:00 committed by Skia Commit-Bot
parent 67a477b85b
commit fe4611c18e
3 changed files with 10 additions and 5 deletions

View File

@ -14,12 +14,16 @@
enum class SkFilterMode {
kNearest, // single sample point (nearest neighbor)
kLinear, // interporate between 2x2 sample points (bilinear interpolation)
kLast = kLinear,
};
enum class SkMipmapMode {
kNone, // ignore mipmap levels, sample from the "base"
kNearest, // sample from the nearest level
kLinear, // interpolate between the two nearest levels
kLast = kLinear,
};
/*

View File

@ -8,6 +8,7 @@
#ifndef GrSamplerState_DEFINED
#define GrSamplerState_DEFINED
#include "include/core/SkSamplingOptions.h"
#include "include/gpu/GrTypes.h"
#include <limits>
@ -16,8 +17,8 @@
*/
class GrSamplerState {
public:
enum class Filter : uint8_t { kNearest, kLinear, kLast = kLinear };
enum class MipmapMode : uint8_t { kNone, kNearest, kLinear, kLast = kLinear };
using Filter = SkFilterMode;
using MipmapMode = SkMipmapMode;
enum class WrapMode : uint8_t {
kClamp,

View File

@ -485,9 +485,9 @@ GrInterpretSamplingOptions(SkISize imageDims,
}
}
Filter f = static_cast<Filter>(sampling.filter);
MipmapMode m = static_cast<MipmapMode>(sampling.mipmap);
if (allowFilterQualityReduction && (sampling.mipmap != SkMipmapMode::kNone)) {
Filter f = sampling.filter;
MipmapMode m = sampling.mipmap;
if (allowFilterQualityReduction && (m != MipmapMode::kNone)) {
SkMatrix matrix;
matrix.setConcat(viewM, localM);
// With sharp mips, we bias lookups by -0.5. That means our final LOD is >= 0 until