| 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 /* | 8 /* |
| 9 * Code for the "gm" (Golden Master) rendering comparison tool. | 9 * Code for the "gm" (Golden Master) rendering comparison tool. |
| 10 * | 10 * |
| (...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 } | 1032 } |
| 1033 SkPictureRecorder recorder; | 1033 SkPictureRecorder recorder; |
| 1034 SkCanvas* cv = recorder.beginRecording(width, height, factory.get(), rec
ordFlags); | 1034 SkCanvas* cv = recorder.beginRecording(width, height, factory.get(), rec
ordFlags); |
| 1035 cv->scale(scale, scale); | 1035 cv->scale(scale, scale); |
| 1036 invokeGM(gm, cv, false, false); | 1036 invokeGM(gm, cv, false, false); |
| 1037 return recorder.endRecording(); | 1037 return recorder.endRecording(); |
| 1038 } | 1038 } |
| 1039 | 1039 |
| 1040 static SkPicture* stream_to_new_picture(const SkPicture& src) { | 1040 static SkPicture* stream_to_new_picture(const SkPicture& src) { |
| 1041 SkDynamicMemoryWStream storage; | 1041 SkDynamicMemoryWStream storage; |
| 1042 src.serialize(&storage); | 1042 src.serialize(&storage, NULL); |
| 1043 SkAutoTUnref<SkStreamAsset> pictReadback(storage.detachAsStream()); | 1043 SkAutoTUnref<SkStreamAsset> pictReadback(storage.detachAsStream()); |
| 1044 SkPicture* retval = SkPicture::CreateFromStream(pictReadback, | 1044 SkPicture* retval = SkPicture::CreateFromStream(pictReadback, |
| 1045 &SkImageDecoder::DecodeM
emory); | 1045 &SkImageDecoder::DecodeM
emory); |
| 1046 return retval; | 1046 return retval; |
| 1047 } | 1047 } |
| 1048 | 1048 |
| 1049 // Test: draw into a bitmap or pdf. | 1049 // Test: draw into a bitmap or pdf. |
| 1050 // Depending on flags, possibly compare to an expected image. | 1050 // Depending on flags, possibly compare to an expected image. |
| 1051 // If writePath is not NULL, also write images (or documents) to the specifi
ed path. | 1051 // If writePath is not NULL, also write images (or documents) to the specifi
ed path. |
| 1052 ErrorCombination test_drawing(GM* gm, const ConfigData& gRec, | 1052 ErrorCombination test_drawing(GM* gm, const ConfigData& gRec, |
| (...skipping 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2490 if (FLAGS_forceBWtext) { | 2490 if (FLAGS_forceBWtext) { |
| 2491 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); | 2491 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); |
| 2492 } | 2492 } |
| 2493 } | 2493 } |
| 2494 | 2494 |
| 2495 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 2495 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 2496 int main(int argc, char * const argv[]) { | 2496 int main(int argc, char * const argv[]) { |
| 2497 return tool_main(argc, (char**) argv); | 2497 return tool_main(argc, (char**) argv); |
| 2498 } | 2498 } |
| 2499 #endif | 2499 #endif |
| OLD | NEW |