Add getting the size of a given mipmap level.
When allocating memory for mipmaps, it would be very handy to know the
dimensions of a given mipmap level.
R=bsalomon@google.com
BUG=578304
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2018283002
Review-Url: https://codereview.chromium.org/2018283002
diff --git a/src/core/SkMipMap.h b/src/core/SkMipMap.h
index 928c12d..5cb4ea8 100644
--- a/src/core/SkMipMap.h
+++ b/src/core/SkMipMap.h
@@ -23,10 +23,12 @@
static SkMipMap* Build(const SkPixmap& src, SkDiscardableFactoryProc);
static SkMipMap* Build(const SkBitmap& src, SkDiscardableFactoryProc);
- // This function lets you determine how many levels a SkMipMap will have without
- // creating that mipmap.
+ // Determines how many levels a SkMipMap will have without creating that mipmap.
static int ComputeLevelCount(int baseWidth, int baseHeight);
+ // Determines the size of a given mipmap level.
+ static SkSize ComputeLevelSize(int baseWidth, int baseHeight, int level);
+
struct Level {
SkPixmap fPixmap;
SkSize fScale; // < 1.0