| 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 #include "SampleApp.h" | 7 #include "SampleApp.h" |
| 8 | 8 |
| 9 #include "SkData.h" | 9 #include "SkData.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 2417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2428 } | 2428 } |
| 2429 } | 2429 } |
| 2430 | 2430 |
| 2431 for (int k = 0; k < count - 1; k++) { | 2431 for (int k = 0; k < count - 1; k++) { |
| 2432 SkASSERT(!(array[k+1] < array[k])); | 2432 SkASSERT(!(array[k+1] < array[k])); |
| 2433 } | 2433 } |
| 2434 } | 2434 } |
| 2435 | 2435 |
| 2436 #include "SkRandom.h" | 2436 #include "SkRandom.h" |
| 2437 | 2437 |
| 2438 static void rand_rect(SkIRect* rect, SkMWCRandom& rand) { | 2438 static void rand_rect(SkIRect* rect, SkRandom& rand) { |
| 2439 int bits = 8; | 2439 int bits = 8; |
| 2440 int shift = 32 - bits; | 2440 int shift = 32 - bits; |
| 2441 rect->set(rand.nextU() >> shift, rand.nextU() >> shift, | 2441 rect->set(rand.nextU() >> shift, rand.nextU() >> shift, |
| 2442 rand.nextU() >> shift, rand.nextU() >> shift); | 2442 rand.nextU() >> shift, rand.nextU() >> shift); |
| 2443 rect->sort(); | 2443 rect->sort(); |
| 2444 } | 2444 } |
| 2445 | 2445 |
| 2446 static void dumpRect(const SkIRect& r) { | 2446 static void dumpRect(const SkIRect& r) { |
| 2447 SkDebugf(" { %d, %d, %d, %d },\n", | 2447 SkDebugf(" { %d, %d, %d, %d },\n", |
| 2448 r.fLeft, r.fTop, | 2448 r.fLeft, r.fTop, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2492 } gRecs[] = { | 2492 } gRecs[] = { |
| 2493 { r0, SK_ARRAY_COUNT(r0) }, | 2493 { r0, SK_ARRAY_COUNT(r0) }, |
| 2494 { r1, SK_ARRAY_COUNT(r1) }, | 2494 { r1, SK_ARRAY_COUNT(r1) }, |
| 2495 { r2, SK_ARRAY_COUNT(r2) }, | 2495 { r2, SK_ARRAY_COUNT(r2) }, |
| 2496 }; | 2496 }; |
| 2497 | 2497 |
| 2498 for (i = 0; i < SK_ARRAY_COUNT(gRecs); i++) { | 2498 for (i = 0; i < SK_ARRAY_COUNT(gRecs); i++) { |
| 2499 test_rects(gRecs[i].fRects, gRecs[i].fCount); | 2499 test_rects(gRecs[i].fRects, gRecs[i].fCount); |
| 2500 } | 2500 } |
| 2501 | 2501 |
| 2502 SkMWCRandom rand; | 2502 SkRandom rand; |
| 2503 for (i = 0; i < 10000; i++) { | 2503 for (i = 0; i < 10000; i++) { |
| 2504 SkRegion rgn0, rgn1; | 2504 SkRegion rgn0, rgn1; |
| 2505 | 2505 |
| 2506 const int N = 8; | 2506 const int N = 8; |
| 2507 SkIRect rect[N]; | 2507 SkIRect rect[N]; |
| 2508 for (int j = 0; j < N; j++) { | 2508 for (int j = 0; j < N; j++) { |
| 2509 rand_rect(&rect[j], rand); | 2509 rand_rect(&rect[j], rand); |
| 2510 } | 2510 } |
| 2511 test_rects(rect, N); | 2511 test_rects(rect, N); |
| 2512 } | 2512 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2545 SkGraphics::Init(); | 2545 SkGraphics::Init(); |
| 2546 SkEvent::Init(); | 2546 SkEvent::Init(); |
| 2547 } | 2547 } |
| 2548 | 2548 |
| 2549 // FIXME: this should be in a header | 2549 // FIXME: this should be in a header |
| 2550 void application_term(); | 2550 void application_term(); |
| 2551 void application_term() { | 2551 void application_term() { |
| 2552 SkEvent::Term(); | 2552 SkEvent::Term(); |
| 2553 SkGraphics::Term(); | 2553 SkGraphics::Term(); |
| 2554 } | 2554 } |
| OLD | NEW |