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 #include "SampleApp.h" | 8 #include "SampleApp.h" |
9 | 9 |
10 #include "SkData.h" | 10 #include "SkData.h" |
(...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1463 SkImageEncoder::kPNG_Type, 100); | 1463 SkImageEncoder::kPNG_Type, 100); |
1464 } | 1464 } |
1465 } | 1465 } |
1466 | 1466 |
1467 if (kPicture_DeviceType == fDeviceType) { | 1467 if (kPicture_DeviceType == fDeviceType) { |
1468 SkAutoTUnref<SkPicture> picture(fRecorder.endRecording()); | 1468 SkAutoTUnref<SkPicture> picture(fRecorder.endRecording()); |
1469 | 1469 |
1470 if (true) { | 1470 if (true) { |
1471 SkPicture* pict = new SkPicture(*picture); | 1471 SkPicture* pict = new SkPicture(*picture); |
1472 this->installDrawFilter(orig); | 1472 this->installDrawFilter(orig); |
1473 orig->drawPicture(*pict); | 1473 orig->drawPicture(pict); |
1474 pict->unref(); | 1474 pict->unref(); |
1475 } else if (true) { | 1475 } else if (true) { |
1476 SkDynamicMemoryWStream ostream; | 1476 SkDynamicMemoryWStream ostream; |
1477 picture->serialize(&ostream); | 1477 picture->serialize(&ostream); |
1478 | 1478 |
1479 SkAutoDataUnref data(ostream.copyToData()); | 1479 SkAutoDataUnref data(ostream.copyToData()); |
1480 SkMemoryStream istream(data->data(), data->size()); | 1480 SkMemoryStream istream(data->data(), data->size()); |
1481 SkAutoTUnref<SkPicture> pict(SkPicture::CreateFromStream(&istream)); | 1481 SkAutoTUnref<SkPicture> pict(SkPicture::CreateFromStream(&istream)); |
1482 if (pict.get() != NULL) { | 1482 if (pict.get() != NULL) { |
1483 orig->drawPicture(*pict.get()); | 1483 orig->drawPicture(pict.get()); |
1484 } | 1484 } |
1485 } else { | 1485 } else { |
1486 picture->draw(orig); | 1486 picture->draw(orig); |
1487 } | 1487 } |
1488 } | 1488 } |
1489 | 1489 |
1490 // Do this after presentGL and other finishing, rather than in afterChild | 1490 // Do this after presentGL and other finishing, rather than in afterChild |
1491 if (fMeasureFPS && fMeasureFPS_StartTime) { | 1491 if (fMeasureFPS && fMeasureFPS_StartTime) { |
1492 fMeasureFPS_Time += SkTime::GetMSecs() - fMeasureFPS_StartTime; | 1492 fMeasureFPS_Time += SkTime::GetMSecs() - fMeasureFPS_StartTime; |
1493 } | 1493 } |
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2526 SkGraphics::Init(); | 2526 SkGraphics::Init(); |
2527 SkEvent::Init(); | 2527 SkEvent::Init(); |
2528 } | 2528 } |
2529 | 2529 |
2530 // FIXME: this should be in a header | 2530 // FIXME: this should be in a header |
2531 void application_term(); | 2531 void application_term(); |
2532 void application_term() { | 2532 void application_term() { |
2533 SkEvent::Term(); | 2533 SkEvent::Term(); |
2534 SkGraphics::Term(); | 2534 SkGraphics::Term(); |
2535 } | 2535 } |
OLD | NEW |