From 93a1215fe0ab007ce941c721f1fd3e9dcb5d4754 Mon Sep 17 00:00:00 2001 From: reed Date: Mon, 16 Mar 2015 10:08:34 -0700 Subject: SkPaint::FilterLevel -> SkFilterQuality clone (+rebase) of https://codereview.chromium.org/1009183002/ BUG=skia: TBR=scroggo@google.com Review URL: https://codereview.chromium.org/1014533004 --- src/animator/SkDrawPaint.cpp | 2 +- src/core/SkBitmapProcShader.cpp | 10 +++--- src/core/SkBitmapProcState.cpp | 46 ++++++++++++++-------------- src/core/SkBitmapProcState_matrixProcs.cpp | 4 +-- src/core/SkBitmapProcState_sample.h | 10 +++--- src/core/SkBitmapProcState_shaderproc.h | 2 +- src/core/SkPaint.cpp | 8 ++--- src/effects/SkBitmapSource.cpp | 4 +-- src/effects/SkMatrixImageFilter.cpp | 18 +++++------ src/effects/SkPictureImageFilter.cpp | 18 +++++------ src/effects/SkTestImageFilters.cpp | 2 +- src/gpu/SkGpuDevice.cpp | 12 ++++---- src/opts/SkBitmapProcState_opts_SSE2.cpp | 6 ++-- src/opts/SkBitmapProcState_opts_SSSE3.cpp | 4 +-- src/opts/SkBitmapProcState_opts_arm.cpp | 6 ++-- src/opts/SkBitmapProcState_opts_mips_dsp.cpp | 6 ++-- src/pipe/SkGPipeRead.cpp | 2 +- src/pipe/SkGPipeWrite.cpp | 6 ++-- src/ports/SkFontHost_FreeType_common.cpp | 2 +- src/utils/SkLua.cpp | 12 ++++---- src/utils/debugger/SkDebugCanvas.cpp | 14 ++++----- src/utils/debugger/SkDebugCanvas.h | 2 +- 22 files changed, 98 insertions(+), 98 deletions(-) (limited to 'src') diff --git a/src/animator/SkDrawPaint.cpp b/src/animator/SkDrawPaint.cpp index c882427585..f5d33881a0 100644 --- a/src/animator/SkDrawPaint.cpp +++ b/src/animator/SkDrawPaint.cpp @@ -218,7 +218,7 @@ void SkDrawPaint::setupPaint(SkPaint* paint) const { if (fakeBold != -1) paint->setFakeBoldText(SkToBool(fakeBold)); if (filterBitmap != -1) - paint->setFilterLevel(filterBitmap ? SkPaint::kLow_FilterLevel : SkPaint::kNone_FilterLevel); + paint->setFilterQuality(filterBitmap ? kLow_SkFilterQuality : kNone_SkFilterQuality); // stroke is legacy; style setting if present overrides stroke if (stroke != -1) paint->setStyle(SkToBool(stroke) ? SkPaint::kStroke_Style : SkPaint::kFill_Style); diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp index 456e0d4920..c1a03fecaf 100644 --- a/src/core/SkBitmapProcShader.cpp +++ b/src/core/SkBitmapProcShader.cpp @@ -397,14 +397,14 @@ bool SkBitmapProcShader::asFragmentProcessor(GrContext* context, const SkPaint& // are provided by the caller. bool useBicubic = false; GrTextureParams::FilterMode textureFilterMode; - switch(paint.getFilterLevel()) { - case SkPaint::kNone_FilterLevel: + switch(paint.getFilterQuality()) { + case kNone_SkFilterQuality: textureFilterMode = GrTextureParams::kNone_FilterMode; break; - case SkPaint::kLow_FilterLevel: + case kLow_SkFilterQuality: textureFilterMode = GrTextureParams::kBilerp_FilterMode; break; - case SkPaint::kMedium_FilterLevel: { + case kMedium_SkFilterQuality: { SkMatrix matrix; matrix.setConcat(viewM, this->getLocalMatrix()); if (matrix.getMinScale() < SK_Scalar1) { @@ -415,7 +415,7 @@ bool SkBitmapProcShader::asFragmentProcessor(GrContext* context, const SkPaint& } break; } - case SkPaint::kHigh_FilterLevel: { + case kHigh_SkFilterQuality: { SkMatrix matrix; matrix.setConcat(viewM, this->getLocalMatrix()); useBicubic = GrBicubicEffect::ShouldUseBicubic(matrix, &textureFilterMode); diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp index 335924fc35..42d9c1003e 100644 --- a/src/core/SkBitmapProcState.cpp +++ b/src/core/SkBitmapProcState.cpp @@ -143,11 +143,11 @@ static bool extract_scale(const SkMatrix& matrix, SkVector* scale) { * using bilerp for any remaining transformations. */ void SkBitmapProcState::processHQRequest() { - SkASSERT(SkPaint::kHigh_FilterLevel == fFilterLevel); + SkASSERT(kHigh_SkFilterQuality == fFilterLevel); // Our default return state is to downgrade the request to Medium, w/ or w/o setting fBitmap // to a valid bitmap. If we succeed, we will set this to Low instead. - fFilterLevel = SkPaint::kMedium_FilterLevel; + fFilterLevel = kMedium_SkFilterQuality; if (kN32_SkColorType != fOrigBitmap.colorType() || !cache_size_okay(fOrigBitmap, fInvMatrix) || fInvMatrix.hasPerspective()) @@ -194,7 +194,7 @@ void SkBitmapProcState::processHQRequest() { fInvMatrix.postScale(roundedDestWidth / fOrigBitmap.width(), roundedDestHeight / fOrigBitmap.height()); - fFilterLevel = SkPaint::kLow_FilterLevel; + fFilterLevel = kLow_SkFilterQuality; } /* @@ -202,11 +202,11 @@ void SkBitmapProcState::processHQRequest() { * (in this case, we have the inverse, so it succeeds if fInvMatrix is upscaling) */ void SkBitmapProcState::processMediumRequest() { - SkASSERT(SkPaint::kMedium_FilterLevel == fFilterLevel); + SkASSERT(kMedium_SkFilterQuality == fFilterLevel); // Our default return state is to downgrade the request to Low, w/ or w/o setting fBitmap // to a valid bitmap. - fFilterLevel = SkPaint::kLow_FilterLevel; + fFilterLevel = kLow_SkFilterQuality; SkScalar invScale = effective_matrix_scale(fInvMatrix); @@ -289,17 +289,17 @@ bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) { fBitmap = NULL; fInvMatrix = inv; - fFilterLevel = paint.getFilterLevel(); + fFilterLevel = paint.getFilterQuality(); - if (SkPaint::kHigh_FilterLevel == fFilterLevel) { + if (kHigh_SkFilterQuality == fFilterLevel) { this->processHQRequest(); } - SkASSERT(fFilterLevel < SkPaint::kHigh_FilterLevel); + SkASSERT(fFilterLevel < kHigh_SkFilterQuality); - if (SkPaint::kMedium_FilterLevel == fFilterLevel) { + if (kMedium_SkFilterQuality == fFilterLevel) { this->processMediumRequest(); } - SkASSERT(fFilterLevel < SkPaint::kMedium_FilterLevel); + SkASSERT(fFilterLevel < kMedium_SkFilterQuality); if (NULL == fBitmap) { if (!this->lockBaseBitmap()) { @@ -362,14 +362,14 @@ bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) { trivialMatrix = (fInvMatrix.getType() & ~SkMatrix::kTranslate_Mask) == 0; - if (SkPaint::kLow_FilterLevel == fFilterLevel) { + if (kLow_SkFilterQuality == fFilterLevel) { // Only try bilerp if the matrix is "interesting" and // the image has a suitable size. if (fInvType <= SkMatrix::kTranslate_Mask || !valid_for_filtering(fBitmap->width() | fBitmap->height())) { - fFilterLevel = SkPaint::kNone_FilterLevel; + fFilterLevel = kNone_SkFilterQuality; } } @@ -392,7 +392,7 @@ bool SkBitmapProcState::chooseScanlineProcs(bool trivialMatrix, bool clampClamp, // still set to HQ by the time we get here, then we must have installed // the shader procs above and can skip all this. - if (fFilterLevel < SkPaint::kHigh_FilterLevel) { + if (fFilterLevel < kHigh_SkFilterQuality) { int index = 0; if (fAlphaScale < 256) { // note: this distinction is not used for D16 @@ -401,7 +401,7 @@ bool SkBitmapProcState::chooseScanlineProcs(bool trivialMatrix, bool clampClamp, if (fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)) { index |= 2; } - if (fFilterLevel > SkPaint::kNone_FilterLevel) { + if (fFilterLevel > kNone_SkFilterQuality) { index |= 4; } // bits 3,4,5 encoding the source bitmap format @@ -544,7 +544,7 @@ static void Clamp_S32_D32_nofilter_trans_shaderproc(const SkBitmapProcState& s, SkASSERT(((s.fInvType & ~SkMatrix::kTranslate_Mask)) == 0); SkASSERT(s.fInvKy == 0); SkASSERT(count > 0 && colors != NULL); - SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel); + SkASSERT(kNone_SkFilterQuality == s.fFilterLevel); const int maxX = s.fBitmap->width() - 1; const int maxY = s.fBitmap->height() - 1; @@ -618,7 +618,7 @@ static void Repeat_S32_D32_nofilter_trans_shaderproc(const SkBitmapProcState& s, SkASSERT(((s.fInvType & ~SkMatrix::kTranslate_Mask)) == 0); SkASSERT(s.fInvKy == 0); SkASSERT(count > 0 && colors != NULL); - SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel); + SkASSERT(kNone_SkFilterQuality == s.fFilterLevel); const int stopX = s.fBitmap->width(); const int stopY = s.fBitmap->height(); @@ -664,7 +664,7 @@ static void S32_D32_constX_shaderproc(const SkBitmapProcState& s, int iY1 SK_INIT_TO_AVOID_WARNING; int iSubY SK_INIT_TO_AVOID_WARNING; - if (SkPaint::kNone_FilterLevel != s.fFilterLevel) { + if (kNone_SkFilterQuality != s.fFilterLevel) { SkBitmapProcState::MatrixProc mproc = s.getMatrixProc(); uint32_t xy[2]; @@ -745,7 +745,7 @@ static void S32_D32_constX_shaderproc(const SkBitmapProcState& s, const SkPMColor* row0 = s.fBitmap->getAddr32(0, iY0); SkPMColor color; - if (SkPaint::kNone_FilterLevel != s.fFilterLevel) { + if (kNone_SkFilterQuality != s.fFilterLevel) { const SkPMColor* row1 = s.fBitmap->getAddr32(0, iY1); if (s.fAlphaScale < 256) { @@ -801,7 +801,7 @@ SkBitmapProcState::ShaderProc32 SkBitmapProcState::chooseShaderProc32() { static const unsigned kMask = SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask; if (1 == fBitmap->width() && 0 == (fInvType & ~kMask)) { - if (SkPaint::kNone_FilterLevel == fFilterLevel && + if (kNone_SkFilterQuality == fFilterLevel && fInvType <= SkMatrix::kTranslate_Mask && !this->setupForTranslate()) { return DoNothing_shaderproc; @@ -815,7 +815,7 @@ SkBitmapProcState::ShaderProc32 SkBitmapProcState::chooseShaderProc32() { if (fInvType > SkMatrix::kTranslate_Mask) { return NULL; } - if (SkPaint::kNone_FilterLevel != fFilterLevel) { + if (kNone_SkFilterQuality != fFilterLevel) { return NULL; } @@ -911,9 +911,9 @@ void SkBitmapProcState::DebugMatrixProc(const SkBitmapProcState& state, // scale -vs- affine // filter -vs- nofilter if (state.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)) { - proc = state.fFilterLevel != SkPaint::kNone_FilterLevel ? check_scale_filter : check_scale_nofilter; + proc = state.fFilterLevel != kNone_SkFilterQuality ? check_scale_filter : check_scale_nofilter; } else { - proc = state.fFilterLevel != SkPaint::kNone_FilterLevel ? check_affine_filter : check_affine_nofilter; + proc = state.fFilterLevel != kNone_SkFilterQuality ? check_affine_filter : check_affine_nofilter; } proc(bitmapXY, count, state.fBitmap->width(), state.fBitmap->height()); } @@ -948,7 +948,7 @@ int SkBitmapProcState::maxCountForBufferSize(size_t bufferSize) const { size >>= 2; } - if (fFilterLevel != SkPaint::kNone_FilterLevel) { + if (fFilterLevel != kNone_SkFilterQuality) { size >>= 1; } diff --git a/src/core/SkBitmapProcState_matrixProcs.cpp b/src/core/SkBitmapProcState_matrixProcs.cpp index 851389c700..b7a2ccbdd0 100644 --- a/src/core/SkBitmapProcState_matrixProcs.cpp +++ b/src/core/SkBitmapProcState_matrixProcs.cpp @@ -477,7 +477,7 @@ static void mirrorx_nofilter_trans(const SkBitmapProcState& s, SkBitmapProcState::MatrixProc SkBitmapProcState::chooseMatrixProc(bool trivial_matrix) { // test_int_tileprocs(); // check for our special case when there is no scale/affine/perspective - if (trivial_matrix && SkPaint::kNone_FilterLevel == fFilterLevel) { + if (trivial_matrix && kNone_SkFilterQuality == fFilterLevel) { fIntTileProcY = choose_int_tile_proc(fTileModeY); switch (fTileModeX) { case SkShader::kClamp_TileMode: @@ -490,7 +490,7 @@ SkBitmapProcState::MatrixProc SkBitmapProcState::chooseMatrixProc(bool trivial_m } int index = 0; - if (fFilterLevel != SkPaint::kNone_FilterLevel) { + if (fFilterLevel != kNone_SkFilterQuality) { index = 1; } if (fInvType & SkMatrix::kPerspective_Mask) { diff --git a/src/core/SkBitmapProcState_sample.h b/src/core/SkBitmapProcState_sample.h index 5c5f199f25..70305163cb 100644 --- a/src/core/SkBitmapProcState_sample.h +++ b/src/core/SkBitmapProcState_sample.h @@ -1,10 +1,10 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "SkUtils.h" #if DSTSIZE==32 @@ -42,7 +42,7 @@ void MAKENAME(_nofilter_DXDY)(const SkBitmapProcState& s, const uint32_t* SK_RESTRICT xy, int count, DSTTYPE* SK_RESTRICT colors) { SkASSERT(count > 0 && colors != NULL); - SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel); + SkASSERT(kNone_SkFilterQuality == s.fFilterLevel); SkDEBUGCODE(CHECKSTATE(s);) #ifdef PREAMBLE @@ -85,7 +85,7 @@ void MAKENAME(_nofilter_DX)(const SkBitmapProcState& s, int count, DSTTYPE* SK_RESTRICT colors) { SkASSERT(count > 0 && colors != NULL); SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)); - SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel); + SkASSERT(kNone_SkFilterQuality == s.fFilterLevel); SkDEBUGCODE(CHECKSTATE(s);) #ifdef PREAMBLE @@ -139,7 +139,7 @@ void MAKENAME(_filter_DX)(const SkBitmapProcState& s, const uint32_t* SK_RESTRICT xy, int count, DSTTYPE* SK_RESTRICT colors) { SkASSERT(count > 0 && colors != NULL); - SkASSERT(s.fFilterLevel != SkPaint::kNone_FilterLevel); + SkASSERT(s.fFilterLevel != kNone_SkFilterQuality); SkDEBUGCODE(CHECKSTATE(s);) #ifdef PREAMBLE @@ -185,7 +185,7 @@ void MAKENAME(_filter_DXDY)(const SkBitmapProcState& s, const uint32_t* SK_RESTRICT xy, int count, DSTTYPE* SK_RESTRICT colors) { SkASSERT(count > 0 && colors != NULL); - SkASSERT(s.fFilterLevel != SkPaint::kNone_FilterLevel); + SkASSERT(s.fFilterLevel != kNone_SkFilterQuality); SkDEBUGCODE(CHECKSTATE(s);) #ifdef PREAMBLE diff --git a/src/core/SkBitmapProcState_shaderproc.h b/src/core/SkBitmapProcState_shaderproc.h index 0014b4a526..7a7d45ef35 100644 --- a/src/core/SkBitmapProcState_shaderproc.h +++ b/src/core/SkBitmapProcState_shaderproc.h @@ -21,7 +21,7 @@ void SCALE_FILTER_NAME(const SkBitmapProcState& s, int x, int y, SkMatrix::kScale_Mask)) == 0); SkASSERT(s.fInvKy == 0); SkASSERT(count > 0 && colors != NULL); - SkASSERT(s.fFilterLevel != SkPaint::kNone_FilterLevel); + SkASSERT(s.fFilterLevel != kNone_SkFilterQuality); SkDEBUGCODE(CHECKSTATE(s);) const unsigned maxX = s.fBitmap->width() - 1; diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index 6ddbe027a1..24281d7cff 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -1896,7 +1896,7 @@ static FlatFlags unpack_paint_flags(SkPaint* paint, uint32_t packed) { paint->setFlags(packed >> 16); paint->setHinting((SkPaint::Hinting)((packed >> 14) & BPF_Mask(kHint_BPF))); paint->setTextAlign((SkPaint::Align)((packed >> 12) & BPF_Mask(kAlign_BPF))); - paint->setFilterLevel((SkPaint::FilterLevel)((packed >> 10) & BPF_Mask(kFilter_BPF))); + paint->setFilterQuality((SkFilterQuality)((packed >> 10) & BPF_Mask(kFilter_BPF))); return (FlatFlags)(packed & kFlatFlagMask); } @@ -1937,7 +1937,7 @@ void SkPaint::flatten(SkWriteBuffer& buffer) const { *ptr++ = this->getColor(); *ptr++ = pack_paint_flags(this->getFlags(), this->getHinting(), this->getTextAlign(), - this->getFilterLevel(), flatFlags); + this->getFilterQuality(), flatFlags); *ptr++ = pack_4(this->getStrokeCap(), this->getStrokeJoin(), this->getStyle(), this->getTextEncoding()); @@ -2257,8 +2257,8 @@ void SkPaint::toString(SkString* str) const { str->append(")"); str->append("
FilterLevel:
"); - static const char* gFilterLevelStrings[] = { "None", "Low", "Medium", "High" }; - str->append(gFilterLevelStrings[this->getFilterLevel()]); + static const char* gFilterQualityStrings[] = { "None", "Low", "Medium", "High" }; + str->append(gFilterQualityStrings[this->getFilterQuality()]); str->append("
"); str->append("
TextAlign:
"); diff --git a/src/effects/SkBitmapSource.cpp b/src/effects/SkBitmapSource.cpp index fc86f194b0..87c6053cc4 100644 --- a/src/effects/SkBitmapSource.cpp +++ b/src/effects/SkBitmapSource.cpp @@ -69,9 +69,9 @@ bool SkBitmapSource::onFilterImage(Proxy* proxy, const SkBitmap&, const Context& paint.setXfermodeMode(SkXfermode::kSrc_Mode); // FIXME: this probably shouldn't be necessary, but drawBitmapRectToRect asserts // None filtering when it's translate-only - paint.setFilterLevel( + paint.setFilterQuality( fSrcRect.width() == dstRect.width() && fSrcRect.height() == dstRect.height() ? - SkPaint::kNone_FilterLevel : SkPaint::kHigh_FilterLevel); + kNone_SkFilterQuality : kHigh_SkFilterQuality); canvas.drawBitmapRectToRect(fBitmap, &fSrcRect, dstRect, &paint); *result = device.get()->accessBitmap(false); diff --git a/src/effects/SkMatrixImageFilter.cpp b/src/effects/SkMatrixImageFilter.cpp index 4d9b1fa335..54caca6dc3 100644 --- a/src/effects/SkMatrixImageFilter.cpp +++ b/src/effects/SkMatrixImageFilter.cpp @@ -16,33 +16,33 @@ #include "SkRect.h" SkMatrixImageFilter::SkMatrixImageFilter(const SkMatrix& transform, - SkPaint::FilterLevel filterLevel, + SkFilterQuality filterQuality, SkImageFilter* input, uint32_t uniqueID) : INHERITED(1, &input, NULL, uniqueID), fTransform(transform), - fFilterLevel(filterLevel) { + fFilterQuality(filterQuality) { } SkMatrixImageFilter* SkMatrixImageFilter::Create(const SkMatrix& transform, - SkPaint::FilterLevel filterLevel, + SkFilterQuality filterQuality, SkImageFilter* input, uint32_t uniqueID) { - return SkNEW_ARGS(SkMatrixImageFilter, (transform, filterLevel, input, uniqueID)); + return SkNEW_ARGS(SkMatrixImageFilter, (transform, filterQuality, input, uniqueID)); } SkFlattenable* SkMatrixImageFilter::CreateProc(SkReadBuffer& buffer) { SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); SkMatrix matrix; buffer.readMatrix(&matrix); - SkPaint::FilterLevel level = static_cast(buffer.readInt()); - return Create(matrix, level, common.getInput(0), common.uniqueID()); + SkFilterQuality quality = static_cast(buffer.readInt()); + return Create(matrix, quality, common.getInput(0), common.uniqueID()); } void SkMatrixImageFilter::flatten(SkWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); buffer.writeMatrix(fTransform); - buffer.writeInt(fFilterLevel); + buffer.writeInt(fFilterQuality); } SkMatrixImageFilter::~SkMatrixImageFilter() { @@ -84,7 +84,7 @@ bool SkMatrixImageFilter::onFilterImage(Proxy* proxy, SkPaint paint; paint.setXfermodeMode(SkXfermode::kSrc_Mode); - paint.setFilterLevel(fFilterLevel); + paint.setFilterQuality(fFilterQuality); canvas.drawBitmap(src, srcRect.x(), srcRect.y(), &paint); *result = device.get()->accessBitmap(false); @@ -142,7 +142,7 @@ void SkMatrixImageFilter::toString(SkString* str) const { str->append("
FilterLevel:
"); static const char* gFilterLevelStrings[] = { "None", "Low", "Medium", "High" }; - str->append(gFilterLevelStrings[fFilterLevel]); + str->append(gFilterLevelStrings[fFilterQuality]); str->append("
"); str->appendf(")"); diff --git a/src/effects/SkPictureImageFilter.cpp b/src/effects/SkPictureImageFilter.cpp index 391af11169..d3bc15ce23 100644 --- a/src/effects/SkPictureImageFilter.cpp +++ b/src/effects/SkPictureImageFilter.cpp @@ -18,17 +18,17 @@ SkPictureImageFilter::SkPictureImageFilter(const SkPicture* picture, uint32_t un , fPicture(SkSafeRef(picture)) , fCropRect(picture ? picture->cullRect() : SkRect::MakeEmpty()) , fPictureResolution(kDeviceSpace_PictureResolution) - , fFilterLevel(SkPaint::kLow_FilterLevel) { + , fFilterQuality(kLow_SkFilterQuality) { } SkPictureImageFilter::SkPictureImageFilter(const SkPicture* picture, const SkRect& cropRect, uint32_t uniqueID, PictureResolution pictureResolution, - SkPaint::FilterLevel filterLevel) + SkFilterQuality filterQuality) : INHERITED(0, 0, NULL, uniqueID) , fPicture(SkSafeRef(picture)) , fCropRect(cropRect) , fPictureResolution(pictureResolution) - , fFilterLevel(filterLevel) { + , fFilterQuality(filterQuality) { } SkPictureImageFilter::~SkPictureImageFilter() { @@ -59,13 +59,13 @@ SkFlattenable* SkPictureImageFilter::CreateProc(SkReadBuffer& buffer) { if (kLocalSpace_PictureResolution == pictureResolution) { //filterLevel is only serialized if pictureResolution is LocalSpace - SkPaint::FilterLevel filterLevel; + SkFilterQuality filterQuality; if (buffer.isVersionLT(SkReadBuffer::kPictureImageFilterLevel_Version)) { - filterLevel = SkPaint::kLow_FilterLevel; + filterQuality = kLow_SkFilterQuality; } else { - filterLevel = (SkPaint::FilterLevel)buffer.readInt(); + filterQuality = (SkFilterQuality)buffer.readInt(); } - return CreateForLocalSpace(picture, cropRect, filterLevel); + return CreateForLocalSpace(picture, cropRect, filterQuality); } return Create(picture, cropRect); } @@ -86,7 +86,7 @@ void SkPictureImageFilter::flatten(SkWriteBuffer& buffer) const { buffer.writeRect(fCropRect); buffer.writeInt(fPictureResolution); if (kLocalSpace_PictureResolution == fPictureResolution) { - buffer.writeInt(fFilterLevel); + buffer.writeInt(fFilterQuality); } } @@ -168,7 +168,7 @@ void SkPictureImageFilter::drawPictureAtLocalResolution(Proxy* proxy, SkBaseDevi canvas.translate(-SkIntToScalar(deviceBounds.fLeft), -SkIntToScalar(deviceBounds.fTop)); canvas.concat(ctx.ctm()); SkPaint paint; - paint.setFilterLevel(fFilterLevel); + paint.setFilterQuality(fFilterQuality); canvas.drawBitmap(localDevice.get()->accessBitmap(false), SkIntToScalar(localIBounds.fLeft), SkIntToScalar(localIBounds.fTop), &paint); //canvas.drawPicture(fPicture); diff --git a/src/effects/SkTestImageFilters.cpp b/src/effects/SkTestImageFilters.cpp index f0f8ae0390..4858eb26f6 100755 --- a/src/effects/SkTestImageFilters.cpp +++ b/src/effects/SkTestImageFilters.cpp @@ -49,7 +49,7 @@ bool SkDownSampleImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src, OwnDeviceCanvas canvas(dev); SkPaint paint; - paint.setFilterLevel(SkPaint::kLow_FilterLevel); + paint.setFilterQuality(kLow_SkFilterQuality); canvas.scale(scale, scale); canvas.drawBitmap(src, 0, 0, &paint); tmp = dev->accessBitmap(false); diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 757dfbf521..a3d2cc3db1 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -1220,19 +1220,19 @@ void SkGpuDevice::drawBitmapCommon(const SkDraw& draw, viewM.preConcat(m); GrTextureParams params; - SkPaint::FilterLevel paintFilterLevel = paint.getFilterLevel(); + SkFilterQuality paintFilterQuality = paint.getFilterQuality(); GrTextureParams::FilterMode textureFilterMode; bool doBicubic = false; - switch(paintFilterLevel) { - case SkPaint::kNone_FilterLevel: + switch(paintFilterQuality) { + case kNone_SkFilterQuality: textureFilterMode = GrTextureParams::kNone_FilterMode; break; - case SkPaint::kLow_FilterLevel: + case kLow_SkFilterQuality: textureFilterMode = GrTextureParams::kBilerp_FilterMode; break; - case SkPaint::kMedium_FilterLevel: + case kMedium_SkFilterQuality: if (viewM.getMinScale() < SK_Scalar1) { textureFilterMode = GrTextureParams::kMipMap_FilterMode; } else { @@ -1240,7 +1240,7 @@ void SkGpuDevice::drawBitmapCommon(const SkDraw& draw, textureFilterMode = GrTextureParams::kBilerp_FilterMode; } break; - case SkPaint::kHigh_FilterLevel: + case kHigh_SkFilterQuality: // Minification can look bad with the bicubic effect. doBicubic = GrBicubicEffect::ShouldUseBicubic(viewM, &textureFilterMode); diff --git a/src/opts/SkBitmapProcState_opts_SSE2.cpp b/src/opts/SkBitmapProcState_opts_SSE2.cpp index 1f3bbc1f8f..659caf25b8 100644 --- a/src/opts/SkBitmapProcState_opts_SSE2.cpp +++ b/src/opts/SkBitmapProcState_opts_SSE2.cpp @@ -15,7 +15,7 @@ void S32_opaque_D32_filter_DX_SSE2(const SkBitmapProcState& s, const uint32_t* xy, int count, uint32_t* colors) { SkASSERT(count > 0 && colors != NULL); - SkASSERT(s.fFilterLevel != SkPaint::kNone_FilterLevel); + SkASSERT(s.fFilterLevel != kNone_SkFilterQuality); SkASSERT(kN32_SkColorType == s.fBitmap->colorType()); SkASSERT(s.fAlphaScale == 256); @@ -121,7 +121,7 @@ void S32_alpha_D32_filter_DX_SSE2(const SkBitmapProcState& s, const uint32_t* xy, int count, uint32_t* colors) { SkASSERT(count > 0 && colors != NULL); - SkASSERT(s.fFilterLevel != SkPaint::kNone_FilterLevel); + SkASSERT(s.fFilterLevel != kNone_SkFilterQuality); SkASSERT(kN32_SkColorType == s.fBitmap->colorType()); SkASSERT(s.fAlphaScale < 256); @@ -641,7 +641,7 @@ void S32_D16_filter_DX_SSE2(const SkBitmapProcState& s, const uint32_t* xy, int count, uint16_t* colors) { SkASSERT(count > 0 && colors != NULL); - SkASSERT(s.fFilterLevel != SkPaint::kNone_FilterLevel); + SkASSERT(s.fFilterLevel != kNone_SkFilterQuality); SkASSERT(kN32_SkColorType == s.fBitmap->colorType()); SkASSERT(s.fBitmap->isOpaque()); diff --git a/src/opts/SkBitmapProcState_opts_SSSE3.cpp b/src/opts/SkBitmapProcState_opts_SSSE3.cpp index 984a65e5e7..bfcd7caa72 100644 --- a/src/opts/SkBitmapProcState_opts_SSSE3.cpp +++ b/src/opts/SkBitmapProcState_opts_SSSE3.cpp @@ -394,7 +394,7 @@ void S32_generic_D32_filter_DX_SSSE3(const SkBitmapProcState& s, const uint32_t* xy, int count, uint32_t* colors) { SkASSERT(count > 0 && colors != NULL); - SkASSERT(s.fFilterLevel != SkPaint::kNone_FilterLevel); + SkASSERT(s.fFilterLevel != kNone_SkFilterQuality); SkASSERT(kN32_SkColorType == s.fBitmap->colorType()); if (has_alpha) { SkASSERT(s.fAlphaScale < 256); @@ -586,7 +586,7 @@ void S32_generic_D32_filter_DXDY_SSSE3(const SkBitmapProcState& s, const uint32_t* xy, int count, uint32_t* colors) { SkASSERT(count > 0 && colors != NULL); - SkASSERT(s.fFilterLevel != SkPaint::kNone_FilterLevel); + SkASSERT(s.fFilterLevel != kNone_SkFilterQuality); SkASSERT(kN32_SkColorType == s.fBitmap->colorType()); if (has_alpha) { SkASSERT(s.fAlphaScale < 256); diff --git a/src/opts/SkBitmapProcState_opts_arm.cpp b/src/opts/SkBitmapProcState_opts_arm.cpp index 4a84aee85f..e6799dea19 100644 --- a/src/opts/SkBitmapProcState_opts_arm.cpp +++ b/src/opts/SkBitmapProcState_opts_arm.cpp @@ -28,7 +28,7 @@ void SI8_D16_nofilter_DX_arm(const SkBitmapProcState& s, int count, uint16_t* SK_RESTRICT colors) { SkASSERT(count > 0 && colors != NULL); SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)); - SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel); + SkASSERT(kNone_SkFilterQuality == s.fFilterLevel); const uint16_t* SK_RESTRICT table = s.fBitmap->getColorTable()->read16BitCache(); const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels(); @@ -117,7 +117,7 @@ void SI8_opaque_D32_nofilter_DX_arm(const SkBitmapProcState& s, int count, SkPMColor* SK_RESTRICT colors) { SkASSERT(count > 0 && colors != NULL); SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)); - SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel); + SkASSERT(kNone_SkFilterQuality == s.fFilterLevel); const SkPMColor* SK_RESTRICT table = s.fBitmap->getColorTable()->readColors(); const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels(); @@ -201,7 +201,7 @@ void SkBitmapProcState::platformProcs() { switch (fBitmap->colorType()) { case kIndex_8_SkColorType: - if (justDx && SkPaint::kNone_FilterLevel == fFilterLevel) { + if (justDx && kNone_SkFilterQuality == fFilterLevel) { #if 0 /* crashing on android device */ fSampleProc16 = SI8_D16_nofilter_DX_arm; fShaderProc16 = NULL; diff --git a/src/opts/SkBitmapProcState_opts_mips_dsp.cpp b/src/opts/SkBitmapProcState_opts_mips_dsp.cpp index 6051cd8ab5..049519a613 100644 --- a/src/opts/SkBitmapProcState_opts_mips_dsp.cpp +++ b/src/opts/SkBitmapProcState_opts_mips_dsp.cpp @@ -17,7 +17,7 @@ static void SI8_D16_nofilter_DX_mips_dsp(const SkBitmapProcState& s, int count, uint16_t* SK_RESTRICT colors) { SkASSERT(count > 0 && colors != NULL); SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)); - SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel); + SkASSERT(kNone_SkFilterQuality == s.fFilterLevel); const uint16_t* SK_RESTRICT table = s.fBitmap->getColorTable()->read16BitCache(); const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels(); SkASSERT((unsigned)xy[0] < (unsigned)s.fBitmap->height()); @@ -149,7 +149,7 @@ static void SI8_opaque_D32_nofilter_DX_mips_dsp(const SkBitmapProcState& s, int count, SkPMColor* SK_RESTRICT colors) { SkASSERT(count > 0 && colors != NULL); SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)); - SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel); + SkASSERT(kNone_SkFilterQuality == s.fFilterLevel); const SkPMColor* SK_RESTRICT table = s.fBitmap->getColorTable()->readColors(); const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels(); srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fBitmap->rowBytes()); @@ -378,7 +378,7 @@ void SkBitmapProcState::platformProcs() { switch (fBitmap->colorType()) { case kIndex_8_SkColorType: - if (justDx && SkPaint::kNone_FilterLevel == fFilterLevel) { + if (justDx && kNone_SkFilterQuality == fFilterLevel) { fSampleProc16 = SI8_D16_nofilter_DX_mips_dsp; fShaderProc16 = NULL; if (isOpaque) { diff --git a/src/pipe/SkGPipeRead.cpp b/src/pipe/SkGPipeRead.cpp index 7684b72049..916ab6a75c 100644 --- a/src/pipe/SkGPipeRead.cpp +++ b/src/pipe/SkGPipeRead.cpp @@ -682,7 +682,7 @@ static void paintOp_rp(SkCanvas*, SkReader32* reader, uint32_t op32, case kReset_PaintOp: p->reset(); break; case kFlags_PaintOp: p->setFlags(data); break; case kColor_PaintOp: p->setColor(reader->readU32()); break; - case kFilterLevel_PaintOp: p->setFilterLevel((SkPaint::FilterLevel)data); break; + case kFilterLevel_PaintOp: p->setFilterQuality((SkFilterQuality)data); break; case kStyle_PaintOp: p->setStyle((SkPaint::Style)data); break; case kJoin_PaintOp: p->setStrokeJoin((SkPaint::Join)data); break; case kCap_PaintOp: p->setStrokeCap((SkPaint::Cap)data); break; diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp index be687f7d31..db6c2af4dc 100644 --- a/src/pipe/SkGPipeWrite.cpp +++ b/src/pipe/SkGPipeWrite.cpp @@ -1136,9 +1136,9 @@ void SkGPipeCanvas::writePaint(const SkPaint& paint) { *ptr++ = paint.getColor(); base.setColor(paint.getColor()); } - if (base.getFilterLevel() != paint.getFilterLevel()) { - *ptr++ = PaintOp_packOpData(kFilterLevel_PaintOp, paint.getFilterLevel()); - base.setFilterLevel(paint.getFilterLevel()); + if (base.getFilterQuality() != paint.getFilterQuality()) { + *ptr++ = PaintOp_packOpData(kFilterLevel_PaintOp, paint.getFilterQuality()); + base.setFilterQuality(paint.getFilterQuality()); } if (base.getStyle() != paint.getStyle()) { *ptr++ = PaintOp_packOpData(kStyle_PaintOp, paint.getStyle()); diff --git a/src/ports/SkFontHost_FreeType_common.cpp b/src/ports/SkFontHost_FreeType_common.cpp index a0863c1fe8..5afe70a668 100644 --- a/src/ports/SkFontHost_FreeType_common.cpp +++ b/src/ports/SkFontHost_FreeType_common.cpp @@ -463,7 +463,7 @@ void SkScalerContext_FreeType_Base::generateGlyphImage(FT_Face face, const SkGly canvas.scale(SkIntToScalar(glyph.fWidth) / SkIntToScalar(face->glyph->bitmap.width), SkIntToScalar(glyph.fHeight) / SkIntToScalar(face->glyph->bitmap.rows)); SkPaint paint; - paint.setFilterLevel(SkPaint::kMedium_FilterLevel); + paint.setFilterQuality(kMedium_SkFilterQuality); canvas.drawBitmap(unscaledBitmap, 0, 0, &paint); // If the destination is BW or LCD, convert from A8. diff --git a/src/utils/SkLua.cpp b/src/utils/SkLua.cpp index ba79933c18..84932cd23e 100644 --- a/src/utils/SkLua.cpp +++ b/src/utils/SkLua.cpp @@ -927,15 +927,15 @@ static int lpaint_getHinting(lua_State* L) { return 1; } -static int lpaint_getFilterLevel(lua_State* L) { - SkLua(L).pushU32(get_obj(L, 1)->getFilterLevel()); +static int lpaint_getFilterQuality(lua_State* L) { + SkLua(L).pushU32(get_obj(L, 1)->getFilterQuality()); return 1; } -static int lpaint_setFilterLevel(lua_State* L) { +static int lpaint_setFilterQuality(lua_State* L) { int level = lua2int_def(L, 2, -1); if (level >= 0 && level <= 3) { - get_obj(L, 1)->setFilterLevel((SkPaint::FilterLevel)level); + get_obj(L, 1)->setFilterQuality((SkFilterQuality)level); } return 0; } @@ -1131,8 +1131,8 @@ static const struct luaL_Reg gSkPaint_Methods[] = { { "setAntiAlias", lpaint_setAntiAlias }, { "isDither", lpaint_isDither }, { "setDither", lpaint_setDither }, - { "getFilterLevel", lpaint_getFilterLevel }, - { "setFilterLevel", lpaint_setFilterLevel }, + { "getFilterQuality", lpaint_getFilterQuality }, + { "setFilterQuality", lpaint_setFilterQuality }, { "isUnderlineText", lpaint_isUnderlineText }, { "isStrikeThruText", lpaint_isStrikeThruText }, { "isFakeBoldText", lpaint_isFakeBoldText }, diff --git a/src/utils/debugger/SkDebugCanvas.cpp b/src/utils/debugger/SkDebugCanvas.cpp index 64745820cc..779d6950d7 100644 --- a/src/utils/debugger/SkDebugCanvas.cpp +++ b/src/utils/debugger/SkDebugCanvas.cpp @@ -156,20 +156,20 @@ private: // texture filtering mode class SkTexOverrideFilter : public SkDrawFilter { public: - SkTexOverrideFilter() : fFilterLevel(SkPaint::kNone_FilterLevel) { + SkTexOverrideFilter() : fFilterQuality(kNone_SkFilterQuality) { } - void setFilterLevel(SkPaint::FilterLevel filterLevel) { - fFilterLevel = filterLevel; + void setFilterQuality(SkFilterQuality filterQuality) { + fFilterQuality = filterQuality; } bool filter(SkPaint* p, Type) SK_OVERRIDE { - p->setFilterLevel(fFilterLevel); + p->setFilterQuality(fFilterQuality); return true; } protected: - SkPaint::FilterLevel fFilterLevel; + SkFilterQuality fFilterQuality; private: typedef SkDrawFilter INHERITED; @@ -379,13 +379,13 @@ SkTDArray & SkDebugCanvas::getDrawCommands() { return fCommandVector; } -void SkDebugCanvas::overrideTexFiltering(bool overrideTexFiltering, SkPaint::FilterLevel level) { +void SkDebugCanvas::overrideTexFiltering(bool overrideTexFiltering, SkFilterQuality quality) { if (NULL == fTexOverrideFilter) { fTexOverrideFilter = new SkTexOverrideFilter; } fOverrideTexFiltering = overrideTexFiltering; - fTexOverrideFilter->setFilterLevel(level); + fTexOverrideFilter->setFilterQuality(quality); } void SkDebugCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) { diff --git a/src/utils/debugger/SkDebugCanvas.h b/src/utils/debugger/SkDebugCanvas.h index 97eb73449c..5771dd9a74 100644 --- a/src/utils/debugger/SkDebugCanvas.h +++ b/src/utils/debugger/SkDebugCanvas.h @@ -42,7 +42,7 @@ public: /** * Enable or disable texure filtering override */ - void overrideTexFiltering(bool overrideTexFiltering, SkPaint::FilterLevel level); + void overrideTexFiltering(bool overrideTexFiltering, SkFilterQuality); /** Executes all draw calls to the canvas. -- cgit v1.2.3