Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2550)

Unified Diff: gm/downsamplebitmap.cpp

Issue 1574233003: expand gm to exercise miplevels and various scalers (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gm/showmiplevels.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/downsamplebitmap.cpp
diff --git a/gm/downsamplebitmap.cpp b/gm/downsamplebitmap.cpp
index d7a8b359274c4a7627983913da586a6f8d9862f6..771eb6ab53d34c8b75ae246b777eb3f09e850e45 100644
--- a/gm/downsamplebitmap.cpp
+++ b/gm/downsamplebitmap.cpp
@@ -191,63 +191,6 @@ class DownsampleBitmapImageGM: public DownsampleBitmapGM {
typedef DownsampleBitmapGM INHERITED;
};
-#include "SkMipMap.h"
-
-static void release_mipmap(void*, void* context) {
- ((SkMipMap*)context)->unref();
-}
-
-class ShowMipLevels : public skiagm::GM {
-public:
- SkBitmap fBM;
-
- ShowMipLevels() {
- this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD));
- make_checker(&fBM, 512, 256);
- }
-
-protected:
-
- SkString onShortName() override {
- return SkString("showmiplevels");
- }
-
- SkISize onISize() override {
- return SkISize::Make(fBM.width() + 8, 2 * fBM.height() + 80);
- }
-
- void onDraw(SkCanvas* canvas) override {
- SkScalar x = 4;
- SkScalar y = 4;
- canvas->drawBitmap(fBM, x, y, nullptr);
- y += fBM.height() + 4;
-
- SkAutoTUnref<SkMipMap> mm(SkMipMap::Build(fBM, nullptr));
-
- SkMipMap::Level level;
- SkScalar scale = 0.5f;
- while (mm->extractLevel(scale, &level)) {
- SkImageInfo info = SkImageInfo::MakeN32Premul(level.fWidth, level.fHeight);
- SkBitmap bm;
- bm.installPixels(info, level.fPixels, level.fRowBytes, nullptr,
- &release_mipmap, (void*)(SkRef(mm.get())));
- bm.setImmutable();
- canvas->drawBitmap(bm, x, y, nullptr);
- y += bm.height() + 4;
- scale /= 2;
- if (info.width() == 1 || info.height() == 1) {
- break;
- }
- }
- }
-
-private:
- typedef skiagm::GM INHERITED;
-};
-DEF_GM( return new ShowMipLevels; )
-
-//////////////////////////////////////////////////////////////////////////////
-
DEF_GM( return new DownsampleBitmapTextGM(72, kHigh_SkFilterQuality); )
DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, kHigh_SkFilterQuality); )
DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", kHigh_SkFilterQuality); )
« no previous file with comments | « no previous file | gm/showmiplevels.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698