remove legacy flags for old image filtering
BUG=skia: TBR= Review URL: https://codereview.chromium.org/857193003
This commit is contained in:
parent
2babfd96ae
commit
83c8dec46a
@ -482,30 +482,6 @@ bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) {
|
||||
fInvMatrix = inv;
|
||||
fFilterLevel = paint.getFilterLevel();
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_HQ_SCALING
|
||||
// possiblyScaleImage will look to see if it can rescale the image as a
|
||||
// preprocess; either by scaling up to the target size, or by selecting
|
||||
// a nearby mipmap level. If it does, it will adjust the working
|
||||
// matrix as well as the working bitmap. It may also adjust the filter
|
||||
// quality to avoid re-filtering an already perfectly scaled image.
|
||||
if (!this->possiblyScaleImage()) {
|
||||
if (!this->lockBaseBitmap()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// The above logic should have always assigned fBitmap, but in case it
|
||||
// didn't, we check for that now...
|
||||
// TODO(dominikg): Ask humper@ if we can just use an SkASSERT(fBitmap)?
|
||||
if (NULL == fBitmap) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If we are "still" kMedium_FilterLevel, then the request was not fulfilled by possiblyScale,
|
||||
// so we downgrade to kLow (so the rest of the sniffing code can assume that)
|
||||
if (SkPaint::kMedium_FilterLevel == fFilterLevel) {
|
||||
fFilterLevel = SkPaint::kLow_FilterLevel;
|
||||
}
|
||||
#else
|
||||
if (SkPaint::kHigh_FilterLevel == fFilterLevel) {
|
||||
this->processHQRequest();
|
||||
}
|
||||
@ -522,7 +498,6 @@ bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) {
|
||||
}
|
||||
}
|
||||
SkASSERT(fBitmap);
|
||||
#endif
|
||||
|
||||
bool trivialMatrix = (fInvMatrix.getType() & ~SkMatrix::kTranslate_Mask) == 0;
|
||||
bool clampClamp = SkShader::kClamp_TileMode == fTileModeX &&
|
||||
|
@ -225,23 +225,6 @@ SkMipMap* SkMipMap::Build(const SkBitmap& src, SkDiscardableFactoryProc fact) {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_MIPLEVELCHOICE
|
||||
static SkFixed compute_level(SkScalar scale) {
|
||||
SkScalar inv = SkScalarAbs(SkScalarInvert(scale));
|
||||
if (inv > 32767) { // Watch out for SkFixed overflow.
|
||||
inv = 32767;
|
||||
}
|
||||
SkFixed s = SkScalarToFixed(inv);
|
||||
|
||||
if (s < SK_Fixed1) {
|
||||
return 0;
|
||||
}
|
||||
int clz = SkCLZ(s);
|
||||
SkASSERT(clz >= 1 && clz <= 15);
|
||||
return SkIntToFixed(15 - clz) + ((unsigned)(s << (clz + 1)) >> 16);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool SkMipMap::extractLevel(SkScalar scale, Level* levelPtr) const {
|
||||
if (NULL == fLevels) {
|
||||
return false;
|
||||
@ -251,9 +234,6 @@ bool SkMipMap::extractLevel(SkScalar scale, Level* levelPtr) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_MIPLEVELCHOICE
|
||||
int level = compute_level(scale) >> 16;
|
||||
#else
|
||||
SkScalar L = -SkScalarLog2(scale);
|
||||
if (!SkScalarIsFinite(L)) {
|
||||
return false;
|
||||
@ -261,7 +241,6 @@ bool SkMipMap::extractLevel(SkScalar scale, Level* levelPtr) const {
|
||||
SkASSERT(L >= 0);
|
||||
int level = SkScalarRoundToInt(L);
|
||||
// SkDebugf("mipmap scale=%g L=%g level=%d\n", scale, L, level);
|
||||
#endif
|
||||
|
||||
SkASSERT(level >= 0);
|
||||
if (level <= 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user