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 #include "SampleApp.h" | 7 #include "SampleApp.h" |
8 | 8 |
9 #include "SkData.h" | 9 #include "SkData.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1442 // to redraw. | 1442 // to redraw. |
1443 this->inval(NULL); | 1443 this->inval(NULL); |
1444 return; | 1444 return; |
1445 } | 1445 } |
1446 | 1446 |
1447 if (fRequestGrabImage) { | 1447 if (fRequestGrabImage) { |
1448 fRequestGrabImage = false; | 1448 fRequestGrabImage = false; |
1449 | 1449 |
1450 SkBaseDevice* device = orig->getDevice(); | 1450 SkBaseDevice* device = orig->getDevice(); |
1451 SkBitmap bmp; | 1451 SkBitmap bmp; |
1452 if (device->accessBitmap(false).copyTo(&bmp, SkBitmap::kARGB_8888_Config
)) { | 1452 if (device->accessBitmap(false).copyTo(&bmp, kPMColor_SkColorType)) { |
1453 static int gSampleGrabCounter; | 1453 static int gSampleGrabCounter; |
1454 SkString name; | 1454 SkString name; |
1455 name.printf("sample_grab_%d.png", gSampleGrabCounter++); | 1455 name.printf("sample_grab_%d.png", gSampleGrabCounter++); |
1456 SkImageEncoder::EncodeFile(name.c_str(), bmp, | 1456 SkImageEncoder::EncodeFile(name.c_str(), bmp, |
1457 SkImageEncoder::kPNG_Type, 100); | 1457 SkImageEncoder::kPNG_Type, 100); |
1458 } | 1458 } |
1459 } | 1459 } |
1460 | 1460 |
1461 if (kPicture_DeviceType == fDeviceType) { | 1461 if (kPicture_DeviceType == fDeviceType) { |
1462 if (true) { | 1462 if (true) { |
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2562 SkGraphics::Init(); | 2562 SkGraphics::Init(); |
2563 SkEvent::Init(); | 2563 SkEvent::Init(); |
2564 } | 2564 } |
2565 | 2565 |
2566 // FIXME: this should be in a header | 2566 // FIXME: this should be in a header |
2567 void application_term(); | 2567 void application_term(); |
2568 void application_term() { | 2568 void application_term() { |
2569 SkEvent::Term(); | 2569 SkEvent::Term(); |
2570 SkGraphics::Term(); | 2570 SkGraphics::Term(); |
2571 } | 2571 } |
OLD | NEW |