OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SampleApp.h" | 8 #include "SampleApp.h" |
9 | 9 |
10 #include "OverView.h" | 10 #include "OverView.h" |
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
992 void SampleWindow::listTitles() { | 992 void SampleWindow::listTitles() { |
993 int count = fSamples.count(); | 993 int count = fSamples.count(); |
994 SkDebugf("All Slides:\n"); | 994 SkDebugf("All Slides:\n"); |
995 for (int i = 0; i < count; i++) { | 995 for (int i = 0; i < count; i++) { |
996 SkDebugf(" %s\n", getSampleTitle(i).c_str()); | 996 SkDebugf(" %s\n", getSampleTitle(i).c_str()); |
997 } | 997 } |
998 } | 998 } |
999 | 999 |
1000 static SkBitmap capture_bitmap(SkCanvas* canvas) { | 1000 static SkBitmap capture_bitmap(SkCanvas* canvas) { |
1001 SkBitmap bm; | 1001 SkBitmap bm; |
1002 if (bm.allocPixels(canvas->imageInfo())) { | 1002 if (bm.tryAllocPixels(canvas->imageInfo())) { |
1003 canvas->readPixels(&bm, 0, 0); | 1003 canvas->readPixels(&bm, 0, 0); |
1004 } | 1004 } |
1005 return bm; | 1005 return bm; |
1006 } | 1006 } |
1007 | 1007 |
1008 static bool bitmap_diff(SkCanvas* canvas, const SkBitmap& orig, | 1008 static bool bitmap_diff(SkCanvas* canvas, const SkBitmap& orig, |
1009 SkBitmap* diff) { | 1009 SkBitmap* diff) { |
1010 SkBitmap src = capture_bitmap(canvas); | 1010 SkBitmap src = capture_bitmap(canvas); |
1011 | 1011 |
1012 SkAutoLockPixels alp0(src); | 1012 SkAutoLockPixels alp0(src); |
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2396 setenv("ANDROID_ROOT", "/android/device/data", 0); | 2396 setenv("ANDROID_ROOT", "/android/device/data", 0); |
2397 #endif | 2397 #endif |
2398 SkGraphics::Init(); | 2398 SkGraphics::Init(); |
2399 SkEvent::Init(); | 2399 SkEvent::Init(); |
2400 } | 2400 } |
2401 | 2401 |
2402 void application_term() { | 2402 void application_term() { |
2403 SkEvent::Term(); | 2403 SkEvent::Term(); |
2404 SkGraphics::Term(); | 2404 SkGraphics::Term(); |
2405 } | 2405 } |
OLD | NEW |