OLD | NEW |
1 #include "PathOpsExtendedTest.h" | 1 #include "PathOpsExtendedTest.h" |
2 #include "PathOpsThreadedCommon.h" | 2 #include "PathOpsThreadedCommon.h" |
3 #include "SkBitmap.h" | 3 #include "SkBitmap.h" |
4 #include "SkDevice.h" | 4 #include "SkDevice.h" |
5 #include "SkCanvas.h" | 5 #include "SkCanvas.h" |
6 #include "SkImageDecoder.h" | 6 #include "SkImageDecoder.h" |
7 #include "SkImageEncoder.h" | 7 #include "SkImageEncoder.h" |
8 #include "SkStream.h" | 8 #include "SkStream.h" |
9 #include "SkOSFile.h" | 9 #include "SkOSFile.h" |
10 #include "SkPicture.h" | 10 #include "SkPicture.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 testName.prepend("skp"); | 51 testName.prepend("skp"); |
52 testName.append("1"); | 52 testName.append("1"); |
53 strncpy(DEBUG_FILENAME_STRING, testName.c_str(), DEBUG_FILENAME_STRING_LENGT
H); | 53 strncpy(DEBUG_FILENAME_STRING, testName.c_str(), DEBUG_FILENAME_STRING_LENGT
H); |
54 #endif | 54 #endif |
55 SkString path; | 55 SkString path; |
56 make_filepath(&path, pictDir, filename); | 56 make_filepath(&path, pictDir, filename); |
57 SkFILEStream stream(path.c_str()); | 57 SkFILEStream stream(path.c_str()); |
58 if (!stream.isValid()) { | 58 if (!stream.isValid()) { |
59 return; | 59 return; |
60 } | 60 } |
61 bool success; | 61 SkPicture* pic = SkPicture::CreateFromStream(&stream, &SkImageDecoder::Decod
eMemory); |
62 SkPicture* pic = SkNEW_ARGS(SkPicture, (&stream, &success, &SkImageDecoder::
DecodeMemory)); | 62 if (!pic) { |
63 if (!success) { | |
64 SkDebugf("unable to decode %s\n", filename.c_str()); | 63 SkDebugf("unable to decode %s\n", filename.c_str()); |
65 return; | 64 return; |
66 } | 65 } |
67 int width = pic->width(); | 66 int width = pic->width(); |
68 int height = pic->height(); | 67 int height = pic->height(); |
69 SkBitmap bitmap; | 68 SkBitmap bitmap; |
70 bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height); | 69 bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height); |
71 success = bitmap.allocPixels(); | 70 bool success = bitmap.allocPixels(); |
72 if (!success) { | 71 if (!success) { |
73 SkDebugf("unable to allocate bitmap for %s\n", filename.c_str()); | 72 SkDebugf("unable to allocate bitmap for %s\n", filename.c_str()); |
74 return; | 73 return; |
75 } | 74 } |
76 SkCanvas canvas(bitmap); | 75 SkCanvas canvas(bitmap); |
77 SkString pngName(filename); | 76 SkString pngName(filename); |
78 pngName.remove(pngName.size() - 3, 3); | 77 pngName.remove(pngName.size() - 3, 3); |
79 pngName.append("png"); | 78 pngName.append("png"); |
80 for (int i = 0; i < 2; ++i) { | 79 for (int i = 0; i < 2; ++i) { |
81 bool useOp = i ? true : false; | 80 bool useOp = i ? true : false; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 SkString filename(skipBefore); | 141 SkString filename(skipBefore); |
143 testOne(filename); | 142 testOne(filename); |
144 } | 143 } |
145 | 144 |
146 #include "TestClassDef.h" | 145 #include "TestClassDef.h" |
147 DEFINE_TESTCLASS_SHORT(PathOpsSkpClipTest) | 146 DEFINE_TESTCLASS_SHORT(PathOpsSkpClipTest) |
148 | 147 |
149 DEFINE_TESTCLASS_SHORT(PathOpsSkpClipOneOffTest) | 148 DEFINE_TESTCLASS_SHORT(PathOpsSkpClipOneOffTest) |
150 | 149 |
151 DEFINE_TESTCLASS_SHORT(PathOpsSkpClipThreadedTest) | 150 DEFINE_TESTCLASS_SHORT(PathOpsSkpClipThreadedTest) |
OLD | NEW |