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 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 #endif | 1024 #endif |
1025 test_peephole(); | 1025 test_peephole(); |
1026 test_gatherpixelrefs(reporter); | 1026 test_gatherpixelrefs(reporter); |
1027 test_gatherpixelrefsandrects(reporter); | 1027 test_gatherpixelrefsandrects(reporter); |
1028 test_bitmap_with_encoded_data(reporter); | 1028 test_bitmap_with_encoded_data(reporter); |
1029 test_clone_empty(reporter); | 1029 test_clone_empty(reporter); |
1030 test_clip_bound_opt(reporter); | 1030 test_clip_bound_opt(reporter); |
1031 test_clip_expansion(reporter); | 1031 test_clip_expansion(reporter); |
1032 test_hierarchical(reporter); | 1032 test_hierarchical(reporter); |
1033 } | 1033 } |
| 1034 |
| 1035 static void draw_bitmaps(const SkBitmap bitmap, SkCanvas* canvas) { |
| 1036 const SkPaint paint; |
| 1037 const SkRect rect = { 5.0f, 5.0f, 8.0f, 8.0f }; |
| 1038 const SkIRect irect = { 2, 2, 3, 3 }; |
| 1039 |
| 1040 // Don't care what these record, as long as they're legal. |
| 1041 canvas->drawBitmap(bitmap, 0.0f, 0.0f, &paint); |
| 1042 canvas->drawBitmapRectToRect(bitmap, &rect, rect, &paint, SkCanvas::kNone_Dr
awBitmapRectFlag); |
| 1043 canvas->drawBitmapMatrix(bitmap, SkMatrix::I(), &paint); |
| 1044 canvas->drawBitmapNine(bitmap, irect, rect, &paint); |
| 1045 canvas->drawSprite(bitmap, 1, 1); |
| 1046 } |
| 1047 |
| 1048 static void test_draw_bitmaps(SkCanvas* canvas) { |
| 1049 SkBitmap empty; |
| 1050 draw_bitmaps(empty, canvas); |
| 1051 empty.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); |
| 1052 draw_bitmaps(empty, canvas); |
| 1053 } |
| 1054 |
| 1055 DEF_TEST(Picture_EmptyBitmap, r) { |
| 1056 SkPicture picture; |
| 1057 test_draw_bitmaps(picture.beginRecording(10, 10)); |
| 1058 picture.endRecording(); |
| 1059 } |
| 1060 |
| 1061 DEF_TEST(Canvas_EmptyBitmap, r) { |
| 1062 SkBitmap dst; |
| 1063 dst.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); |
| 1064 dst.allocPixels(); |
| 1065 SkCanvas canvas(dst); |
| 1066 |
| 1067 test_draw_bitmaps(&canvas); |
| 1068 } |
OLD | NEW |