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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 SkScalar width = pic->cullRect().width(); | 475 SkScalar width = pic->cullRect().width(); |
476 SkScalar height = pic->cullRect().height(); | 476 SkScalar height = pic->cullRect().height(); |
477 SkBitmap oldBitmap, opBitmap; | 477 SkBitmap oldBitmap, opBitmap; |
478 fScale = 1; | 478 fScale = 1; |
479 while (width / fScale > 32767 || height / fScale > 32767) { | 479 while (width / fScale > 32767 || height / fScale > 32767) { |
480 ++fScale; | 480 ++fScale; |
481 } | 481 } |
482 do { | 482 do { |
483 int dimX = SkScalarCeilToInt(width / fScale); | 483 int dimX = SkScalarCeilToInt(width / fScale); |
484 int dimY = SkScalarCeilToInt(height / fScale); | 484 int dimY = SkScalarCeilToInt(height / fScale); |
485 if (oldBitmap.allocN32Pixels(dimX, dimY) && | 485 if (oldBitmap.tryAllocN32Pixels(dimX, dimY) && opBitmap.tryAllocN32P
ixels(dimX, dimY)) { |
486 opBitmap.allocN32Pixels(dimX, dimY)) { | |
487 break; | 486 break; |
488 } | 487 } |
489 SkDebugf("-%d-", fScale); | 488 SkDebugf("-%d-", fScale); |
490 } while (++fScale < 256); | 489 } while (++fScale < 256); |
491 if (fScale >= 256) { | 490 if (fScale >= 256) { |
492 SkDebugf("unable to allocate bitmap for %s (w=%f h=%f)\n", fFilename
, | 491 SkDebugf("unable to allocate bitmap for %s (w=%f h=%f)\n", fFilename
, |
493 width, height); | 492 width, height); |
494 goto finish; | 493 goto finish; |
495 } | 494 } |
496 oldBitmap.eraseColor(SK_ColorWHITE); | 495 oldBitmap.eraseColor(SK_ColorWHITE); |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 } | 1110 } |
1112 SkGraphics::Term(); | 1111 SkGraphics::Term(); |
1113 return 0; | 1112 return 0; |
1114 } | 1113 } |
1115 | 1114 |
1116 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 1115 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
1117 int main(int argc, char * const argv[]) { | 1116 int main(int argc, char * const argv[]) { |
1118 return tool_main(argc, (char**) argv); | 1117 return tool_main(argc, (char**) argv); |
1119 } | 1118 } |
1120 #endif | 1119 #endif |
OLD | NEW |