| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "gm.h" | 8 #include "gm.h" |
| 9 | 9 |
| 10 #include "Resources.h" | 10 #include "Resources.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 SkPixmap prevPM; | 144 SkPixmap prevPM; |
| 145 baseBM.lockPixels(); | 145 baseBM.lockPixels(); |
| 146 baseBM.peekPixels(&prevPM); | 146 baseBM.peekPixels(&prevPM); |
| 147 | 147 |
| 148 SkAutoTUnref<SkMipMap> mm(SkMipMap::Build(baseBM, nullptr)); | 148 SkAutoTUnref<SkMipMap> mm(SkMipMap::Build(baseBM, nullptr)); |
| 149 | 149 |
| 150 int index = 0; | 150 int index = 0; |
| 151 SkMipMap::Level level; | 151 SkMipMap::Level level; |
| 152 SkScalar scale = 0.5f; | 152 SkScalar scale = 0.5f; |
| 153 while (mm->extractLevel(scale, &level)) { | 153 while (mm->extractLevel(SkSize::Make(scale, scale), &level)) { |
| 154 SkBitmap bm = func(prevPM, level.fPixmap); | 154 SkBitmap bm = func(prevPM, level.fPixmap); |
| 155 DrawAndFrame(canvas, bm, x, y); | 155 DrawAndFrame(canvas, bm, x, y); |
| 156 | 156 |
| 157 if (level.fPixmap.width() <= 2 || level.fPixmap.height() <= 2) { | 157 if (level.fPixmap.width() <= 2 || level.fPixmap.height() <= 2) { |
| 158 break; | 158 break; |
| 159 } | 159 } |
| 160 if (index & 1) { | 160 if (index & 1) { |
| 161 x += level.fPixmap.width() + 4; | 161 x += level.fPixmap.width() + 4; |
| 162 } else { | 162 } else { |
| 163 y += level.fPixmap.height() + 4; | 163 y += level.fPixmap.height() + 4; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 | 251 |
| 252 void drawLevels(SkCanvas* canvas, const SkBitmap& baseBM) { | 252 void drawLevels(SkCanvas* canvas, const SkBitmap& baseBM) { |
| 253 SkScalar x = 4; | 253 SkScalar x = 4; |
| 254 SkScalar y = 4; | 254 SkScalar y = 4; |
| 255 | 255 |
| 256 SkAutoTUnref<SkMipMap> mm(SkMipMap::Build(baseBM, nullptr)); | 256 SkAutoTUnref<SkMipMap> mm(SkMipMap::Build(baseBM, nullptr)); |
| 257 | 257 |
| 258 int index = 0; | 258 int index = 0; |
| 259 SkMipMap::Level level; | 259 SkMipMap::Level level; |
| 260 SkScalar scale = 0.5f; | 260 SkScalar scale = 0.5f; |
| 261 while (mm->extractLevel(scale, &level)) { | 261 while (mm->extractLevel(SkSize::Make(scale, scale), &level)) { |
| 262 SkBitmap bm; | 262 SkBitmap bm; |
| 263 bm.installPixels(level.fPixmap); | 263 bm.installPixels(level.fPixmap); |
| 264 DrawAndFrame(canvas, bm, x, y); | 264 DrawAndFrame(canvas, bm, x, y); |
| 265 | 265 |
| 266 if (level.fPixmap.width() <= 2 || level.fPixmap.height() <= 2) { | 266 if (level.fPixmap.width() <= 2 || level.fPixmap.height() <= 2) { |
| 267 break; | 267 break; |
| 268 } | 268 } |
| 269 if (index & 1) { | 269 if (index & 1) { |
| 270 x += level.fPixmap.width() + 4; | 270 x += level.fPixmap.width() + 4; |
| 271 } else { | 271 } else { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 302 } | 302 } |
| 303 } | 303 } |
| 304 | 304 |
| 305 private: | 305 private: |
| 306 typedef skiagm::GM INHERITED; | 306 typedef skiagm::GM INHERITED; |
| 307 }; | 307 }; |
| 308 DEF_GM( return new ShowMipLevels2(255, 255); ) | 308 DEF_GM( return new ShowMipLevels2(255, 255); ) |
| 309 DEF_GM( return new ShowMipLevels2(256, 255); ) | 309 DEF_GM( return new ShowMipLevels2(256, 255); ) |
| 310 DEF_GM( return new ShowMipLevels2(255, 256); ) | 310 DEF_GM( return new ShowMipLevels2(255, 256); ) |
| 311 DEF_GM( return new ShowMipLevels2(256, 256); ) | 311 DEF_GM( return new ShowMipLevels2(256, 256); ) |
| OLD | NEW |