| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 canvas->restore(); | 688 canvas->restore(); |
| 689 } else if (unit <= 0.9) { | 689 } else if (unit <= 0.9) { |
| 690 // SkDebugf("clip\n"); | 690 // SkDebugf("clip\n"); |
| 691 canvas->clipRect(rect); | 691 canvas->clipRect(rect); |
| 692 } else { | 692 } else { |
| 693 // SkDebugf("draw\n"); | 693 // SkDebugf("draw\n"); |
| 694 canvas->drawPaint(paint); | 694 canvas->drawPaint(paint); |
| 695 } | 695 } |
| 696 } | 696 } |
| 697 | 697 |
| 698 #if SK_SUPPORT_GPU |
| 698 static void test_gpu_veto(skiatest::Reporter* reporter) { | 699 static void test_gpu_veto(skiatest::Reporter* reporter) { |
| 699 | 700 |
| 700 SkPictureRecorder recorder; | 701 SkPictureRecorder recorder; |
| 701 | 702 |
| 702 SkCanvas* canvas = recorder.beginRecording(100, 100, NULL, 0); | 703 SkCanvas* canvas = recorder.beginRecording(100, 100, NULL, 0); |
| 703 { | 704 { |
| 704 SkPath path; | 705 SkPath path; |
| 705 path.moveTo(0, 0); | 706 path.moveTo(0, 0); |
| 706 path.lineTo(50, 50); | 707 path.lineTo(50, 50); |
| 707 | 708 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 paint.setStyle(SkPaint::kStroke_Style); | 758 paint.setStyle(SkPaint::kStroke_Style); |
| 758 paint.setStrokeWidth(0); | 759 paint.setStrokeWidth(0); |
| 759 for (int i = 0; i < 50; ++i) { | 760 for (int i = 0; i < 50; ++i) { |
| 760 canvas->drawPath(path, paint); | 761 canvas->drawPath(path, paint); |
| 761 } | 762 } |
| 762 } | 763 } |
| 763 picture.reset(recorder.endRecording()); | 764 picture.reset(recorder.endRecording()); |
| 764 // hairline stroked AA concave paths are fine for GPU rendering | 765 // hairline stroked AA concave paths are fine for GPU rendering |
| 765 REPORTER_ASSERT(reporter, picture->suitableForGpuRasterization(NULL)); | 766 REPORTER_ASSERT(reporter, picture->suitableForGpuRasterization(NULL)); |
| 766 } | 767 } |
| 768 #endif |
| 767 | 769 |
| 768 static void set_canvas_to_save_count_4(SkCanvas* canvas) { | 770 static void set_canvas_to_save_count_4(SkCanvas* canvas) { |
| 769 canvas->restoreToCount(1); | 771 canvas->restoreToCount(1); |
| 770 canvas->save(); | 772 canvas->save(); |
| 771 canvas->save(); | 773 canvas->save(); |
| 772 canvas->save(); | 774 canvas->save(); |
| 773 } | 775 } |
| 774 | 776 |
| 775 static void test_unbalanced_save_restores(skiatest::Reporter* reporter) { | 777 static void test_unbalanced_save_restores(skiatest::Reporter* reporter) { |
| 776 SkCanvas testCanvas(100, 100); | 778 SkCanvas testCanvas(100, 100); |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1261 | 1263 |
| 1262 DEF_TEST(Picture, reporter) { | 1264 DEF_TEST(Picture, reporter) { |
| 1263 #ifdef SK_DEBUG | 1265 #ifdef SK_DEBUG |
| 1264 test_deleting_empty_playback(); | 1266 test_deleting_empty_playback(); |
| 1265 test_serializing_empty_picture(); | 1267 test_serializing_empty_picture(); |
| 1266 #else | 1268 #else |
| 1267 test_bad_bitmap(); | 1269 test_bad_bitmap(); |
| 1268 #endif | 1270 #endif |
| 1269 test_unbalanced_save_restores(reporter); | 1271 test_unbalanced_save_restores(reporter); |
| 1270 test_peephole(); | 1272 test_peephole(); |
| 1273 #if SK_SUPPORT_GPU |
| 1271 test_gpu_veto(reporter); | 1274 test_gpu_veto(reporter); |
| 1275 #endif |
| 1272 test_gatherpixelrefs(reporter); | 1276 test_gatherpixelrefs(reporter); |
| 1273 test_gatherpixelrefsandrects(reporter); | 1277 test_gatherpixelrefsandrects(reporter); |
| 1274 test_bitmap_with_encoded_data(reporter); | 1278 test_bitmap_with_encoded_data(reporter); |
| 1275 test_clone_empty(reporter); | 1279 test_clone_empty(reporter); |
| 1276 test_draw_empty(reporter); | 1280 test_draw_empty(reporter); |
| 1277 test_clip_bound_opt(reporter); | 1281 test_clip_bound_opt(reporter); |
| 1278 test_clip_expansion(reporter); | 1282 test_clip_expansion(reporter); |
| 1279 test_hierarchical(reporter); | 1283 test_hierarchical(reporter); |
| 1280 test_gen_id(reporter); | 1284 test_gen_id(reporter); |
| 1281 } | 1285 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1306 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | 1310 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
| 1307 } | 1311 } |
| 1308 | 1312 |
| 1309 DEF_TEST(Canvas_EmptyBitmap, r) { | 1313 DEF_TEST(Canvas_EmptyBitmap, r) { |
| 1310 SkBitmap dst; | 1314 SkBitmap dst; |
| 1311 dst.allocN32Pixels(10, 10); | 1315 dst.allocN32Pixels(10, 10); |
| 1312 SkCanvas canvas(dst); | 1316 SkCanvas canvas(dst); |
| 1313 | 1317 |
| 1314 test_draw_bitmaps(&canvas); | 1318 test_draw_bitmaps(&canvas); |
| 1315 } | 1319 } |
| OLD | NEW |