Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: samplecode/SampleApp.cpp

Issue 17113004: Replace SkPicture(SkStream) constructors with a factory. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Remove a change in behavior Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/core/SkPicture.h ('k') | samplecode/SamplePictFile.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 this->installDrawFilter(orig); 1372 this->installDrawFilter(orig);
1373 orig->drawPicture(*pict); 1373 orig->drawPicture(*pict);
1374 pict->unref(); 1374 pict->unref();
1375 } else if (true) { 1375 } else if (true) {
1376 SkDynamicMemoryWStream ostream; 1376 SkDynamicMemoryWStream ostream;
1377 fPicture->serialize(&ostream); 1377 fPicture->serialize(&ostream);
1378 fPicture->unref(); 1378 fPicture->unref();
1379 1379
1380 SkAutoDataUnref data(ostream.copyToData()); 1380 SkAutoDataUnref data(ostream.copyToData());
1381 SkMemoryStream istream(data->data(), data->size()); 1381 SkMemoryStream istream(data->data(), data->size());
1382 SkPicture pict(&istream); 1382 SkAutoTUnref<SkPicture> pict(SkPicture::CreateFromStream(&istream));
1383 orig->drawPicture(pict); 1383 if (pict.get() != NULL) {
1384 orig->drawPicture(*pict.get());
1385 }
1384 } else { 1386 } else {
1385 fPicture->draw(orig); 1387 fPicture->draw(orig);
1386 fPicture->unref(); 1388 fPicture->unref();
1387 } 1389 }
1388 fPicture = NULL; 1390 fPicture = NULL;
1389 } 1391 }
1390 1392
1391 // Do this after presentGL and other finishing, rather than in afterChild 1393 // Do this after presentGL and other finishing, rather than in afterChild
1392 if (fMeasureFPS && fMeasureFPS_StartTime) { 1394 if (fMeasureFPS && fMeasureFPS_StartTime) {
1393 fMeasureFPS_Time += SkTime::GetMSecs() - fMeasureFPS_StartTime; 1395 fMeasureFPS_Time += SkTime::GetMSecs() - fMeasureFPS_StartTime;
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after
2468 SkGraphics::Init(); 2470 SkGraphics::Init();
2469 SkEvent::Init(); 2471 SkEvent::Init();
2470 } 2472 }
2471 2473
2472 // FIXME: this should be in a header 2474 // FIXME: this should be in a header
2473 void application_term(); 2475 void application_term();
2474 void application_term() { 2476 void application_term() {
2475 SkEvent::Term(); 2477 SkEvent::Term();
2476 SkGraphics::Term(); 2478 SkGraphics::Term();
2477 } 2479 }
OLDNEW
« no previous file with comments | « include/core/SkPicture.h ('k') | samplecode/SamplePictFile.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698