OLD | NEW |
1 #include "CrashHandler.h" | 1 #include "CrashHandler.h" |
2 // #include "OverwriteLine.h" | 2 // #include "OverwriteLine.h" |
3 #include "Resources.h" | 3 #include "Resources.h" |
4 #include "SkBitmap.h" | 4 #include "SkBitmap.h" |
5 #include "SkCanvas.h" | 5 #include "SkCanvas.h" |
6 #include "SkColor.h" | 6 #include "SkColor.h" |
7 #include "SkColorPriv.h" | 7 #include "SkColorPriv.h" |
8 #include "SkCommandLineFlags.h" | 8 #include "SkCommandLineFlags.h" |
9 #include "SkDevice.h" | 9 #include "SkDevice.h" |
10 #include "SkForceLinking.h" | 10 #include "SkForceLinking.h" |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 SkScalar pHeight = pic->cullRect().height(); | 393 SkScalar pHeight = pic->cullRect().height(); |
394 const SkScalar maxDimension = 1000.0f; | 394 const SkScalar maxDimension = 1000.0f; |
395 const int slices = 3; | 395 const int slices = 3; |
396 SkScalar xInterval = SkTMax(pWidth - maxDimension, 0.0f) / (slices - 1); | 396 SkScalar xInterval = SkTMax(pWidth - maxDimension, 0.0f) / (slices - 1); |
397 SkScalar yInterval = SkTMax(pHeight - maxDimension, 0.0f) / (slices - 1); | 397 SkScalar yInterval = SkTMax(pHeight - maxDimension, 0.0f) / (slices - 1); |
398 SkRect rect = {0, 0, SkTMin(maxDimension, pWidth), SkTMin(maxDimension, pHei
ght) }; | 398 SkRect rect = {0, 0, SkTMin(maxDimension, pWidth), SkTMin(maxDimension, pHei
ght) }; |
399 canvas->clipRect(rect); | 399 canvas->clipRect(rect); |
400 SkMSec start = SkTime::GetMSecs(); | 400 SkMSec start = SkTime::GetMSecs(); |
401 for (int x = 0; x < slices; ++x) { | 401 for (int x = 0; x < slices; ++x) { |
402 for (int y = 0; y < slices; ++y) { | 402 for (int y = 0; y < slices; ++y) { |
403 pic->draw(canvas); | 403 pic->playback(canvas); |
404 canvas->translate(0, yInterval); | 404 canvas->translate(0, yInterval); |
405 } | 405 } |
406 canvas->translate(xInterval, -yInterval * slices); | 406 canvas->translate(xInterval, -yInterval * slices); |
407 } | 407 } |
408 SkMSec end = SkTime::GetMSecs(); | 408 SkMSec end = SkTime::GetMSecs(); |
409 canvas->restore(); | 409 canvas->restore(); |
410 return end - start; | 410 return end - start; |
411 } | 411 } |
412 | 412 |
413 static void drawPict(SkPicture* pic, SkCanvas* canvas, int scale) { | 413 static void drawPict(SkPicture* pic, SkCanvas* canvas, int scale) { |
414 canvas->clear(SK_ColorWHITE); | 414 canvas->clear(SK_ColorWHITE); |
415 if (scale != 1) { | 415 if (scale != 1) { |
416 canvas->save(); | 416 canvas->save(); |
417 canvas->scale(1.0f / scale, 1.0f / scale); | 417 canvas->scale(1.0f / scale, 1.0f / scale); |
418 } | 418 } |
419 pic->draw(canvas); | 419 pic->playback(canvas); |
420 if (scale != 1) { | 420 if (scale != 1) { |
421 canvas->restore(); | 421 canvas->restore(); |
422 } | 422 } |
423 } | 423 } |
424 | 424 |
425 static void writePict(const SkBitmap& bitmap, const char* outDir, const char* pn
gName) { | 425 static void writePict(const SkBitmap& bitmap, const char* outDir, const char* pn
gName) { |
426 SkString outFile = get_sum_path(outDir); | 426 SkString outFile = get_sum_path(outDir); |
427 outFile.appendf("%s%s", PATH_SLASH, pngName); | 427 outFile.appendf("%s%s", PATH_SLASH, pngName); |
428 if (!SkImageEncoder::EncodeFile(outFile.c_str(), bitmap, SkImageEncoder::kPN
G_Type, 100)) { | 428 if (!SkImageEncoder::EncodeFile(outFile.c_str(), bitmap, SkImageEncoder::kPN
G_Type, 100)) { |
429 SkDebugf("unable to encode gr %s (width=%d height=%d)\n", pngName, | 429 SkDebugf("unable to encode gr %s (width=%d height=%d)\n", pngName, |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1096 } | 1096 } |
1097 SkGraphics::Term(); | 1097 SkGraphics::Term(); |
1098 return 0; | 1098 return 0; |
1099 } | 1099 } |
1100 | 1100 |
1101 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 1101 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
1102 int main(int argc, char * const argv[]) { | 1102 int main(int argc, char * const argv[]) { |
1103 return tool_main(argc, (char**) argv); | 1103 return tool_main(argc, (char**) argv); |
1104 } | 1104 } |
1105 #endif | 1105 #endif |
OLD | NEW |