diff options
author | reed <reed@google.com> | 2016-01-16 18:50:35 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-16 18:50:35 -0800 |
commit | 67b09bf6b7422c7a3209781cbb7827224e3ffc17 (patch) | |
tree | abbf8933a1cc4d7ffd52b02d98560133d030c552 /gm/showmiplevels.cpp | |
parent | 879caf86fd9b906d326f9cffe6933817019078b2 (diff) |
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
Diffstat (limited to 'gm/showmiplevels.cpp')
-rw-r--r-- | gm/showmiplevels.cpp | 25 |
1 files changed, 9 insertions, 16 deletions
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; |