| 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 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 SkDynamicMemoryWStream storage; | 1018 SkDynamicMemoryWStream storage; |
| 1019 src.serialize(&storage); | 1019 src.serialize(&storage); |
| 1020 | 1020 |
| 1021 size_t streamSize = storage.getOffset(); | 1021 size_t streamSize = storage.getOffset(); |
| 1022 SkAutoMalloc dstStorage(streamSize); | 1022 SkAutoMalloc dstStorage(streamSize); |
| 1023 void* dst = dstStorage.get(); | 1023 void* dst = dstStorage.get(); |
| 1024 //char* dst = new char [streamSize]; | 1024 //char* dst = new char [streamSize]; |
| 1025 //@todo thudson 22 April 2011 when can we safely delete [] dst? | 1025 //@todo thudson 22 April 2011 when can we safely delete [] dst? |
| 1026 storage.copyTo(dst); | 1026 storage.copyTo(dst); |
| 1027 SkMemoryStream pictReadback(dst, streamSize); | 1027 SkMemoryStream pictReadback(dst, streamSize); |
| 1028 bool success; | 1028 SkPicture* retval = SkPicture::CreateFromStream(&pictReadback); |
| 1029 // Pass a decoding bitmap function so that the factory GM (which has an
SkBitmap with | |
| 1030 // encoded data) does not fail. | |
| 1031 SkPicture* retval = new SkPicture (&pictReadback, &success, &SkImageDeco
der::DecodeMemory); | |
| 1032 return retval; | 1029 return retval; |
| 1033 } | 1030 } |
| 1034 | 1031 |
| 1035 // Test: draw into a bitmap or pdf. | 1032 // Test: draw into a bitmap or pdf. |
| 1036 // Depending on flags, possibly compare to an expected image. | 1033 // Depending on flags, possibly compare to an expected image. |
| 1037 ErrorCombination test_drawing(GM* gm, | 1034 ErrorCombination test_drawing(GM* gm, |
| 1038 const ConfigData& gRec, | 1035 const ConfigData& gRec, |
| 1039 const char writePath [], | 1036 const char writePath [], |
| 1040 GrSurface* gpuTarget, | 1037 GrSurface* gpuTarget, |
| 1041 SkBitmap* bitmap) { | 1038 SkBitmap* bitmap) { |
| (...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2149 if (FLAGS_forceBWtext) { | 2146 if (FLAGS_forceBWtext) { |
| 2150 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); | 2147 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); |
| 2151 } | 2148 } |
| 2152 } | 2149 } |
| 2153 | 2150 |
| 2154 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 2151 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 2155 int main(int argc, char * const argv[]) { | 2152 int main(int argc, char * const argv[]) { |
| 2156 return tool_main(argc, (char**) argv); | 2153 return tool_main(argc, (char**) argv); |
| 2157 } | 2154 } |
| 2158 #endif | 2155 #endif |
| OLD | NEW |