aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@google.com>2015-01-15 18:36:07 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-01-15 18:36:07 -0800
commit04f07fcbfddbe8ca97d29053554a01c66d44ece2 (patch)
tree92566eb3704ca4087872372074c123d7c855c100 /gm
parent51fc019f2143bc08cc9ecd479e5c6beff67abe79 (diff)
Revert of add gm to show miplevels (patchset #2 id:20001 of https://codereview.chromium.org/849173004/)
Reason for revert: ==31530==ERROR: LeakSanitizer: detected memory leaks Direct leak of 224 byte(s) in 2 object(s) allocated from: #0 0x7febb223f65b in operator new(unsigned long) (/home/default/storage/skia-repo/buildbot/skiabot-linux-xsan-001/build/slave/Test-Ubuntu13_10-GCE-NoGPU-x86_64-Debug-ASAN/build/skia/out/Debug/dm+0x35865b) #1 0x7febb3483c56 in SkMipMap::Build(SkBitmap const&, SkDiscardableMemory* (*)(unsigned long)) /home/default/storage/skia-repo/buildbot/skiabot-linux-xsan-001/build/slave/Test-Ubuntu13_10-GCE-NoGPU-x86_64-Debug-ASAN/build/skia/out/Debug/../../src/core/SkMipMap.cpp:181:9 #2 0x7febb2c37914 in ShowMipLevels::onDraw(SkCanvas*) /home/default/storage/skia-repo/buildbot/skiabot-linux-xsan-001/build/slave/Test-Ubuntu13_10-GCE-NoGPU-x86_64-Debug-ASAN/build/skia/out/Debug/../../gm/downsamplebitmap.cpp:228:24 #3 0x7febb2295736 in skiagm::GM::drawContent(SkCanvas*) /home/default/storage/skia-repo/buildbot/skiabot-linux-xsan-001/build/slave/Test-Ubuntu13_10-GCE-NoGPU-x86_64-Debug-ASAN/build/skia/out/Debug/../../gm/gm.cpp:32:5 #4 0x7febb2295019 in skiagm::GM::draw(SkCanvas*) /home/default/storage/skia-repo/buildbot/skiabot-linux-xsan-001/build/slave/Test-Ubuntu13_10-GCE-NoGPU-x86_64-Debug-ASAN/build/skia/out/Debug/../../gm/gm.cpp:24:5 #5 0x7febb226722f in DM::GMSrc::draw(SkCanvas*) const /home/default/storage/skia-repo/buildbot/skiabot-linux-xsan-001/build/slave/Test-Ubuntu13_10-GCE-NoGPU-x86_64-Debug-ASAN/build/skia/out/Debug/../../dm/DMSrcSink.cpp:22:5 #6 0x7febb226d929 in DM::RasterSink::draw(DM::Src const&, SkBitmap*, SkWStream*) const /home/default/storage/skia-repo/buildbot/skiabot-linux-xsan-001/build/slave/Test-Ubuntu13_10-GCE-NoGPU-x86_64-Debug-ASAN/build/skia/out/Debug/../../dm/DMSrcSink.cpp:230:12 #7 0x7febb224e004 in Task::Run(Task*) /home/default/storage/skia-repo/buildbot/skiabot-linux-xsan-001/build/slave/Test-Ubuntu13_10-GCE-NoGPU-x86_64-Debug-ASAN/build/skia/out/Debug/../../dm/DM.cpp:254:25 #8 0x7febb3805e4c in (anonymous namespace)::ThreadPool::Loop(void*) /home/default/storage/skia-repo/buildbot/skiabot-linux-xsan-001/build/slave/Test-Ubuntu13_10-GCE-NoGPU-x86_64-Debug-ASAN/build/skia/out/Debug/../../src/core/SkTaskGroup.cpp:149:13 #9 0x7febb460dc7c in thread_start(void*) /home/default/storage/skia-repo/buildbot/skiabot-linux-xsan-001/build/slave/Test-Ubuntu13_10-GCE-NoGPU-x86_64-Debug-ASAN/build/skia/out/Debug/../../src/utils/SkThreadUtils_pthread.cpp:66:9 #10 0x7febb1251f6d in start_thread /build/buildd/eglibc-2.17/nptl/pthread_create.c:311 Indirect leak of 699528 byte(s) in 2 object(s) allocated from: #0 0x7febb22214ab in __interceptor_malloc (/home/default/storage/skia-repo/buildbot/skiabot-linux-xsan-001/build/slave/Test-Ubuntu13_10-GCE-NoGPU-x86_64-Debug-ASAN/build/skia/out/Debug/dm+0x33a4ab) #1 0x7febb473e3c6 in sk_malloc_flags(unsigned long, unsigned int) /home/default/storage/skia-repo/buildbot/skiabot-linux-xsan-001/build/slave/Test-Ubuntu13_10-GCE-NoGPU-x86_64-Debug-ASAN/build/skia/out/Debug/../../src/ports/SkMemory_malloc.cpp:54:15 #2 0x7febb473e19a in sk_malloc_throw(unsigned long) /home/default/storage/skia-repo/buildbot/skiabot-linux-xsan-001/build/slave/Test-Ubuntu13_10-GCE-NoGPU-x86_64-Debug-ASAN/build/skia/out/Debug/../../src/ports/SkMemory_malloc.cpp:40:12 #3 0x7febb3483c94 in SkMipMap::Build(SkBitmap const&, SkDiscardableMemory* (*)(unsigned long)) /home/default/storage/skia-repo/buildbot/skiabot-linux-xsan-001/build/slave/Test-Ubuntu13_10-GCE-NoGPU-x86_64-Debug-ASAN/build/skia/out/Debug/../../src/core/SkMipMap.cpp:181:18 #4 0x7febb2c37914 in ShowMipLevels::onDraw(SkCanvas*) /home/default/storage/skia-repo/buildbot/skiabot-linux-xsan-001/build/slave/Test-Ubuntu13_10-GCE-NoGPU-x86_64-Debug-ASAN/build/skia/out/Debug/../../gm/downsamplebitmap.cpp:228:24 #5 0x7febb2295736 in skiagm::GM::drawContent(SkCanvas*) /home/default/storage/skia-repo/buildbot/skiabot-linux-xsan-001/build/slave/Test-Ubuntu13_10-GCE-NoGPU-x86_64-Debug-ASAN/build/skia/out/Debug/../../gm/gm.cpp:32:5 #6 0x7febb2295019 in skiagm::GM::draw(SkCanvas*) /home/default/storage/skia-repo/buildbot/skiabot-linux-xsan-001/build/slave/Test-Ubuntu13_10-GCE-NoGPU-x86_64-Debug-ASAN/build/skia/out/Debug/../../gm/gm.cpp:24:5 #7 0x7febb226722f in DM::GMSrc::draw(SkCanvas*) const /home/default/storage/skia-repo/buildbot/skiabot-linux-xsan-001/build/slave/Test-Ubuntu13_10-GCE-NoGPU-x86_64-Debug-ASAN/build/skia/out/Debug/../../dm/DMSrcSink.cpp:22:5 #8 0x7febb226d929 in DM::RasterSink::draw(DM::Src const&, SkBitmap*, SkWStream*) const /home/default/storage/skia-repo/buildbot/skiabot-linux-xsan-001/build/slave/Test-Ubuntu13_10-GCE-NoGPU-x86_64-Debug-ASAN/build/skia/out/Debug/../../dm/DMSrcSink.cpp:230:12 #9 0x7febb224e004 in Task::Run(Task*) /home/default/storage/skia-repo/buildbot/skiabot-linux-xsan-001/build/slave/Test-Ubuntu13_10-GCE-NoGPU-x86_64-Debug-ASAN/build/skia/out/Debug/../../dm/DM.cpp:254:25 #10 0x7febb3805e4c in (anonymous namespace)::ThreadPool::Loop(void*) /home/default/storage/skia-repo/buildbot/skiabot-linux-xsan-001/build/slave/Test-Ubuntu13_10-GCE-NoGPU-x86_64-Debug-ASAN/build/skia/out/Debug/../../src/core/SkTaskGroup.cpp:149:13 #11 0x7febb460dc7c in thread_start(void*) /home/default/storage/skia-repo/buildbot/skiabot-linux-xsan-001/build/slave/Test-Ubuntu13_10-GCE-NoGPU-x86_64-Debug-ASAN/build/skia/out/Debug/../../src/utils/SkThreadUtils_pthread.cpp:66:9 #12 0x7febb1251f6d in start_thread /build/buildd/eglibc-2.17/nptl/pthread_create.c:311 Original issue's description: > add gm to show miplevels > > BUG=skia: > TBR= > > NOTREECHECKS=true > > Committed: https://skia.googlesource.com/skia/+/a598f4b773f066a939e0216a116c179b90550727 TBR=reed@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/854103004
Diffstat (limited to 'gm')
-rw-r--r--gm/downsamplebitmap.cpp85
1 files changed, 13 insertions, 72 deletions
diff --git a/gm/downsamplebitmap.cpp b/gm/downsamplebitmap.cpp
index 50b15494b6..ce10b47a84 100644
--- a/gm/downsamplebitmap.cpp
+++ b/gm/downsamplebitmap.cpp
@@ -14,22 +14,6 @@
#include "SkStream.h"
#include "SkPaint.h"
-static void make_checker(SkBitmap* bm, int size, int numChecks) {
- bm->allocN32Pixels(size, size);
- for (int y = 0; y < size; ++y) {
- for (int x = 0; x < size; ++x) {
- SkPMColor* s = bm->getAddr32(x, y);
- int cx = (x * numChecks) / size;
- int cy = (y * numChecks) / size;
- if ((cx+cy)%2) {
- *s = 0xFFFFFFFF;
- } else {
- *s = 0xFF000000;
- }
- }
- }
-}
-
static void setTypeface(SkPaint* paint, const char name[], SkTypeface::Style style) {
sk_tool_utils::set_portable_typeface(paint, name, style);
}
@@ -155,7 +139,19 @@ class DownsampleBitmapCheckerboardGM: public DownsampleBitmapGM {
int fNumChecks;
void make_bitmap() SK_OVERRIDE {
- make_checker(&fBM, fSize, fNumChecks);
+ fBM.allocN32Pixels(fSize, fSize);
+ for (int y = 0; y < fSize; ++y) {
+ for (int x = 0; x < fSize; ++x) {
+ SkPMColor* s = fBM.getAddr32(x, y);
+ int cx = (x * fNumChecks) / fSize;
+ int cy = (y * fNumChecks) / fSize;
+ if ((cx+cy)%2) {
+ *s = 0xFFFFFFFF;
+ } else {
+ *s = 0xFF000000;
+ }
+ }
+ }
}
private:
typedef DownsampleBitmapGM INHERITED;
@@ -194,59 +190,6 @@ class DownsampleBitmapImageGM: public DownsampleBitmapGM {
typedef DownsampleBitmapGM INHERITED;
};
-#include "SkMipMap.h"
-class ShowMipLevels : public skiagm::GM {
-public:
- SkBitmap fBM;
-
- ShowMipLevels() {
- this->setBGColor(0xFFDDDDDD);
- make_checker(&fBM, 512, 256);
- }
-
-protected:
-#if 0
- uint32_t onGetFlags() const SK_OVERRIDE {
- return kSkipTiled_Flag;
- }
-#endif
-
- SkString onShortName() SK_OVERRIDE {
- return SkString("showmiplevels");
- }
-
- SkISize onISize() SK_OVERRIDE {
- return SkISize::Make(fBM.width() + 4, 4 * fBM.height());
- }
-
- void onDraw(SkCanvas* canvas) SK_OVERRIDE {
- SkScalar x = 4;
- SkScalar y = 4;
- canvas->drawBitmap(fBM, x, y, NULL);
- y += fBM.height() + 4;
-
- SkMipMap* mm = SkMipMap::Build(fBM, NULL);
-
- 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);
- canvas->drawBitmap(bm, x, y, NULL);
- y += bm.height() + 4;
- scale /= 2;
- if (info.width() == 1 || info.height() == 1) {
- break;
- }
- }
- }
-
-private:
- typedef skiagm::GM INHERITED;
-};
-
-
//////////////////////////////////////////////////////////////////////////////
DEF_GM( return new DownsampleBitmapTextGM(72, SkPaint::kHigh_FilterLevel); )
@@ -272,5 +215,3 @@ DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kNone_Filter
DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kNone_FilterLevel); )
DEF_GM( return new DownsampleBitmapImageGM("mandrill_132x132_12x12.astc",
SkPaint::kNone_FilterLevel); )
-
-DEF_GM( return new ShowMipLevels; )