aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/showmiplevels.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-01-16 18:50:35 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-01-16 18:50:35 -0800
commit67b09bf6b7422c7a3209781cbb7827224e3ffc17 (patch)
treeabbf8933a1cc4d7ffd52b02d98560133d030c552 /gm/showmiplevels.cpp
parent879caf86fd9b906d326f9cffe6933817019078b2 (diff)
use pixmaps in mipmap api
Diffstat (limited to 'gm/showmiplevels.cpp')
-rw-r--r--gm/showmiplevels.cpp25
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;