From 67b09bf6b7422c7a3209781cbb7827224e3ffc17 Mon Sep 17 00:00:00 2001 From: reed Date: Sat, 16 Jan 2016 18:50:35 -0800 Subject: use pixmaps in mipmap api BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1598803002 Review URL: https://codereview.chromium.org/1598803002 --- gm/showmiplevels.cpp | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'gm') diff --git a/gm/showmiplevels.cpp b/gm/showmiplevels.cpp index 23359f046e..7fc40ce029 100644 --- a/gm/showmiplevels.cpp +++ b/gm/showmiplevels.cpp @@ -151,23 +151,19 @@ protected: SkMipMap::Level level; SkScalar scale = 0.5f; while (mm->extractLevel(scale, &level)) { - SkImageInfo info = SkImageInfo::Make(level.fWidth, level.fHeight, - baseBM.colorType(), baseBM.alphaType()); - SkPixmap levelPM{ info, level.fPixels, level.fRowBytes }; - - SkBitmap bm = func(prevPM, levelPM); + SkBitmap bm = func(prevPM, level.fPixmap); DrawAndFrame(canvas, bm, x, y); - if (info.width() <= 2 || info.height() <= 2) { + if (level.fPixmap.width() <= 2 || level.fPixmap.height() <= 2) { break; } if (index & 1) { - x += info.width() + 4; + x += level.fPixmap.width() + 4; } else { - y += info.height() + 4; + y += level.fPixmap.height() + 4; } scale /= 2; - prevPM = levelPM; + prevPM = level.fPixmap; index += 1; } } @@ -263,20 +259,17 @@ protected: SkMipMap::Level level; SkScalar scale = 0.5f; while (mm->extractLevel(scale, &level)) { - SkImageInfo info = SkImageInfo::Make(level.fWidth, level.fHeight, - baseBM.colorType(), baseBM.alphaType()); - SkBitmap bm; - bm.installPixels(info, level.fPixels, level.fRowBytes); + bm.installPixels(level.fPixmap); DrawAndFrame(canvas, bm, x, y); - if (info.width() <= 2 || info.height() <= 2) { + if (level.fPixmap.width() <= 2 || level.fPixmap.height() <= 2) { break; } if (index & 1) { - x += info.width() + 4; + x += level.fPixmap.width() + 4; } else { - y += info.height() + 4; + y += level.fPixmap.height() + 4; } scale /= 2; index += 1; -- cgit v1.2.3