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

Side by Side Diff: tools/PictureRenderer.h

Issue 377623002: Split SkPicturePlayback out of SkPictureData (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add virtual dtor for SkPicturePlayback Created 6 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
« no previous file with comments | « tools/CopyTilesRenderer.cpp ('k') | tools/PictureRenderer.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 2012 Google Inc. 2 * Copyright 2012 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 #ifndef PictureRenderer_DEFINED 8 #ifndef PictureRenderer_DEFINED
9 #define PictureRenderer_DEFINED 9 #define PictureRenderer_DEFINED
10 10
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 * 83 *
84 * @param pict The SkPicture to render. 84 * @param pict The SkPicture to render.
85 * @param writePath The output directory within which this renderer should w rite all images, 85 * @param writePath The output directory within which this renderer should w rite all images,
86 * or NULL if this renderer should not write all images. 86 * or NULL if this renderer should not write all images.
87 * @param mismatchPath The output directory within which this renderer shoul d write any images 87 * @param mismatchPath The output directory within which this renderer shoul d write any images
88 * which do not match expectations, or NULL if this renderer should not write mismatches. 88 * which do not match expectations, or NULL if this renderer should not write mismatches.
89 * @param inputFilename The name of the input file we are rendering. 89 * @param inputFilename The name of the input file we are rendering.
90 * @param useChecksumBasedFilenames Whether to use checksum-based filenames when writing 90 * @param useChecksumBasedFilenames Whether to use checksum-based filenames when writing
91 * bitmap images to disk. 91 * bitmap images to disk.
92 */ 92 */
93 virtual void init(SkPicture* pict, const SkString* writePath, const SkString * mismatchPath, 93 virtual void init(const SkPicture* pict,
94 const SkString* inputFilename, bool useChecksumBasedFilena mes); 94 const SkString* writePath,
95 const SkString* mismatchPath,
96 const SkString* inputFilename,
97 bool useChecksumBasedFilenames);
95 98
96 /** 99 /**
97 * TODO(epoger): Temporary hack, while we work on http://skbug.com/2584 ('be nch_pictures is 100 * TODO(epoger): Temporary hack, while we work on http://skbug.com/2584 ('be nch_pictures is
98 * timing reading pixels and writing json files'), such that: 101 * timing reading pixels and writing json files'), such that:
99 * - render_pictures can call this method and continue to work 102 * - render_pictures can call this method and continue to work
100 * - any other callers (bench_pictures) will skip calls to write() by defaul t 103 * - any other callers (bench_pictures) will skip calls to write() by defaul t
101 */ 104 */
102 void enableWrites() { fEnableWrites = true; } 105 void enableWrites() { fEnableWrites = true; }
103 106
104 /** 107 /**
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 402
400 GrContext* getGrContext() { 403 GrContext* getGrContext() {
401 return fGrContext; 404 return fGrContext;
402 } 405 }
403 #endif 406 #endif
404 407
405 SkCanvas* getCanvas() { 408 SkCanvas* getCanvas() {
406 return fCanvas; 409 return fCanvas;
407 } 410 }
408 411
409 SkPicture* getPicture() { 412 const SkPicture* getPicture() {
410 return fPicture; 413 return fPicture;
411 } 414 }
412 415
413 PictureRenderer() 416 PictureRenderer()
414 : fJsonSummaryPtr(NULL) 417 : fJsonSummaryPtr(NULL)
415 , fDeviceType(kBitmap_DeviceType) 418 , fDeviceType(kBitmap_DeviceType)
416 , fEnableWrites(false) 419 , fEnableWrites(false)
417 , fBBoxHierarchyType(kNone_BBoxHierarchyType) 420 , fBBoxHierarchyType(kNone_BBoxHierarchyType)
418 , fScaleFactor(SK_Scalar1) 421 , fScaleFactor(SK_Scalar1)
419 #if SK_SUPPORT_GPU 422 #if SK_SUPPORT_GPU
420 , fGrContext(NULL) 423 , fGrContext(NULL)
421 , fSampleCount(0) 424 , fSampleCount(0)
422 #endif 425 #endif
423 { 426 {
424 fGridInfo.fMargin.setEmpty(); 427 fGridInfo.fMargin.setEmpty();
425 fGridInfo.fOffset.setZero(); 428 fGridInfo.fOffset.setZero();
426 fGridInfo.fTileInterval.set(1, 1); 429 fGridInfo.fTileInterval.set(1, 1);
427 sk_bzero(fDrawFilters, sizeof(fDrawFilters)); 430 sk_bzero(fDrawFilters, sizeof(fDrawFilters));
428 fViewport.set(0, 0); 431 fViewport.set(0, 0);
429 } 432 }
430 433
431 #if SK_SUPPORT_GPU 434 #if SK_SUPPORT_GPU
432 virtual ~PictureRenderer() { 435 virtual ~PictureRenderer() {
433 SkSafeUnref(fGrContext); 436 SkSafeUnref(fGrContext);
434 } 437 }
435 #endif 438 #endif
436 439
437 protected: 440 protected:
438 SkAutoTUnref<SkCanvas> fCanvas; 441 SkAutoTUnref<SkCanvas> fCanvas;
439 SkAutoTUnref<SkPicture> fPicture; 442 SkAutoTUnref<const SkPicture> fPicture;
440 bool fUseChecksumBasedFilenames; 443 bool fUseChecksumBasedFilenames;
441 ImageResultsAndExpectations* fJsonSummaryPtr; 444 ImageResultsAndExpectations* fJsonSummaryPtr;
442 SkDeviceTypes fDeviceType; 445 SkDeviceTypes fDeviceType;
443 bool fEnableWrites; 446 bool fEnableWrites;
444 BBoxHierarchyType fBBoxHierarchyType; 447 BBoxHierarchyType fBBoxHierarchyType;
445 DrawFilterFlags fDrawFilters[SkDrawFilter::kTypeCount]; 448 DrawFilterFlags fDrawFilters[SkDrawFilter::kTypeCount];
446 SkString fDrawFiltersConfig; 449 SkString fDrawFiltersConfig;
447 SkString fWritePath; 450 SkString fWritePath;
448 SkString fMismatchPath; 451 SkString fMismatchPath;
449 SkString fInputFilename; 452 SkString fInputFilename;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE; 518 virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE;
516 519
517 private: 520 private:
518 virtual SkString getConfigNameInternal() SK_OVERRIDE; 521 virtual SkString getConfigNameInternal() SK_OVERRIDE;
519 522
520 typedef PictureRenderer INHERITED; 523 typedef PictureRenderer INHERITED;
521 }; 524 };
522 525
523 class SimplePictureRenderer : public PictureRenderer { 526 class SimplePictureRenderer : public PictureRenderer {
524 public: 527 public:
525 virtual void init(SkPicture* pict, const SkString* writePath, const SkString * mismatchPath, 528 virtual void init(const SkPicture* pict,
526 const SkString* inputFilename, bool useChecksumBasedFilena mes) SK_OVERRIDE; 529 const SkString* writePath,
530 const SkString* mismatchPath,
531 const SkString* inputFilename,
532 bool useChecksumBasedFilenames) SK_OVERRIDE;
527 533
528 virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE; 534 virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE;
529 535
530 private: 536 private:
531 virtual SkString getConfigNameInternal() SK_OVERRIDE; 537 virtual SkString getConfigNameInternal() SK_OVERRIDE;
532 538
533 typedef PictureRenderer INHERITED; 539 typedef PictureRenderer INHERITED;
534 }; 540 };
535 541
536 class TiledPictureRenderer : public PictureRenderer { 542 class TiledPictureRenderer : public PictureRenderer {
537 public: 543 public:
538 TiledPictureRenderer(); 544 TiledPictureRenderer();
539 545
540 virtual void init(SkPicture* pict, const SkString* writePath, const SkString * mismatchPath, 546 virtual void init(const SkPicture* pict,
541 const SkString* inputFilename, bool useChecksumBasedFilena mes) SK_OVERRIDE; 547 const SkString* writePath,
548 const SkString* mismatchPath,
549 const SkString* inputFilename,
550 bool useChecksumBasedFilenames) SK_OVERRIDE;
542 551
543 /** 552 /**
544 * Renders to tiles, rather than a single canvas. 553 * Renders to tiles, rather than a single canvas.
545 * If fWritePath was provided, a separate file is 554 * If fWritePath was provided, a separate file is
546 * created for each tile, named "path0.png", "path1.png", etc. 555 * created for each tile, named "path0.png", "path1.png", etc.
547 */ 556 */
548 virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE; 557 virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE;
549 558
550 virtual void end() SK_OVERRIDE; 559 virtual void end() SK_OVERRIDE;
551 560
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 virtual SkString getConfigNameInternal() SK_OVERRIDE; 682 virtual SkString getConfigNameInternal() SK_OVERRIDE;
674 683
675 typedef PictureRenderer INHERITED; 684 typedef PictureRenderer INHERITED;
676 }; 685 };
677 686
678 extern PictureRenderer* CreateGatherPixelRefsRenderer(); 687 extern PictureRenderer* CreateGatherPixelRefsRenderer();
679 688
680 } 689 }
681 690
682 #endif // PictureRenderer_DEFINED 691 #endif // PictureRenderer_DEFINED
OLDNEW
« no previous file with comments | « tools/CopyTilesRenderer.cpp ('k') | tools/PictureRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698