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 "OverView.h" | 10 #include "OverView.h" |
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1352 if (!bmp.isNull()) { | 1352 if (!bmp.isNull()) { |
1353 static int gSampleGrabCounter; | 1353 static int gSampleGrabCounter; |
1354 SkString name; | 1354 SkString name; |
1355 name.printf("sample_grab_%d.png", gSampleGrabCounter++); | 1355 name.printf("sample_grab_%d.png", gSampleGrabCounter++); |
1356 SkImageEncoder::EncodeFile(name.c_str(), bmp, | 1356 SkImageEncoder::EncodeFile(name.c_str(), bmp, |
1357 SkImageEncoder::kPNG_Type, 100); | 1357 SkImageEncoder::kPNG_Type, 100); |
1358 } | 1358 } |
1359 } | 1359 } |
1360 | 1360 |
1361 if (kPicture_DeviceType == fDeviceType) { | 1361 if (kPicture_DeviceType == fDeviceType) { |
1362 SkAutoTUnref<SkPicture> picture(fRecorder.endRecording()); | 1362 SkAutoTUnref<const SkPicture> picture(fRecorder.endRecording()); |
1363 | 1363 |
1364 if (true) { | 1364 if (true) { |
1365 SkPicture* pict = new SkPicture(*picture); | |
1366 this->installDrawFilter(orig); | 1365 this->installDrawFilter(orig); |
1367 orig->drawPicture(pict); | 1366 orig->drawPicture(picture); |
1368 pict->unref(); | |
1369 } else if (true) { | 1367 } else if (true) { |
1370 SkDynamicMemoryWStream ostream; | 1368 SkDynamicMemoryWStream ostream; |
1371 picture->serialize(&ostream); | 1369 picture->serialize(&ostream); |
1372 | 1370 |
1373 SkAutoDataUnref data(ostream.copyToData()); | 1371 SkAutoDataUnref data(ostream.copyToData()); |
1374 SkMemoryStream istream(data->data(), data->size()); | 1372 SkMemoryStream istream(data->data(), data->size()); |
1375 SkAutoTUnref<SkPicture> pict(SkPicture::CreateFromStream(&istream)); | 1373 SkAutoTUnref<SkPicture> pict(SkPicture::CreateFromStream(&istream)); |
1376 if (pict.get() != NULL) { | 1374 if (pict.get() != NULL) { |
1377 orig->drawPicture(pict.get()); | 1375 orig->drawPicture(pict.get()); |
1378 } | 1376 } |
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2401 SkGraphics::Init(); | 2399 SkGraphics::Init(); |
2402 SkEvent::Init(); | 2400 SkEvent::Init(); |
2403 } | 2401 } |
2404 | 2402 |
2405 // FIXME: this should be in a header | 2403 // FIXME: this should be in a header |
2406 void application_term(); | 2404 void application_term(); |
2407 void application_term() { | 2405 void application_term() { |
2408 SkEvent::Term(); | 2406 SkEvent::Term(); |
2409 SkGraphics::Term(); | 2407 SkGraphics::Term(); |
2410 } | 2408 } |
OLD | NEW |