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

Side by Side Diff: gm/gmmain.cpp

Issue 238273012: Staged removal of SkPicture-derived classes (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: have SkPicture only friend SkPictureRecorder once Created 6 years, 8 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 | « gm/distantclip.cpp ('k') | gm/optimizations.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 7
8 /* 8 /*
9 * Code for the "gm" (Golden Master) rendering comparison tool. 9 * Code for the "gm" (Golden Master) rendering comparison tool.
10 * 10 *
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 RecordTestResults(errors, shortNamePlusConfig, renderModeDescriptor); 1007 RecordTestResults(errors, shortNamePlusConfig, renderModeDescriptor);
1008 1008
1009 return errors; 1009 return errors;
1010 } 1010 }
1011 1011
1012 static SkPicture* generate_new_picture(GM* gm, BbhType bbhType, uint32_t rec ordFlags, 1012 static SkPicture* generate_new_picture(GM* gm, BbhType bbhType, uint32_t rec ordFlags,
1013 SkScalar scale = SK_Scalar1) { 1013 SkScalar scale = SK_Scalar1) {
1014 int width = SkScalarCeilToInt(SkScalarMul(SkIntToScalar(gm->getISize().w idth()), scale)); 1014 int width = SkScalarCeilToInt(SkScalarMul(SkIntToScalar(gm->getISize().w idth()), scale));
1015 int height = SkScalarCeilToInt(SkScalarMul(SkIntToScalar(gm->getISize(). height()), scale)); 1015 int height = SkScalarCeilToInt(SkScalarMul(SkIntToScalar(gm->getISize(). height()), scale));
1016 1016
1017 SkAutoTUnref<SkPictureFactory> factory; 1017 SkAutoTDelete<SkBBHFactory> factory;
1018 if (kTileGrid_BbhType == bbhType) { 1018 if (kTileGrid_BbhType == bbhType) {
1019 SkTileGridPicture::TileGridInfo info; 1019 SkTileGridFactory::TileGridInfo info;
1020 info.fMargin.setEmpty(); 1020 info.fMargin.setEmpty();
1021 info.fOffset.setZero(); 1021 info.fOffset.setZero();
1022 info.fTileInterval.set(16, 16); 1022 info.fTileInterval.set(16, 16);
1023 factory.reset(SkNEW_ARGS(SkTileGridPictureFactory, (info))); 1023 factory.reset(SkNEW_ARGS(SkTileGridFactory, (info)));
1024 } else if (kQuadTree_BbhType == bbhType) { 1024 } else if (kQuadTree_BbhType == bbhType) {
1025 factory.reset(SkNEW(SkQuadTreePictureFactory)); 1025 factory.reset(SkNEW(SkQuadTreeFactory));
1026 } else if (kRTree_BbhType == bbhType) { 1026 } else if (kRTree_BbhType == bbhType) {
1027 factory.reset(SkNEW(SkRTreePictureFactory)); 1027 factory.reset(SkNEW(SkRTreeFactory));
1028 } 1028 }
1029 SkPictureRecorder recorder(factory); 1029 SkPictureRecorder recorder;
1030 SkCanvas* cv = recorder.beginRecording(width, height, recordFlags); 1030 SkCanvas* cv = recorder.beginRecording(width, height, factory.get(), rec ordFlags);
1031 cv->scale(scale, scale); 1031 cv->scale(scale, scale);
1032 invokeGM(gm, cv, false, false); 1032 invokeGM(gm, cv, false, false);
1033 return recorder.endRecording(); 1033 return recorder.endRecording();
1034 } 1034 }
1035 1035
1036 static SkPicture* stream_to_new_picture(const SkPicture& src) { 1036 static SkPicture* stream_to_new_picture(const SkPicture& src) {
1037 SkDynamicMemoryWStream storage; 1037 SkDynamicMemoryWStream storage;
1038 src.serialize(&storage, NULL); 1038 src.serialize(&storage, NULL);
1039 SkAutoTUnref<SkStreamAsset> pictReadback(storage.detachAsStream()); 1039 SkAutoTUnref<SkStreamAsset> pictReadback(storage.detachAsStream());
1040 SkPicture* retval = SkPicture::CreateFromStream(pictReadback, 1040 SkPicture* retval = SkPicture::CreateFromStream(pictReadback,
(...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after
2457 if (FLAGS_forceBWtext) { 2457 if (FLAGS_forceBWtext) {
2458 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); 2458 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref();
2459 } 2459 }
2460 } 2460 }
2461 2461
2462 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 2462 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
2463 int main(int argc, char * const argv[]) { 2463 int main(int argc, char * const argv[]) {
2464 return tool_main(argc, (char**) argv); 2464 return tool_main(argc, (char**) argv);
2465 } 2465 }
2466 #endif 2466 #endif
OLDNEW
« no previous file with comments | « gm/distantclip.cpp ('k') | gm/optimizations.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698