From 13711ebe682c7de48144ee6f20d0d59209f2541c Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Tue, 14 Jul 2020 17:16:32 -0400 Subject: [PATCH] rename SkMipMap to SkMipmap Change-Id: I1fa8a0482a717847236a30b4851061f4074b7755 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302644 Reviewed-by: Brian Salomon Commit-Queue: Mike Reed --- .../{GrMipMapBench.cpp => GrMipmapBench.cpp} | 0 bench/{MipMapBench.cpp => MipmapBench.cpp} | 28 ++++++------ gm/compressed_textures.cpp | 6 +-- gm/exoticformats.cpp | 6 +-- gm/showmiplevels.cpp | 10 ++--- gn/bench.gni | 4 +- gn/core.gni | 4 +- include/core/SkBitmap.h | 4 +- include/core/SkImage.h | 8 ++-- include/gpu/GrContext.h | 6 +-- src/core/SkBitmap.cpp | 2 +- src/core/SkBitmapCache.cpp | 18 ++++---- src/core/SkBitmapCache.h | 8 ++-- src/core/SkBitmapController.cpp | 16 +++---- src/core/SkBitmapController.h | 6 +-- src/core/SkBitmapProcState.cpp | 2 +- src/core/SkBitmapProcState.h | 1 - src/core/SkCompressedDataUtils.cpp | 4 +- src/core/{SkMipMap.cpp => SkMipmap.cpp} | 43 +++++++++---------- src/core/{SkMipMap.h => SkMipmap.h} | 20 ++++----- src/core/SkResourceCache.cpp | 2 +- src/gpu/GrContext.cpp | 6 +-- src/gpu/GrDataUtils.cpp | 4 +- src/gpu/GrGpu.cpp | 4 +- src/gpu/GrProxyProvider.cpp | 12 +++--- src/gpu/GrSurfaceProxy.cpp | 2 +- src/gpu/GrTexture.cpp | 4 +- src/gpu/GrTextureProducer.cpp | 2 +- src/gpu/SkGr.cpp | 2 +- src/gpu/d3d/GrD3DGpu.cpp | 8 ++-- src/gpu/dawn/GrDawnGpu.cpp | 4 +- src/gpu/gl/GrGLGpu.cpp | 14 +++--- src/gpu/mtl/GrMtlGpu.mm | 4 +- src/gpu/vk/GrVkGpu.cpp | 12 +++--- src/gpu/vk/GrVkPipelineState.cpp | 2 +- src/gpu/vk/GrVkTextureRenderTarget.cpp | 2 +- src/image/SkImage.cpp | 10 ++--- src/image/SkImage_Base.h | 8 ++-- src/image/SkImage_Gpu.cpp | 2 +- src/image/SkImage_GpuYUVA.cpp | 2 +- src/image/SkImage_Raster.cpp | 6 +-- tests/CompressedBackendAllocationTest.cpp | 6 +-- tests/MipMapTest.cpp | 34 +++++++-------- tests/ResourceCacheTest.cpp | 2 +- tests/SkResourceCacheTest.cpp | 18 ++++---- tools/DDLPromiseImageHelper.cpp | 8 ++-- tools/DDLPromiseImageHelper.h | 6 +-- tools/fiddle/fiddle_main.cpp | 6 +-- 48 files changed, 193 insertions(+), 195 deletions(-) rename bench/{GrMipMapBench.cpp => GrMipmapBench.cpp} (100%) rename bench/{MipMapBench.cpp => MipmapBench.cpp} (66%) rename src/core/{SkMipMap.cpp => SkMipmap.cpp} (95%) rename src/core/{SkMipMap.h => SkMipmap.h} (85%) diff --git a/bench/GrMipMapBench.cpp b/bench/GrMipmapBench.cpp similarity index 100% rename from bench/GrMipMapBench.cpp rename to bench/GrMipmapBench.cpp diff --git a/bench/MipMapBench.cpp b/bench/MipmapBench.cpp similarity index 66% rename from bench/MipMapBench.cpp rename to bench/MipmapBench.cpp index baa8cd3c9b..bfd0e078b5 100644 --- a/bench/MipMapBench.cpp +++ b/bench/MipmapBench.cpp @@ -7,16 +7,16 @@ #include "bench/Benchmark.h" #include "include/core/SkBitmap.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" -class MipMapBench: public Benchmark { +class MipmapBench: public Benchmark { SkBitmap fBitmap; SkString fName; const int fW, fH; bool fHalfFoat; public: - MipMapBench(int w, int h, bool halfFloat = false) + MipmapBench(int w, int h, bool halfFloat = false) : fW(w), fH(h), fHalfFoat(halfFloat) { fName.printf("mipmap_build_%dx%d", w, h); @@ -42,7 +42,7 @@ protected: void onDraw(int loops, SkCanvas*) override { for (int i = 0; i < loops * 4; i++) { - SkMipMap::Build(fBitmap, nullptr)->unref(); + SkMipmap::Build(fBitmap, nullptr)->unref(); } } @@ -53,15 +53,15 @@ private: // Build variants that exercise the width and heights being even or odd at each level, as the // impl specializes on each of these. // -DEF_BENCH( return new MipMapBench(511, 511); ) -DEF_BENCH( return new MipMapBench(512, 511); ) -DEF_BENCH( return new MipMapBench(511, 512); ) -DEF_BENCH( return new MipMapBench(512, 512); ) +DEF_BENCH( return new MipmapBench(511, 511); ) +DEF_BENCH( return new MipmapBench(512, 511); ) +DEF_BENCH( return new MipmapBench(511, 512); ) +DEF_BENCH( return new MipmapBench(512, 512); ) -DEF_BENCH( return new MipMapBench(512, 512, true); ) -DEF_BENCH( return new MipMapBench(511, 511, true); ) +DEF_BENCH( return new MipmapBench(512, 512, true); ) +DEF_BENCH( return new MipmapBench(511, 511, true); ) -DEF_BENCH( return new MipMapBench(2048, 2048); ) -DEF_BENCH( return new MipMapBench(2047, 2047); ) -DEF_BENCH( return new MipMapBench(2048, 2047); ) -DEF_BENCH( return new MipMapBench(2047, 2048); ) +DEF_BENCH( return new MipmapBench(2048, 2048); ) +DEF_BENCH( return new MipmapBench(2047, 2047); ) +DEF_BENCH( return new MipmapBench(2048, 2047); ) +DEF_BENCH( return new MipmapBench(2047, 2048); ) diff --git a/gm/compressed_textures.cpp b/gm/compressed_textures.cpp index 3a41bfe383..1b627897ad 100644 --- a/gm/compressed_textures.cpp +++ b/gm/compressed_textures.cpp @@ -24,7 +24,7 @@ #include "include/gpu/GrContext.h" #include "include/gpu/GrRecordingContext.h" #include "src/core/SkCompressedDataUtils.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/gpu/GrContextPriv.h" #include "src/gpu/GrDataUtils.h" #include "src/gpu/GrRecordingContextPriv.h" @@ -108,7 +108,7 @@ static sk_sp make_compressed_data(SkISize dimensions, sk_sp tmp = SkData::MakeUninitialized(totalSize); char* pixels = (char*) tmp->writable_data(); - int numMipLevels = SkMipMap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1; + int numMipLevels = SkMipmap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1; size_t offset = 0; @@ -247,7 +247,7 @@ private: } SkISize levelDimensions = fImgDimensions; - int numMipLevels = SkMipMap::ComputeLevelCount(levelDimensions.width(), + int numMipLevels = SkMipmap::ComputeLevelCount(levelDimensions.width(), levelDimensions.height()) + 1; SkPaint imagePaint; diff --git a/gm/exoticformats.cpp b/gm/exoticformats.cpp index 22ca1deb79..cfffdda362 100644 --- a/gm/exoticformats.cpp +++ b/gm/exoticformats.cpp @@ -12,7 +12,7 @@ #include "include/gpu/GrContext.h" #include "include/gpu/GrRecordingContext.h" #include "src/core/SkCompressedDataUtils.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/gpu/GrRecordingContextPriv.h" #include "src/gpu/gl/GrGLDefines.h" #include "src/image/SkImage_Base.h" @@ -115,7 +115,7 @@ static sk_sp load_ktx(const char* filename, ImageInfo* imageInfo) { if (numberOfMipmapLevels == 1) { imageInfo->fMipMapped = GrMipMapped::kNo; } else { - int numRequiredMipLevels = SkMipMap::ComputeLevelCount(pixelWidth, pixelHeight)+1; + int numRequiredMipLevels = SkMipmap::ComputeLevelCount(pixelWidth, pixelHeight)+1; if (numberOfMipmapLevels != numRequiredMipLevels) { return nullptr; } @@ -256,7 +256,7 @@ static sk_sp load_dds(const char* filename, ImageInfo* imageInfo) { if (header.dwMipMapCount == 1) { imageInfo->fMipMapped = GrMipMapped::kNo; } else { - int numRequiredLevels = SkMipMap::ComputeLevelCount(header.dwWidth, header.dwHeight)+1; + int numRequiredLevels = SkMipmap::ComputeLevelCount(header.dwWidth, header.dwHeight)+1; if (header.dwMipMapCount != (unsigned) numRequiredLevels) { return nullptr; } diff --git a/gm/showmiplevels.cpp b/gm/showmiplevels.cpp index f518906737..f39562fa37 100644 --- a/gm/showmiplevels.cpp +++ b/gm/showmiplevels.cpp @@ -19,7 +19,7 @@ #include "include/core/SkSize.h" #include "include/core/SkString.h" #include "include/private/SkNx.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "tools/ToolUtils.h" #include @@ -141,10 +141,10 @@ protected: SkPixmap prevPM; baseBM.peekPixels(&prevPM); - sk_sp mm(SkMipMap::Build(baseBM, nullptr)); + sk_sp mm(SkMipmap::Build(baseBM, nullptr)); int index = 0; - SkMipMap::Level level; + SkMipmap::Level level; SkScalar scale = 0.5f; while (mm->extractLevel(SkSize::Make(scale, scale), &level)) { SkBitmap bm = func(prevPM, level.fPixmap); @@ -249,10 +249,10 @@ protected: SkScalar x = 4; SkScalar y = 4; - sk_sp mm(SkMipMap::Build(baseBM, nullptr)); + sk_sp mm(SkMipmap::Build(baseBM, nullptr)); int index = 0; - SkMipMap::Level level; + SkMipmap::Level level; SkScalar scale = 0.5f; while (mm->extractLevel(SkSize::Make(scale, scale), &level)) { SkBitmap bm; diff --git a/gn/bench.gni b/gn/bench.gni index 597a10933c..6e81f2f3d1 100644 --- a/gn/bench.gni +++ b/gn/bench.gni @@ -52,7 +52,7 @@ bench_sources = [ "$_bench/GameBench.cpp", "$_bench/GeometryBench.cpp", "$_bench/GrMemoryPoolBench.cpp", - "$_bench/GrMipMapBench.cpp", + "$_bench/GrMipmapBench.cpp", "$_bench/GrQuadBench.cpp", "$_bench/GrResourceCacheBench.cpp", "$_bench/GradientBench.cpp", @@ -77,7 +77,7 @@ bench_sources = [ "$_bench/MatrixConvolutionBench.cpp", "$_bench/MemsetBench.cpp", "$_bench/MergeBench.cpp", - "$_bench/MipMapBench.cpp", + "$_bench/MipmapBench.cpp", "$_bench/MorphologyBench.cpp", "$_bench/MutexBench.cpp", "$_bench/PDFBench.cpp", diff --git a/gn/core.gni b/gn/core.gni index 56769b4728..24226e43a7 100644 --- a/gn/core.gni +++ b/gn/core.gni @@ -266,8 +266,8 @@ skia_core_sources = [ "$_src/core/SkMessageBus.h", "$_src/core/SkMiniRecorder.cpp", "$_src/core/SkMiniRecorder.h", - "$_src/core/SkMipMap.cpp", - "$_src/core/SkMipMap.h", + "$_src/core/SkMipmap.cpp", + "$_src/core/SkMipmap.h", "$_src/core/SkModeColorFilter.cpp", "$_src/core/SkModeColorFilter.h", "$_src/core/SkNextID.h", diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h index 8fb2c393e5..450b057c59 100644 --- a/include/core/SkBitmap.h +++ b/include/core/SkBitmap.h @@ -17,7 +17,7 @@ #include "include/core/SkTileMode.h" struct SkMask; -class SkMipMap; +class SkMipmap; struct SkIRect; struct SkRect; class SkPaint; @@ -1166,7 +1166,7 @@ public: private: sk_sp fPixelRef; SkPixmap fPixmap; - sk_sp fMips; + sk_sp fMips; friend class SkImage_Raster; friend class SkReadBuffer; // unflatten diff --git a/include/core/SkImage.h b/include/core/SkImage.h index 2f4ec3b8b8..3ae1ab51ad 100644 --- a/include/core/SkImage.h +++ b/include/core/SkImage.h @@ -26,7 +26,7 @@ class SkData; class SkCanvas; class SkImageFilter; class SkImageGenerator; -class SkMipMap; +class SkMipmap; class SkPaint; class SkPicture; class SkSurface; @@ -63,10 +63,10 @@ public: int countLevels() const; SkPixmap level(int index) const; - sk_sp detach(); + sk_sp detach(); private: - sk_sp fMM; + sk_sp fMM; }; /** \class SkImage @@ -1210,7 +1210,7 @@ public: * If data == nullptr, the mipmap levels are computed automatically. * If data != nullptr, then the caller has provided the data for each level. */ - sk_sp withMipmaps(sk_sp data) const; + sk_sp withMipmaps(sk_sp data) const; /** Returns SkImage backed by GPU texture associated with context. Returned SkImage is compatible with SkSurface created with dstColorSpace. The returned SkImage respects diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index a3327a2a8d..c00dfd52ca 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -533,7 +533,7 @@ public: * If numLevels is 1 a non-mipMapped texture will result. If a mipMapped texture is desired * the data for all the mipmap levels must be provided. In the mipmapped case all the * colortypes of the provided pixmaps must be the same. Additionally, all the miplevels - * must be sized correctly (please see SkMipMap::ComputeLevelSize and ComputeLevelCount). + * must be sized correctly (please see SkMipmap::ComputeLevelSize and ComputeLevelCount). * Note: the pixmap's alphatypes and colorspaces are ignored. * For the Vulkan backend the layout of the created VkImage will be: * VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL @@ -579,7 +579,7 @@ public: * If the backend texture is mip mapped, the data for all the mipmap levels must be provided. * In the mipmapped case all the colortypes of the provided pixmaps must be the same. * Additionally, all the miplevels must be sized correctly (please see - * SkMipMap::ComputeLevelSize and ComputeLevelCount). + * SkMipmap::ComputeLevelSize and ComputeLevelCount). * Note: the pixmap's alphatypes and colorspaces are ignored. * For the Vulkan backend after a successful update the layout of the created VkImage will be: * VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL @@ -633,7 +633,7 @@ public: * The finishedProc will always get called even if we failed to create the GrBackendTexture * If numLevels is 1 a non-mipMapped texture will result. If a mipMapped texture is desired * the data for all the mipmap levels must be provided. Additionally, all the miplevels - * must be sized correctly (please see SkMipMap::ComputeLevelSize and ComputeLevelCount). + * must be sized correctly (please see SkMipmap::ComputeLevelSize and ComputeLevelCount). * For the Vulkan backend the layout of the created VkImage will be: * VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL */ diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp index 52bff8f0ea..219ac97318 100644 --- a/src/core/SkBitmap.cpp +++ b/src/core/SkBitmap.cpp @@ -23,7 +23,7 @@ #include "src/core/SkConvertPixels.h" #include "src/core/SkMask.h" #include "src/core/SkMaskFilterBase.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/core/SkPixelRefPriv.h" #include "src/core/SkPixmapPriv.h" #include "src/core/SkReadBuffer.h" diff --git a/src/core/SkBitmapCache.cpp b/src/core/SkBitmapCache.cpp index 6767c59093..1cc5c19331 100644 --- a/src/core/SkBitmapCache.cpp +++ b/src/core/SkBitmapCache.cpp @@ -9,7 +9,7 @@ #include "include/core/SkPixelRef.h" #include "include/core/SkRect.h" #include "src/core/SkBitmapCache.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/core/SkResourceCache.h" #include "src/image/SkImage_Base.h" @@ -230,7 +230,7 @@ public: }; struct MipMapRec : public SkResourceCache::Rec { - MipMapRec(const SkBitmapCacheDesc& desc, const SkMipMap* result) + MipMapRec(const SkBitmapCacheDesc& desc, const SkMipmap* result) : fKey(desc) , fMipMap(result) { @@ -250,7 +250,7 @@ struct MipMapRec : public SkResourceCache::Rec { static bool Finder(const SkResourceCache::Rec& baseRec, void* contextMip) { const MipMapRec& rec = static_cast(baseRec); - const SkMipMap* mm = SkRef(rec.fMipMap); + const SkMipmap* mm = SkRef(rec.fMipMap); // the call to ref() above triggers a "lock" in the case of discardable memory, // which means we can now check for null (in case the lock failed). if (nullptr == mm->data()) { @@ -258,20 +258,20 @@ struct MipMapRec : public SkResourceCache::Rec { return false; } // the call must call unref() when they are done. - *(const SkMipMap**)contextMip = mm; + *(const SkMipmap**)contextMip = mm; return true; } private: MipMapKey fKey; - const SkMipMap* fMipMap; + const SkMipmap* fMipMap; }; } -const SkMipMap* SkMipMapCache::FindAndRef(const SkBitmapCacheDesc& desc, +const SkMipmap* SkMipmapCache::FindAndRef(const SkBitmapCacheDesc& desc, SkResourceCache* localCache) { MipMapKey key(desc); - const SkMipMap* result; + const SkMipmap* result; if (!CHECK_LOCAL(localCache, find, Find, key, MipMapRec::Finder, &result)) { result = nullptr; @@ -284,13 +284,13 @@ static SkResourceCache::DiscardableFactory get_fact(SkResourceCache* localCache) : SkResourceCache::GetDiscardableFactory(); } -const SkMipMap* SkMipMapCache::AddAndRef(const SkImage_Base* image, SkResourceCache* localCache) { +const SkMipmap* SkMipmapCache::AddAndRef(const SkImage_Base* image, SkResourceCache* localCache) { SkBitmap src; if (!image->getROPixels(&src)) { return nullptr; } - SkMipMap* mipmap = SkMipMap::Build(src, get_fact(localCache)); + SkMipmap* mipmap = SkMipmap::Build(src, get_fact(localCache)); if (mipmap) { MipMapRec* rec = new MipMapRec(SkBitmapCacheDesc::Make(image), mipmap); CHECK_LOCAL(localCache, add, Add, rec); diff --git a/src/core/SkBitmapCache.h b/src/core/SkBitmapCache.h index 66021e4431..18ebcb2bd5 100644 --- a/src/core/SkBitmapCache.h +++ b/src/core/SkBitmapCache.h @@ -15,7 +15,7 @@ class SkBitmap; class SkImage; class SkImage_Base; struct SkImageInfo; -class SkMipMap; +class SkMipmap; class SkPixmap; class SkResourceCache; @@ -56,11 +56,11 @@ private: static void PrivateDeleteRec(Rec*); }; -class SkMipMapCache { +class SkMipmapCache { public: - static const SkMipMap* FindAndRef(const SkBitmapCacheDesc&, + static const SkMipmap* FindAndRef(const SkBitmapCacheDesc&, SkResourceCache* localCache = nullptr); - static const SkMipMap* AddAndRef(const SkImage_Base*, + static const SkMipmap* AddAndRef(const SkImage_Base*, SkResourceCache* localCache = nullptr); }; diff --git a/src/core/SkBitmapController.cpp b/src/core/SkBitmapController.cpp index b5390a0170..4a895cb20c 100644 --- a/src/core/SkBitmapController.cpp +++ b/src/core/SkBitmapController.cpp @@ -12,17 +12,17 @@ #include "src/core/SkBitmapCache.h" #include "src/core/SkBitmapController.h" #include "src/core/SkMatrixPriv.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/image/SkImage_Base.h" // Try to load from the base image, or from the cache -static sk_sp try_load_mips(const SkImage_Base* image) { - sk_sp mips = image->refMips(); +static sk_sp try_load_mips(const SkImage_Base* image) { + sk_sp mips = image->refMips(); if (!mips) { - mips.reset(SkMipMapCache::FindAndRef(SkBitmapCacheDesc::Make(image))); + mips.reset(SkMipmapCache::FindAndRef(SkBitmapCacheDesc::Make(image))); } if (!mips) { - mips.reset(SkMipMapCache::AddAndRef(image)); + mips.reset(SkMipmapCache::AddAndRef(image)); } return mips; } @@ -81,7 +81,7 @@ bool SkBitmapController::State::processMediumRequest(const SkImage_Base* image) const SkSize scale = SkSize::Make(SkScalarInvert(invScaleSize.width()), SkScalarInvert(invScaleSize.height())); - SkMipMap::Level level; + SkMipmap::Level level; if (fCurrMip->extractLevel(scale, &level)) { const SkSize& invScaleFixup = level.fScale; fInvMatrix.postScale(invScaleFixup.width(), invScaleFixup.height()); @@ -135,7 +135,7 @@ SkMipmapAccessor::SkMipmapAccessor(const SkImage_Base* image, const SkMatrix& in if (!inv.decomposeScale(&scale, nullptr)) { fResolvedMode = SkMipmapMode::kNone; } else { - level = SkMipMap::ComputeLevel({1/scale.width(), 1/scale.height()}); + level = SkMipmap::ComputeLevel({1/scale.width(), 1/scale.height()}); if (level <= 0) { fResolvedMode = SkMipmapMode::kNone; level = 0; @@ -157,7 +157,7 @@ SkMipmapAccessor::SkMipmapAccessor(const SkImage_Base* image, const SkMatrix& in load_upper_from_base(); fResolvedMode = SkMipmapMode::kNone; } else { - SkMipMap::Level levelRec; + SkMipmap::Level levelRec; SkASSERT(fResolvedMode != SkMipmapMode::kNone); if (levelNum > 0) { diff --git a/src/core/SkBitmapController.h b/src/core/SkBitmapController.h index 7f76003211..f2db228c01 100644 --- a/src/core/SkBitmapController.h +++ b/src/core/SkBitmapController.h @@ -13,7 +13,7 @@ #include "include/core/SkImage.h" #include "include/core/SkMatrix.h" #include "src/core/SkBitmapCache.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" class SkImage_Base; @@ -40,7 +40,7 @@ public: // Pixmap storage. SkBitmap fResultBitmap; - sk_sp fCurrMip; + sk_sp fCurrMip; }; @@ -70,7 +70,7 @@ private: // these manage lifetime for the buffers SkBitmap fBaseStorage; - sk_sp fCurrMip; + sk_sp fCurrMip; }; #endif diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp index 683f0234e1..e3b725dcb9 100755 --- a/src/core/SkBitmapProcState.cpp +++ b/src/core/SkBitmapProcState.cpp @@ -13,7 +13,7 @@ #include "src/core/SkBitmapCache.h" #include "src/core/SkBitmapController.h" #include "src/core/SkBitmapProcState.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/core/SkOpts.h" #include "src/core/SkResourceCache.h" #include "src/core/SkUtils.h" diff --git a/src/core/SkBitmapProcState.h b/src/core/SkBitmapProcState.h index ebf6396c79..af1fe70216 100644 --- a/src/core/SkBitmapProcState.h +++ b/src/core/SkBitmapProcState.h @@ -17,7 +17,6 @@ #include "src/core/SkArenaAlloc.h" #include "src/core/SkBitmapController.h" #include "src/core/SkMatrixPriv.h" -#include "src/core/SkMipMap.h" typedef SkFixed3232 SkFractionalInt; #define SkScalarToFractionalInt(x) SkScalarToFixed3232(x) diff --git a/src/core/SkCompressedDataUtils.cpp b/src/core/SkCompressedDataUtils.cpp index 5583c6116c..b618347bac 100644 --- a/src/core/SkCompressedDataUtils.cpp +++ b/src/core/SkCompressedDataUtils.cpp @@ -11,7 +11,7 @@ #include "include/core/SkData.h" #include "include/private/SkColorData.h" #include "src/core/SkMathPriv.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" struct ETC1Block { uint32_t fHigh; @@ -247,7 +247,7 @@ size_t SkCompressedDataSize(SkImage::CompressionType type, SkISize dimensions, int numMipLevels = 1; if (mipMapped) { - numMipLevels = SkMipMap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1; + numMipLevels = SkMipmap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1; } size_t totalSize = 0; diff --git a/src/core/SkMipMap.cpp b/src/core/SkMipmap.cpp similarity index 95% rename from src/core/SkMipMap.cpp rename to src/core/SkMipmap.cpp index e03e911cd5..fa1d789263 100644 --- a/src/core/SkMipMap.cpp +++ b/src/core/SkMipmap.cpp @@ -5,8 +5,6 @@ * found in the LICENSE file. */ -#include "src/core/SkMipMap.h" - #include "include/core/SkBitmap.h" #include "include/core/SkTypes.h" #include "include/private/SkColorData.h" @@ -16,6 +14,7 @@ #include "include/private/SkTo.h" #include "include/private/SkVx.h" #include "src/core/SkMathPriv.h" +#include "src/core/SkMipmap.h" #include // @@ -384,7 +383,7 @@ template void downsample_3_3(void* dst, const void* src, size_t src /////////////////////////////////////////////////////////////////////////////////////////////////// -size_t SkMipMap::AllocLevelsSize(int levelCount, size_t pixelSize) { +size_t SkMipmap::AllocLevelsSize(int levelCount, size_t pixelSize) { if (levelCount < 0) { return 0; } @@ -395,7 +394,7 @@ size_t SkMipMap::AllocLevelsSize(int levelCount, size_t pixelSize) { return SkTo(size); } -SkMipMap* SkMipMap::Build(const SkPixmap& src, SkDiscardableFactoryProc fact, +SkMipmap* SkMipmap::Build(const SkPixmap& src, SkDiscardableFactoryProc fact, bool computeContents) { typedef void FilterProc(void*, const void* srcPtr, size_t srcRB, int count); @@ -556,20 +555,20 @@ SkMipMap* SkMipMap::Build(const SkPixmap& src, SkDiscardableFactoryProc fact, size += SkColorTypeMinRowBytes(ct, mipSize.fWidth) * mipSize.fHeight; } - size_t storageSize = SkMipMap::AllocLevelsSize(countLevels, size); + size_t storageSize = SkMipmap::AllocLevelsSize(countLevels, size); if (0 == storageSize) { return nullptr; } - SkMipMap* mipmap; + SkMipmap* mipmap; if (fact) { SkDiscardableMemory* dm = fact(storageSize); if (nullptr == dm) { return nullptr; } - mipmap = new SkMipMap(storageSize, dm); + mipmap = new SkMipmap(storageSize, dm); } else { - mipmap = new SkMipMap(sk_malloc_throw(storageSize), storageSize); + mipmap = new SkMipmap(sk_malloc_throw(storageSize), storageSize); } // init @@ -587,7 +586,7 @@ SkMipMap* SkMipMap::Build(const SkPixmap& src, SkDiscardableFactoryProc fact, SkPixmap srcPM(src); // Depending on architecture and other factors, the pixel data alignment may need to be as - // large as 8 (for F16 pixels). See the comment on SkMipMap::Level. + // large as 8 (for F16 pixels). See the comment on SkMipmap::Level. SkASSERT(SkIsAlign8((uintptr_t)addr)); for (int i = 0; i < countLevels; ++i) { @@ -653,7 +652,7 @@ SkMipMap* SkMipMap::Build(const SkPixmap& src, SkDiscardableFactoryProc fact, return mipmap; } -int SkMipMap::ComputeLevelCount(int baseWidth, int baseHeight) { +int SkMipmap::ComputeLevelCount(int baseWidth, int baseHeight) { if (baseWidth < 1 || baseHeight < 1) { return 0; } @@ -665,7 +664,7 @@ int SkMipMap::ComputeLevelCount(int baseWidth, int baseHeight) { const int largestAxis = std::max(baseWidth, baseHeight); if (largestAxis < 2) { - // SkMipMap::Build requires a minimum size of 2. + // SkMipmap::Build requires a minimum size of 2. return 0; } const int leadingZeros = SkCLZ(static_cast(largestAxis)); @@ -676,9 +675,9 @@ int SkMipMap::ComputeLevelCount(int baseWidth, int baseHeight) { // and that sizeof(uint32_t)'s implementation-defined behavior is 4. int mipLevelCount = significantBits; - // SkMipMap does not include the base mip level. + // SkMipmap does not include the base mip level. // For example, it contains levels 1-x instead of 0-x. - // This is because the image used to create SkMipMap is the base level. + // This is because the image used to create SkMipmap is the base level. // So subtract 1 from the mip level count. if (mipLevelCount > 0) { --mipLevelCount; @@ -687,7 +686,7 @@ int SkMipMap::ComputeLevelCount(int baseWidth, int baseHeight) { return mipLevelCount; } -SkISize SkMipMap::ComputeLevelSize(int baseWidth, int baseHeight, int level) { +SkISize SkMipmap::ComputeLevelSize(int baseWidth, int baseHeight, int level) { if (baseWidth < 1 || baseHeight < 1) { return SkISize::Make(0, 0); } @@ -700,10 +699,10 @@ SkISize SkMipMap::ComputeLevelSize(int baseWidth, int baseHeight, int level) { // max(1, floor(original_height / 2^i) // (or original_width) where i is the mipmap level. - // SkMipMap does not include the base mip level. + // SkMipmap does not include the base mip level. // For example, it contains levels 1-x instead of 0-x. - // This is because the image used to create SkMipMap is the base level. - // So subtract 1 from the mip level to get the index stored by SkMipMap. + // This is because the image used to create SkMipmap is the base level. + // So subtract 1 from the mip level to get the index stored by SkMipmap. int width = std::max(1, baseWidth >> (level + 1)); int height = std::max(1, baseHeight >> (level + 1)); @@ -714,7 +713,7 @@ SkISize SkMipMap::ComputeLevelSize(int baseWidth, int baseHeight, int level) { // Returns fractional level value. floor(level) is the index of the larger level. // < 0 means failure. -float SkMipMap::ComputeLevel(SkSize scaleSize) { +float SkMipmap::ComputeLevel(SkSize scaleSize) { SkASSERT(scaleSize.width() >= 0 && scaleSize.height() >= 0); #ifndef SK_SUPPORT_LEGACY_ANISOTROPIC_MIPMAP_SCALE @@ -739,7 +738,7 @@ float SkMipMap::ComputeLevel(SkSize scaleSize) { return L; } -bool SkMipMap::extractLevel(SkSize scaleSize, Level* levelPtr) const { +bool SkMipmap::extractLevel(SkSize scaleSize, Level* levelPtr) const { if (nullptr == fLevels) { return false; } @@ -763,7 +762,7 @@ bool SkMipMap::extractLevel(SkSize scaleSize, Level* levelPtr) const { // Helper which extracts a pixmap from the src bitmap // -SkMipMap* SkMipMap::Build(const SkBitmap& src, SkDiscardableFactoryProc fact) { +SkMipmap* SkMipmap::Build(const SkBitmap& src, SkDiscardableFactoryProc fact) { SkPixmap srcPixmap; if (!src.peekPixels(&srcPixmap)) { return nullptr; @@ -771,11 +770,11 @@ SkMipMap* SkMipMap::Build(const SkBitmap& src, SkDiscardableFactoryProc fact) { return Build(srcPixmap, fact); } -int SkMipMap::countLevels() const { +int SkMipmap::countLevels() const { return fCount; } -bool SkMipMap::getLevel(int index, Level* levelPtr) const { +bool SkMipmap::getLevel(int index, Level* levelPtr) const { if (nullptr == fLevels) { return false; } diff --git a/src/core/SkMipMap.h b/src/core/SkMipmap.h similarity index 85% rename from src/core/SkMipMap.h rename to src/core/SkMipmap.h index 967cb8d3f6..8a7ed33924 100644 --- a/src/core/SkMipMap.h +++ b/src/core/SkMipmap.h @@ -5,8 +5,8 @@ * found in the LICENSE file. */ -#ifndef SkMipMap_DEFINED -#define SkMipMap_DEFINED +#ifndef SkMipmap_DEFINED +#define SkMipmap_DEFINED #include "include/core/SkPixmap.h" #include "include/core/SkScalar.h" @@ -21,24 +21,24 @@ class SkDiscardableMemory; typedef SkDiscardableMemory* (*SkDiscardableFactoryProc)(size_t bytes); /* - * SkMipMap will generate mipmap levels when given a base mipmap level image. + * SkMipmap will generate mipmap levels when given a base mipmap level image. * * Any function which deals with mipmap levels indices will start with index 0 * being the first mipmap level which was generated. Said another way, it does * not include the base level in its range. */ -class SkMipMap : public SkCachedData { +class SkMipmap : public SkCachedData { public: // Allocate and fill-in a mipmap. If computeContents is false, we just allocated // and compute the sizes/rowbytes, but leave the pixel-data uninitialized. - static SkMipMap* Build(const SkPixmap& src, SkDiscardableFactoryProc, + static SkMipmap* Build(const SkPixmap& src, SkDiscardableFactoryProc, bool computeContents = true); - static SkMipMap* Build(const SkBitmap& src, SkDiscardableFactoryProc); + static SkMipmap* Build(const SkBitmap& src, SkDiscardableFactoryProc); - // Determines how many levels a SkMipMap will have without creating that mipmap. + // Determines how many levels a SkMipmap will have without creating that mipmap. // This does not include the base mipmap level that the user provided when - // creating the SkMipMap. + // creating the SkMipmap. static int ComputeLevelCount(int baseWidth, int baseHeight); static int ComputeLevelCount(SkISize s) { return ComputeLevelCount(s.width(), s.height()); } @@ -79,8 +79,8 @@ private: Level* fLevels; // managed by the baseclass, may be null due to onDataChanged. int fCount; - SkMipMap(void* malloc, size_t size) : INHERITED(malloc, size) {} - SkMipMap(size_t size, SkDiscardableMemory* dm) : INHERITED(size, dm) {} + SkMipmap(void* malloc, size_t size) : INHERITED(malloc, size) {} + SkMipmap(size_t size, SkDiscardableMemory* dm) : INHERITED(size, dm) {} static size_t AllocLevelsSize(int levelCount, size_t pixelSize); diff --git a/src/core/SkResourceCache.cpp b/src/core/SkResourceCache.cpp index ff39bd6141..bf18ae2b99 100644 --- a/src/core/SkResourceCache.cpp +++ b/src/core/SkResourceCache.cpp @@ -13,7 +13,7 @@ #include "src/core/SkDiscardableMemory.h" #include "src/core/SkImageFilter_Base.h" #include "src/core/SkMessageBus.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/core/SkOpts.h" #include diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index 3a8b661be9..0b0146aa47 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -11,7 +11,7 @@ #include "include/core/SkTraceMemoryDump.h" #include "include/gpu/GrBackendSemaphore.h" #include "include/private/SkImageInfoPriv.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/core/SkTaskGroup.h" #include "src/gpu/GrClientMappedBufferManager.h" #include "src/gpu/GrContextPriv.h" @@ -621,7 +621,7 @@ GrBackendTexture GrContext::createBackendTexture(const SkPixmap srcData[], int n GrMipMapped mipMapped = GrMipMapped::kNo; int numExpectedLevels = 1; if (numProvidedLevels > 1) { - numExpectedLevels = SkMipMap::ComputeLevelCount(baseWidth, baseHeight) + 1; + numExpectedLevels = SkMipmap::ComputeLevelCount(baseWidth, baseHeight) + 1; mipMapped = GrMipMapped::kYes; } @@ -682,7 +682,7 @@ bool GrContext::updateBackendTexture(const GrBackendTexture& backendTexture, int numExpectedLevels = 1; if (backendTexture.hasMipMaps()) { - numExpectedLevels = SkMipMap::ComputeLevelCount(backendTexture.width(), + numExpectedLevels = SkMipmap::ComputeLevelCount(backendTexture.width(), backendTexture.height()) + 1; } if (numLevels != numExpectedLevels) { diff --git a/src/gpu/GrDataUtils.cpp b/src/gpu/GrDataUtils.cpp index 19ab50d43a..e7377f0632 100644 --- a/src/gpu/GrDataUtils.cpp +++ b/src/gpu/GrDataUtils.cpp @@ -11,7 +11,7 @@ #include "src/core/SkColorSpaceXformSteps.h" #include "src/core/SkCompressedDataUtils.h" #include "src/core/SkConvertPixels.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/core/SkTLazy.h" #include "src/core/SkTraceEvent.h" #include "src/core/SkUtils.h" @@ -301,7 +301,7 @@ void GrFillInCompressedData(SkImage::CompressionType type, SkISize dimensions, int numMipLevels = 1; if (mipMapped == GrMipMapped::kYes) { - numMipLevels = SkMipMap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1; + numMipLevels = SkMipmap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1; } size_t offset = 0; diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp index e2486cda85..6f65b1a25f 100644 --- a/src/gpu/GrGpu.cpp +++ b/src/gpu/GrGpu.cpp @@ -13,7 +13,7 @@ #include "include/gpu/GrDirectContext.h" #include "src/core/SkCompressedDataUtils.h" #include "src/core/SkMathPriv.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/gpu/GrAuditTrail.h" #include "src/gpu/GrBackendUtils.h" #include "src/gpu/GrCaps.h" @@ -813,7 +813,7 @@ bool GrGpu::MipMapsAreCorrect(SkISize dimensions, const BackendTextureData* data) { int numMipLevels = 1; if (mipMapped == GrMipMapped::kYes) { - numMipLevels = SkMipMap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1; + numMipLevels = SkMipmap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1; } if (!data || data->type() == BackendTextureData::Type::kColor) { diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp index 80456c5c89..29a9c285c0 100644 --- a/src/gpu/GrProxyProvider.cpp +++ b/src/gpu/GrProxyProvider.cpp @@ -17,7 +17,7 @@ #include "src/core/SkAutoPixmapStorage.h" #include "src/core/SkCompressedDataUtils.h" #include "src/core/SkImagePriv.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/core/SkTraceEvent.h" #include "src/gpu/GrCaps.h" #include "src/gpu/GrContextPriv.h" @@ -286,7 +286,7 @@ sk_sp GrProxyProvider::createProxyFromBitmap(const SkBitmap& bit sk_sp proxy; if (mipMapped == GrMipMapped::kNo || - 0 == SkMipMap::ComputeLevelCount(copyBitmap.width(), copyBitmap.height())) { + 0 == SkMipmap::ComputeLevelCount(copyBitmap.width(), copyBitmap.height())) { proxy = this->createNonMippedProxyFromBitmap(copyBitmap, fit, budgeted); } else { proxy = this->createMippedProxyFromBitmap(copyBitmap, budgeted); @@ -349,7 +349,7 @@ sk_sp GrProxyProvider::createMippedProxyFromBitmap(const SkBitma return nullptr; } - sk_sp mipmaps(SkMipMap::Build(bitmap.pixmap(), nullptr)); + sk_sp mipmaps(SkMipmap::Build(bitmap.pixmap(), nullptr)); if (!mipmaps) { return nullptr; } @@ -366,7 +366,7 @@ sk_sp GrProxyProvider::createMippedProxyFromBitmap(const SkBitma texels[0].fRowBytes = bitmap.rowBytes(); for (int i = 1; i < mipLevelCount; ++i) { - SkMipMap::Level generatedMipLevel; + SkMipmap::Level generatedMipLevel; mipmaps->getLevel(i - 1, &generatedMipLevel); texels[i].fPixels = generatedMipLevel.fPixmap.addr(); texels[i].fRowBytes = generatedMipLevel.fPixmap.rowBytes(); @@ -413,8 +413,8 @@ sk_sp GrProxyProvider::createProxy(const GrBackendFormat& format } if (GrMipMapped::kYes == mipMapped) { - // SkMipMap doesn't include the base level in the level count so we have to add 1 - int mipCount = SkMipMap::ComputeLevelCount(dimensions.fWidth, dimensions.fHeight) + 1; + // SkMipmap doesn't include the base level in the level count so we have to add 1 + int mipCount = SkMipmap::ComputeLevelCount(dimensions.fWidth, dimensions.fHeight) + 1; if (1 == mipCount) { mipMapped = GrMipMapped::kNo; } diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp index 3ecb3f90d5..6ce7a76237 100644 --- a/src/gpu/GrSurfaceProxy.cpp +++ b/src/gpu/GrSurfaceProxy.cpp @@ -11,7 +11,7 @@ #include "include/gpu/GrContext.h" #include "include/gpu/GrRecordingContext.h" #include "src/core/SkMathPriv.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/gpu/GrCaps.h" #include "src/gpu/GrClip.h" #include "src/gpu/GrContextPriv.h" diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp index 29266f88b0..512da5e20f 100644 --- a/src/gpu/GrTexture.cpp +++ b/src/gpu/GrTexture.cpp @@ -10,7 +10,7 @@ #include "include/gpu/GrContext.h" #include "include/gpu/GrTypes.h" #include "include/private/GrResourceKey.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/gpu/GrCaps.h" #include "src/gpu/GrContextPriv.h" #include "src/gpu/GrGpu.h" @@ -48,7 +48,7 @@ GrTexture::GrTexture(GrGpu* gpu, if (GrMipMapsStatus::kNotAllocated == fMipMapsStatus) { fMaxMipMapLevel = 0; } else { - fMaxMipMapLevel = SkMipMap::ComputeLevelCount(this->width(), this->height()); + fMaxMipMapLevel = SkMipmap::ComputeLevelCount(this->width(), this->height()); } } diff --git a/src/gpu/GrTextureProducer.cpp b/src/gpu/GrTextureProducer.cpp index 95564970a9..9fc714aca4 100644 --- a/src/gpu/GrTextureProducer.cpp +++ b/src/gpu/GrTextureProducer.cpp @@ -8,7 +8,7 @@ #include "src/gpu/GrTextureProducer.h" #include "include/gpu/GrRecordingContext.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/core/SkRectPriv.h" #include "src/gpu/GrClip.h" #include "src/gpu/GrContextPriv.h" diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index 1dd59020c3..9a97bd88df 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -25,7 +25,7 @@ #include "src/core/SkImagePriv.h" #include "src/core/SkMaskFilterBase.h" #include "src/core/SkMessageBus.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/core/SkPaintPriv.h" #include "src/core/SkResourceCache.h" #include "src/core/SkTraceEvent.h" diff --git a/src/gpu/d3d/GrD3DGpu.cpp b/src/gpu/d3d/GrD3DGpu.cpp index 12164cf1ed..6e2820271c 100644 --- a/src/gpu/d3d/GrD3DGpu.cpp +++ b/src/gpu/d3d/GrD3DGpu.cpp @@ -10,7 +10,7 @@ #include "include/gpu/GrBackendSurface.h" #include "include/gpu/d3d/GrD3DBackendContext.h" #include "src/core/SkConvertPixels.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/gpu/GrBackendUtils.h" #include "src/gpu/GrDataUtils.h" #include "src/gpu/GrTexturePriv.h" @@ -321,7 +321,7 @@ sk_sp GrD3DGpu::onCreateCompressedTexture(SkISize dimensions, int mipLevelCount = 1; if (mipMapped == GrMipMapped::kYes) { - mipLevelCount = SkMipMap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1; + mipLevelCount = SkMipmap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1; } GrMipMapsStatus mipMapsStatus = mipLevelCount > 1 ? GrMipMapsStatus::kValid : GrMipMapsStatus::kNotAllocated; @@ -924,7 +924,7 @@ bool GrD3DGpu::createTextureResourceForBackendSurface(DXGI_FORMAT dxgiFormat, int numMipLevels = 1; if (mipMapped == GrMipMapped::kYes) { - numMipLevels = SkMipMap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1; + numMipLevels = SkMipmap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1; } // create the texture @@ -1068,7 +1068,7 @@ bool GrD3DGpu::onUpdateBackendTexture(const GrBackendTexture& backendTexture, D3D12_RESOURCE_DESC desc = d3dResource->GetDesc(); unsigned int mipLevelCount = 1; if (backendTexture.fMipMapped == GrMipMapped::kYes) { - mipLevelCount = SkMipMap::ComputeLevelCount(backendTexture.dimensions().width(), + mipLevelCount = SkMipmap::ComputeLevelCount(backendTexture.dimensions().width(), backendTexture.dimensions().height()) + 1; } SkASSERT(mipLevelCount == info.fLevelCount); diff --git a/src/gpu/dawn/GrDawnGpu.cpp b/src/gpu/dawn/GrDawnGpu.cpp index 40b4144881..42915d9ada 100644 --- a/src/gpu/dawn/GrDawnGpu.cpp +++ b/src/gpu/dawn/GrDawnGpu.cpp @@ -30,7 +30,7 @@ #include "src/gpu/dawn/GrDawnUtil.h" #include "src/core/SkAutoMalloc.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/sksl/SkSLCompiler.h" #if !defined(SK_BUILD_FOR_WIN) @@ -327,7 +327,7 @@ GrBackendTexture GrDawnGpu::onCreateBackendTexture(SkISize dimensions, int numMipLevels = 1; if (mipMapped == GrMipMapped::kYes) { - numMipLevels = SkMipMap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1; + numMipLevels = SkMipmap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1; } desc.size.width = dimensions.width(); diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 9cf8ac92be..8d0ec2b17c 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -18,7 +18,7 @@ #include "src/core/SkAutoMalloc.h" #include "src/core/SkCompressedDataUtils.h" #include "src/core/SkConvertPixels.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/core/SkTraceEvent.h" #include "src/gpu/GrBackendUtils.h" #include "src/gpu/GrContextPriv.h" @@ -980,7 +980,7 @@ bool GrGLGpu::uploadColorToTex(GrGLFormat textureFormat, std::unique_ptr pixelStorage; size_t bpp = 0; - int numLevels = SkMipMap::ComputeLevelCount(texDims) + 1; + int numLevels = SkMipmap::ComputeLevelCount(texDims) + 1; SkSTArray<16, GrMipLevel> levels; levels.resize(numLevels); SkISize levelDims = texDims; @@ -1016,7 +1016,7 @@ void GrGLGpu::uploadTexData(SkISize texDims, SkASSERT(!texDims.isEmpty()); SkASSERT(!dstRect.isEmpty()); SkASSERT(SkIRect::MakeSize(texDims).contains(dstRect)); - SkASSERT(mipLevelCount > 0 && mipLevelCount <= SkMipMap::ComputeLevelCount(texDims) + 1); + SkASSERT(mipLevelCount > 0 && mipLevelCount <= SkMipmap::ComputeLevelCount(texDims) + 1); SkASSERT(mipLevelCount == 1 || dstRect == SkIRect::MakeSize(texDims)); const GrGLCaps& caps = this->glCaps(); @@ -1073,7 +1073,7 @@ bool GrGLGpu::uploadCompressedTexData(SkImage::CompressionType compressionType, int numMipLevels = 1; if (mipMapped == GrMipMapped::kYes) { - numMipLevels = SkMipMap::ComputeLevelCount(dimensions.width(), dimensions.height())+1; + numMipLevels = SkMipmap::ComputeLevelCount(dimensions.width(), dimensions.height())+1; } // TODO: Make sure that the width and height that we pass to OpenGL @@ -3422,7 +3422,7 @@ bool GrGLGpu::onRegenerateMipMapLevels(GrTexture* texture) { int width = texture->width(); int height = texture->height(); - int levelCount = SkMipMap::ComputeLevelCount(width, height) + 1; + int levelCount = SkMipmap::ComputeLevelCount(width, height) + 1; SkASSERT(levelCount == texture->texturePriv().maxMipMapLevel() + 1); // Create (if necessary), then bind temporary FBO: @@ -3580,7 +3580,7 @@ GrBackendTexture GrGLGpu::onCreateBackendTexture(SkISize dimensions, int numMipLevels = 1; if (mipMapped == GrMipMapped::kYes) { - numMipLevels = SkMipMap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1; + numMipLevels = SkMipmap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1; } // Compressed formats go through onCreateCompressedBackendTexture @@ -3634,7 +3634,7 @@ bool GrGLGpu::onUpdateBackendTexture(const GrBackendTexture& backendTexture, int numMipLevels = 1; if (backendTexture.hasMipMaps()) { numMipLevels = - SkMipMap::ComputeLevelCount(backendTexture.width(), backendTexture.height()) + 1; + SkMipmap::ComputeLevelCount(backendTexture.width(), backendTexture.height()) + 1; } GrGLFormat glFormat = GrGLFormatFromGLEnum(info.fFormat); diff --git a/src/gpu/mtl/GrMtlGpu.mm b/src/gpu/mtl/GrMtlGpu.mm index 576bcc1b88..99281361ce 100644 --- a/src/gpu/mtl/GrMtlGpu.mm +++ b/src/gpu/mtl/GrMtlGpu.mm @@ -10,7 +10,7 @@ #include "include/private/GrTypesPriv.h" #include "src/core/SkCompressedDataUtils.h" #include "src/core/SkConvertPixels.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/gpu/GrBackendUtils.h" #include "src/gpu/GrDataUtils.h" #include "src/gpu/GrRenderTargetPriv.h" @@ -511,7 +511,7 @@ sk_sp GrMtlGpu::onCreateCompressedTexture(SkISize dimensions, int numMipLevels = 1; if (mipMapped == GrMipMapped::kYes) { - numMipLevels = SkMipMap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1; + numMipLevels = SkMipmap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1; } // This TexDesc refers to the texture that will be read by the client. Thus even if msaa is diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp index c337f3685e..be754586a9 100644 --- a/src/gpu/vk/GrVkGpu.cpp +++ b/src/gpu/vk/GrVkGpu.cpp @@ -14,7 +14,7 @@ #include "include/private/SkTo.h" #include "src/core/SkCompressedDataUtils.h" #include "src/core/SkConvertPixels.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/gpu/GrBackendUtils.h" #include "src/gpu/GrContextPriv.h" #include "src/gpu/GrDataUtils.h" @@ -719,7 +719,7 @@ static size_t fill_in_regions(GrVkCaps* vkCaps, SkTArray* reg VkDeviceSize bufferOffset) { int numMipLevels = 1; if (mipMapped == GrMipMapped::kYes) { - numMipLevels = SkMipMap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1; + numMipLevels = SkMipmap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1; } regions->reserve(numMipLevels); @@ -1124,7 +1124,7 @@ sk_sp GrVkGpu::onCreateCompressedTexture(SkISize dimensions, int numMipLevels = 1; if (mipMapped == GrMipMapped::kYes) { - numMipLevels = SkMipMap::ComputeLevelCount(dimensions.width(), dimensions.height())+1; + numMipLevels = SkMipmap::ComputeLevelCount(dimensions.width(), dimensions.height())+1; } // Compressed textures with MIP levels or multiple samples are not supported as of now. @@ -1433,8 +1433,8 @@ bool GrVkGpu::onRegenerateMipMapLevels(GrTexture* tex) { VkImageBlit blitRegion; memset(&blitRegion, 0, sizeof(VkImageBlit)); - // SkMipMap doesn't include the base level in the level count so we have to add 1 - uint32_t levelCount = SkMipMap::ComputeLevelCount(tex->width(), tex->height()) + 1; + // SkMipmap doesn't include the base level in the level count so we have to add 1 + uint32_t levelCount = SkMipmap::ComputeLevelCount(tex->width(), tex->height()) + 1; SkASSERT(levelCount == vkTex->mipLevels()); // change layout of the layers so we can write to them. @@ -1579,7 +1579,7 @@ bool GrVkGpu::createVkImageForBackendSurface(VkFormat vkFormat, int numMipLevels = 1; if (mipMapped == GrMipMapped::kYes) { - numMipLevels = SkMipMap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1; + numMipLevels = SkMipmap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1; } VkImageUsageFlags usageFlags = 0; diff --git a/src/gpu/vk/GrVkPipelineState.cpp b/src/gpu/vk/GrVkPipelineState.cpp index eaea83f2a5..8e48e4ab3a 100644 --- a/src/gpu/vk/GrVkPipelineState.cpp +++ b/src/gpu/vk/GrVkPipelineState.cpp @@ -6,7 +6,7 @@ */ #include "include/gpu/GrContext.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/gpu/GrContextPriv.h" #include "src/gpu/GrPipeline.h" #include "src/gpu/GrRenderTarget.h" diff --git a/src/gpu/vk/GrVkTextureRenderTarget.cpp b/src/gpu/vk/GrVkTextureRenderTarget.cpp index 39d87d33bc..23b5613d55 100644 --- a/src/gpu/vk/GrVkTextureRenderTarget.cpp +++ b/src/gpu/vk/GrVkTextureRenderTarget.cpp @@ -12,7 +12,7 @@ #include "src/gpu/vk/GrVkImageView.h" #include "src/gpu/vk/GrVkUtil.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "include/gpu/vk/GrVkTypes.h" diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp index 0abbc494b4..8e4bbcfb6e 100644 --- a/src/image/SkImage.cpp +++ b/src/image/SkImage.cpp @@ -20,7 +20,7 @@ #include "src/core/SkImageFilterCache.h" #include "src/core/SkImageFilter_Base.h" #include "src/core/SkImagePriv.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/core/SkNextID.h" #include "src/core/SkSpecialImage.h" #include "src/image/SkImage_Base.h" @@ -654,7 +654,7 @@ SkIRect SkImage_getSubset(const SkImage* image) { /////////////////////////////////////////////////////////////////////////////////////////////////// SkMipmapBuilder::SkMipmapBuilder(const SkImageInfo& info) { - fMM = sk_sp(SkMipMap::Build({info, nullptr, 0}, nullptr, false)); + fMM = sk_sp(SkMipmap::Build({info, nullptr, 0}, nullptr, false)); } SkMipmapBuilder::~SkMipmapBuilder() {} @@ -666,14 +666,14 @@ int SkMipmapBuilder::countLevels() const { SkPixmap SkMipmapBuilder::level(int index) const { SkPixmap pm; - SkMipMap::Level level; + SkMipmap::Level level; if (fMM && fMM->getLevel(index, &level)) { pm = level.fPixmap; } return pm; } -sk_sp SkMipmapBuilder::detach() { +sk_sp SkMipmapBuilder::detach() { return std::move(fMM); } @@ -681,7 +681,7 @@ bool SkImage::hasMipmaps() const { return as_IB(this)->onPeekMips() != nullptr; } -sk_sp SkImage::withMipmaps(sk_sp data) const { +sk_sp SkImage::withMipmaps(sk_sp data) const { auto result = as_IB(this)->onMakeWithMipmaps(std::move(data)); if (!result) { result = sk_ref_sp((const_cast(this))); diff --git a/src/image/SkImage_Base.h b/src/image/SkImage_Base.h index 5388bad7d8..4046d0e0a9 100644 --- a/src/image/SkImage_Base.h +++ b/src/image/SkImage_Base.h @@ -10,7 +10,7 @@ #include "include/core/SkImage.h" #include "include/core/SkSurface.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include #if SK_SUPPORT_GPU @@ -47,9 +47,9 @@ public: virtual bool onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, int srcY, CachingHint) const = 0; - virtual SkMipMap* onPeekMips() const { return nullptr; } + virtual SkMipmap* onPeekMips() const { return nullptr; } - sk_sp refMips() const { + sk_sp refMips() const { return sk_ref_sp(this->onPeekMips()); } @@ -136,7 +136,7 @@ public: virtual sk_sp onReinterpretColorSpace(sk_sp) const = 0; // on failure, returns nullptr - virtual sk_sp onMakeWithMipmaps(sk_sp) const { + virtual sk_sp onMakeWithMipmaps(sk_sp) const { return nullptr; } diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index b212dd9920..1f7143574b 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -16,7 +16,7 @@ #include "include/private/SkImageInfoPriv.h" #include "src/core/SkAutoPixmapStorage.h" #include "src/core/SkBitmapCache.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/core/SkScopeExit.h" #include "src/core/SkTraceEvent.h" #include "src/gpu/GrAHardwareBufferImageGenerator.h" diff --git a/src/image/SkImage_GpuYUVA.cpp b/src/image/SkImage_GpuYUVA.cpp index 08e4cf86da..0374f33fbf 100644 --- a/src/image/SkImage_GpuYUVA.cpp +++ b/src/image/SkImage_GpuYUVA.cpp @@ -13,7 +13,7 @@ #include "include/gpu/GrContext.h" #include "include/gpu/GrRecordingContext.h" #include "src/core/SkAutoPixmapStorage.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/core/SkScopeExit.h" #include "src/gpu/GrBitmapTextureMaker.h" #include "src/gpu/GrClip.h" diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp index 2a1c5fe1da..4783470078 100644 --- a/src/image/SkImage_Raster.cpp +++ b/src/image/SkImage_Raster.cpp @@ -123,14 +123,14 @@ public: void onUnpinAsTexture(GrContext*) const override; #endif - SkMipMap* onPeekMips() const override { return fBitmap.fMips.get(); } + SkMipmap* onPeekMips() const override { return fBitmap.fMips.get(); } - sk_sp onMakeWithMipmaps(sk_sp mips) const override { + sk_sp onMakeWithMipmaps(sk_sp mips) const override { auto img = new SkImage_Raster(fBitmap); if (mips) { img->fBitmap.fMips = std::move(mips); } else { - img->fBitmap.fMips.reset(SkMipMap::Build(fBitmap.pixmap(), nullptr)); + img->fBitmap.fMips.reset(SkMipmap::Build(fBitmap.pixmap(), nullptr)); } return sk_sp(img); } diff --git a/tests/CompressedBackendAllocationTest.cpp b/tests/CompressedBackendAllocationTest.cpp index 1fa6ea8a12..153b38aada 100644 --- a/tests/CompressedBackendAllocationTest.cpp +++ b/tests/CompressedBackendAllocationTest.cpp @@ -9,7 +9,7 @@ #include "include/gpu/GrDirectContext.h" #include "src/core/SkAutoPixmapStorage.h" #include "src/core/SkCompressedDataUtils.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/gpu/GrBackendUtils.h" #include "src/gpu/GrContextPriv.h" #include "src/image/SkImage_Base.h" @@ -77,7 +77,7 @@ static void check_compressed_mipmaps(GrContext* context, sk_sp img, int numMipLevels = 1; if (mipMapped == GrMipMapped::kYes) { - numMipLevels = SkMipMap::ComputeLevelCount(32, 32)+1; + numMipLevels = SkMipmap::ComputeLevelCount(32, 32)+1; } for (int i = 0, rectSize = 32; i < numMipLevels; ++i, rectSize /= 2) { @@ -171,7 +171,7 @@ static std::unique_ptr make_compressed_data(SkImage::CompressionTy int numMipLevels = 1; if (mipMapped == GrMipMapped::kYes) { - numMipLevels = SkMipMap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1; + numMipLevels = SkMipmap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1; } SkTArray mipMapOffsets(numMipLevels); diff --git a/tests/MipMapTest.cpp b/tests/MipMapTest.cpp index 930e71652a..3575125527 100644 --- a/tests/MipMapTest.cpp +++ b/tests/MipMapTest.cpp @@ -7,7 +7,7 @@ #include "include/core/SkBitmap.h" #include "include/utils/SkRandom.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "tests/Test.h" #include "tools/Resources.h" @@ -24,22 +24,22 @@ DEF_TEST(MipMap, reporter) { int width = 1 + rand.nextU() % 1000; int height = 1 + rand.nextU() % 1000; make_bitmap(&bm, width, height); - sk_sp mm(SkMipMap::Build(bm, nullptr)); + sk_sp mm(SkMipmap::Build(bm, nullptr)); - REPORTER_ASSERT(reporter, mm->countLevels() == SkMipMap::ComputeLevelCount(width, height)); + REPORTER_ASSERT(reporter, mm->countLevels() == SkMipmap::ComputeLevelCount(width, height)); REPORTER_ASSERT(reporter, !mm->extractLevel(SkSize::Make(SK_Scalar1, SK_Scalar1), nullptr)); REPORTER_ASSERT(reporter, !mm->extractLevel(SkSize::Make(SK_Scalar1 * 2, SK_Scalar1 * 2), nullptr)); - SkMipMap::Level prevLevel; + SkMipmap::Level prevLevel; sk_bzero(&prevLevel, sizeof(prevLevel)); SkScalar scale = SK_Scalar1; for (int j = 0; j < 30; ++j) { scale = scale * 2 / 3; - SkMipMap::Level level; + SkMipmap::Level level; if (mm->extractLevel(SkSize::Make(scale, scale), &level)) { REPORTER_ASSERT(reporter, level.fPixmap.addr()); REPORTER_ASSERT(reporter, level.fPixmap.width() > 0); @@ -61,21 +61,21 @@ static void test_mipmap_generation(int width, int height, int expectedMipLevelCo SkBitmap bm; bm.allocN32Pixels(width, height); bm.eraseColor(SK_ColorWHITE); - sk_sp mm(SkMipMap::Build(bm, nullptr)); + sk_sp mm(SkMipmap::Build(bm, nullptr)); const int mipLevelCount = mm->countLevels(); REPORTER_ASSERT(reporter, mipLevelCount == expectedMipLevelCount); - REPORTER_ASSERT(reporter, mipLevelCount == SkMipMap::ComputeLevelCount(width, height)); + REPORTER_ASSERT(reporter, mipLevelCount == SkMipmap::ComputeLevelCount(width, height)); for (int i = 0; i < mipLevelCount; ++i) { - SkMipMap::Level level; + SkMipmap::Level level; REPORTER_ASSERT(reporter, mm->getLevel(i, &level)); // Make sure the mipmaps contain valid data and that the sizes are correct REPORTER_ASSERT(reporter, level.fPixmap.addr()); - SkISize size = SkMipMap::ComputeLevelSize(width, height, i); + SkISize size = SkMipmap::ComputeLevelSize(width, height, i); REPORTER_ASSERT(reporter, level.fPixmap.width() == size.width()); REPORTER_ASSERT(reporter, level.fPixmap.height() == size.height()); - // + 1 because SkMipMap does not include the base mipmap level. + // + 1 because SkMipmap does not include the base mipmap level. int twoToTheMipLevel = 1 << (i + 1); int currentWidth = width / twoToTheMipLevel; int currentHeight = height / twoToTheMipLevel; @@ -87,11 +87,11 @@ static void test_mipmap_generation(int width, int height, int expectedMipLevelCo DEF_TEST(MipMap_DirectLevelAccess, reporter) { // create mipmap with invalid size { - // SkMipMap current requires the dimensions be greater than 2x2 + // SkMipmap current requires the dimensions be greater than 2x2 SkBitmap bm; bm.allocN32Pixels(1, 1); bm.eraseColor(SK_ColorWHITE); - sk_sp mm(SkMipMap::Build(bm, nullptr)); + sk_sp mm(SkMipmap::Build(bm, nullptr)); REPORTER_ASSERT(reporter, mm == nullptr); } @@ -121,7 +121,7 @@ DEF_TEST(MipMap_ComputeLevelCount, reporter) { {-100, -100, 0}, // Test mipmaps with 0, 1, 2 as dimensions - // (SkMipMap::Build requires a min size of 1) + // (SkMipmap::Build requires a min size of 1) // // 0 {0, 100, 0}, @@ -151,7 +151,7 @@ DEF_TEST(MipMap_ComputeLevelCount, reporter) { }; for (auto& currentTest : tests) { - int levelCount = SkMipMap::ComputeLevelCount(currentTest.fWidth, currentTest.fHeight); + int levelCount = SkMipmap::ComputeLevelCount(currentTest.fWidth, currentTest.fHeight); REPORTER_ASSERT(reporter, currentTest.fExpectedLevelCount == levelCount); } } @@ -171,7 +171,7 @@ DEF_TEST(MipMap_ComputeLevelSize, reporter) { {-100, -100, 0, SkISize::Make(0, 0)}, // Test mipmaps with 0, 1, 2 as dimensions - // (SkMipMap::Build requires a min size of 1) + // (SkMipmap::Build requires a min size of 1) // // 0 {0, 100, 0, SkISize::Make(0, 0)}, @@ -197,7 +197,7 @@ DEF_TEST(MipMap_ComputeLevelSize, reporter) { }; for (auto& currentTest : tests) { - SkISize levelSize = SkMipMap::ComputeLevelSize(currentTest.fBaseWidth, + SkISize levelSize = SkMipmap::ComputeLevelSize(currentTest.fBaseWidth, currentTest.fBaseHeight, currentTest.fLevel); REPORTER_ASSERT(reporter, currentTest.fExpectedMipMapLevelSize == levelSize); @@ -208,7 +208,7 @@ DEF_TEST(MipMap_F16, reporter) { SkBitmap bmp; bmp.allocPixels(SkImageInfo::Make(10, 10, kRGBA_F16_SkColorType, kPremul_SkAlphaType)); bmp.eraseColor(0); - sk_sp mipmap(SkMipMap::Build(bmp, nullptr)); + sk_sp mipmap(SkMipmap::Build(bmp, nullptr)); } #include "include/core/SkCanvas.h" diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp index c53d205e8c..c07c488dc2 100644 --- a/tests/ResourceCacheTest.cpp +++ b/tests/ResourceCacheTest.cpp @@ -22,7 +22,7 @@ #include "include/core/SkCanvas.h" #include "include/core/SkSurface.h" #include "src/core/SkMessageBus.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/gpu/SkGr.h" #include "tests/Test.h" #include "tests/TestUtils.h" diff --git a/tests/SkResourceCacheTest.cpp b/tests/SkResourceCacheTest.cpp index df88a83fc1..1e9ac88c10 100644 --- a/tests/SkResourceCacheTest.cpp +++ b/tests/SkResourceCacheTest.cpp @@ -11,7 +11,7 @@ #include "include/core/SkPictureRecorder.h" #include "include/core/SkSurface.h" #include "src/core/SkBitmapCache.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/core/SkResourceCache.h" #include "src/image/SkImage_Base.h" #include "src/lazy/SkDiscardableMemoryPool.h" @@ -46,14 +46,14 @@ static void test_mipmapcache(skiatest::Reporter* reporter, SkResourceCache* cach sk_sp img = SkImage::MakeFromBitmap(src); const auto desc = SkBitmapCacheDesc::Make(img.get()); - const SkMipMap* mipmap = SkMipMapCache::FindAndRef(desc, cache); + const SkMipmap* mipmap = SkMipmapCache::FindAndRef(desc, cache); REPORTER_ASSERT(reporter, nullptr == mipmap); - mipmap = SkMipMapCache::AddAndRef(as_IB(img.get()), cache); + mipmap = SkMipmapCache::AddAndRef(as_IB(img.get()), cache); REPORTER_ASSERT(reporter, mipmap); { - const SkMipMap* mm = SkMipMapCache::FindAndRef(desc, cache); + const SkMipmap* mm = SkMipmapCache::FindAndRef(desc, cache); REPORTER_ASSERT(reporter, mm); REPORTER_ASSERT(reporter, mm == mipmap); mm->unref(); @@ -67,7 +67,7 @@ static void test_mipmapcache(skiatest::Reporter* reporter, SkResourceCache* cach check_data(reporter, mipmap, 1, kInCache, kNotLocked); // find us again - mipmap = SkMipMapCache::FindAndRef(desc, cache); + mipmap = SkMipmapCache::FindAndRef(desc, cache); check_data(reporter, mipmap, 2, kInCache, kLocked); cache->purgeAll(); @@ -86,23 +86,23 @@ static void test_mipmap_notify(skiatest::Reporter* reporter, SkResourceCache* ca src[i].allocN32Pixels(5, 5); src[i].setImmutable(); img[i] = SkImage::MakeFromBitmap(src[i]); - SkMipMapCache::AddAndRef(as_IB(img[i].get()), cache)->unref(); + SkMipmapCache::AddAndRef(as_IB(img[i].get()), cache)->unref(); desc[i] = SkBitmapCacheDesc::Make(img[i].get()); } for (int i = 0; i < N; ++i) { - const SkMipMap* mipmap = SkMipMapCache::FindAndRef(desc[i], cache); + const SkMipmap* mipmap = SkMipmapCache::FindAndRef(desc[i], cache); // We're always using a local cache, so we know we won't be purged by other threads REPORTER_ASSERT(reporter, mipmap); SkSafeUnref(mipmap); img[i].reset(); // delete the image, which *should not* remove us from the cache - mipmap = SkMipMapCache::FindAndRef(desc[i], cache); + mipmap = SkMipmapCache::FindAndRef(desc[i], cache); REPORTER_ASSERT(reporter, mipmap); SkSafeUnref(mipmap); src[i].reset(); // delete the underlying pixelref, which *should* remove us from the cache - mipmap = SkMipMapCache::FindAndRef(desc[i], cache); + mipmap = SkMipmapCache::FindAndRef(desc[i], cache); REPORTER_ASSERT(reporter, !mipmap); } } diff --git a/tools/DDLPromiseImageHelper.cpp b/tools/DDLPromiseImageHelper.cpp index 8c9ddb1642..931f03f3b7 100644 --- a/tools/DDLPromiseImageHelper.cpp +++ b/tools/DDLPromiseImageHelper.cpp @@ -14,7 +14,7 @@ #include "include/core/SkYUVASizeInfo.h" #include "include/gpu/GrDirectContext.h" #include "src/core/SkCachedData.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/core/SkTaskGroup.h" #include "src/gpu/GrContextPriv.h" #include "src/image/SkImage_Base.h" @@ -51,7 +51,7 @@ const std::unique_ptr DDLPromiseImageHelper::PromiseImageInfo::norma pixmaps[0] = fBaseLevel.pixmap(); if (fMipLevels) { for (int i = 0; i < fMipLevels->countLevels(); ++i) { - SkMipMap::Level mipLevel; + SkMipmap::Level mipLevel; fMipLevels->getLevel(i, &mipLevel); pixmaps[i+1] = mipLevel.fPixmap; } @@ -65,7 +65,7 @@ int DDLPromiseImageHelper::PromiseImageInfo::numMipLevels() const { } void DDLPromiseImageHelper::PromiseImageInfo::setMipLevels(const SkBitmap& baseLevel, - std::unique_ptr mipLevels) { + std::unique_ptr mipLevels) { fBaseLevel = baseLevel; fMipLevels = std::move(mipLevels); } @@ -484,7 +484,7 @@ int DDLPromiseImageHelper::addImage(SkImage* image) { // SKP) we don't know if a given SkImage will require mipmapping. To work around this // we just try to create all the backend textures as mipmapped but, failing that, fall // back to un-mipped. - std::unique_ptr mipmaps(SkMipMap::Build(tmp.pixmap(), nullptr)); + std::unique_ptr mipmaps(SkMipmap::Build(tmp.pixmap(), nullptr)); newImageInfo.setMipLevels(tmp, std::move(mipmaps)); } diff --git a/tools/DDLPromiseImageHelper.h b/tools/DDLPromiseImageHelper.h index af0ac7cf90..1b0c699444 100644 --- a/tools/DDLPromiseImageHelper.h +++ b/tools/DDLPromiseImageHelper.h @@ -20,7 +20,7 @@ class GrContext; class SkImage; -class SkMipMap; +class SkMipmap; class SkPicture; class SkTaskGroup; struct SkYUVAIndex; @@ -213,7 +213,7 @@ private: return fCallbackContexts[index]->promiseImageTexture(); } - void setMipLevels(const SkBitmap& baseLevel, std::unique_ptr mipLevels); + void setMipLevels(const SkBitmap& baseLevel, std::unique_ptr mipLevels); void setYUVData(sk_sp yuvData, SkYUVAIndex yuvaIndices[SkYUVAIndex::kIndexCount], @@ -236,7 +236,7 @@ private: // CPU-side cache of a normal SkImage's mipmap levels SkBitmap fBaseLevel; - std::unique_ptr fMipLevels; + std::unique_ptr fMipLevels; // CPU-side cache of a YUV SkImage's contents sk_sp fYUVData; // when !null, this is a YUV image diff --git a/tools/fiddle/fiddle_main.cpp b/tools/fiddle/fiddle_main.cpp index 933a47abed..1cf95dd69c 100644 --- a/tools/fiddle/fiddle_main.cpp +++ b/tools/fiddle/fiddle_main.cpp @@ -11,7 +11,7 @@ #include #include "src/core/SkAutoPixmapStorage.h" -#include "src/core/SkMipMap.h" +#include "src/core/SkMipmap.h" #include "src/core/SkUtils.h" #include "tools/flags/CommandLineFlags.h" @@ -156,7 +156,7 @@ static bool setup_backend_objects(GrContext* context, pixmap = &rgbaPixmap; } int mipLevelCount = GrMipMapped::kYes == options.fMipMapping - ? SkMipMap::ComputeLevelCount(bm.width(), bm.height()) + ? SkMipmap::ComputeLevelCount(bm.width(), bm.height()) : 1; std::unique_ptr texels(new GrMipLevel[mipLevelCount]); @@ -213,7 +213,7 @@ static bool setup_backend_objects(GrContext* context, { int mipLevelCount = GrMipMapped::kYes == options.fOffScreenMipMapping - ? SkMipMap::ComputeLevelCount(offscreenDims.width(), offscreenDims.height()) + ? SkMipmap::ComputeLevelCount(offscreenDims.width(), offscreenDims.height()) : 1; std::unique_ptr texels(new GrMipLevel[mipLevelCount]);