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

Side by Side Diff: tools/PictureRenderer.h

Issue 464423003: Add flag to bench/render pictures (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 #endif 396 #endif
397 default: 397 default:
398 return NULL; 398 return NULL;
399 } 399 }
400 return fGrContextFactory.getGLContext(glContextType); 400 return fGrContextFactory.getGLContext(glContextType);
401 } 401 }
402 402
403 GrContext* getGrContext() { 403 GrContext* getGrContext() {
404 return fGrContext; 404 return fGrContext;
405 } 405 }
406
407 const GrContext::Options& getGrContextOptions() {
408 return fGrContextFactory.getGlobalOptions();
409 }
406 #endif 410 #endif
407 411
408 SkCanvas* getCanvas() { 412 SkCanvas* getCanvas() {
409 return fCanvas; 413 return fCanvas;
410 } 414 }
411 415
412 const SkPicture* getPicture() { 416 const SkPicture* getPicture() {
413 return fPicture; 417 return fPicture;
414 } 418 }
415 419
420 #if SK_SUPPORT_GPU
421 explicit PictureRenderer(const GrContext::Options &opts)
422 #else
416 PictureRenderer() 423 PictureRenderer()
424 #endif
417 : fJsonSummaryPtr(NULL) 425 : fJsonSummaryPtr(NULL)
418 , fDeviceType(kBitmap_DeviceType) 426 , fDeviceType(kBitmap_DeviceType)
419 , fEnableWrites(false) 427 , fEnableWrites(false)
420 , fBBoxHierarchyType(kNone_BBoxHierarchyType) 428 , fBBoxHierarchyType(kNone_BBoxHierarchyType)
421 , fScaleFactor(SK_Scalar1) 429 , fScaleFactor(SK_Scalar1)
422 #if SK_SUPPORT_GPU 430 #if SK_SUPPORT_GPU
431 , fGrContextFactory(opts)
423 , fGrContext(NULL) 432 , fGrContext(NULL)
424 , fSampleCount(0) 433 , fSampleCount(0)
425 #endif 434 #endif
426 { 435 {
427 fGridInfo.fMargin.setEmpty(); 436 fGridInfo.fMargin.setEmpty();
428 fGridInfo.fOffset.setZero(); 437 fGridInfo.fOffset.setZero();
429 fGridInfo.fTileInterval.set(1, 1); 438 fGridInfo.fTileInterval.set(1, 1);
430 sk_bzero(fDrawFilters, sizeof(fDrawFilters)); 439 sk_bzero(fDrawFilters, sizeof(fDrawFilters));
431 fViewport.set(0, 0); 440 fViewport.set(0, 0);
432 } 441 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 virtual SkString getConfigNameInternal() = 0; 502 virtual SkString getConfigNameInternal() = 0;
494 503
495 typedef SkRefCnt INHERITED; 504 typedef SkRefCnt INHERITED;
496 }; 505 };
497 506
498 /** 507 /**
499 * This class does not do any rendering, but its render function executes record ing, which we want 508 * This class does not do any rendering, but its render function executes record ing, which we want
500 * to time. 509 * to time.
501 */ 510 */
502 class RecordPictureRenderer : public PictureRenderer { 511 class RecordPictureRenderer : public PictureRenderer {
512 public:
513 #if SK_SUPPORT_GPU
514 RecordPictureRenderer(const GrContext::Options &opts) : INHERITED(opts) { }
515 #endif
516
503 virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE; 517 virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE;
504 518
505 virtual SkString getPerIterTimeFormat() SK_OVERRIDE { return SkString("%.4f" ); } 519 virtual SkString getPerIterTimeFormat() SK_OVERRIDE { return SkString("%.4f" ); }
506 520
507 virtual SkString getNormalTimeFormat() SK_OVERRIDE { return SkString("%6.4f" ); } 521 virtual SkString getNormalTimeFormat() SK_OVERRIDE { return SkString("%6.4f" ); }
508 522
509 protected: 523 protected:
510 virtual SkCanvas* setupCanvas(int width, int height) SK_OVERRIDE; 524 virtual SkCanvas* setupCanvas(int width, int height) SK_OVERRIDE;
511 525
512 private: 526 private:
513 virtual SkString getConfigNameInternal() SK_OVERRIDE; 527 virtual SkString getConfigNameInternal() SK_OVERRIDE;
528
529 typedef PictureRenderer INHERITED;
514 }; 530 };
515 531
516 class PipePictureRenderer : public PictureRenderer { 532 class PipePictureRenderer : public PictureRenderer {
517 public: 533 public:
534 #if SK_SUPPORT_GPU
535 PipePictureRenderer(const GrContext::Options &opts) : INHERITED(opts) { }
536 #endif
537
518 virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE; 538 virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE;
519 539
520 private: 540 private:
521 virtual SkString getConfigNameInternal() SK_OVERRIDE; 541 virtual SkString getConfigNameInternal() SK_OVERRIDE;
522 542
523 typedef PictureRenderer INHERITED; 543 typedef PictureRenderer INHERITED;
524 }; 544 };
525 545
526 class SimplePictureRenderer : public PictureRenderer { 546 class SimplePictureRenderer : public PictureRenderer {
527 public: 547 public:
548 #if SK_SUPPORT_GPU
549 SimplePictureRenderer(const GrContext::Options &opts) : INHERITED(opts) { }
550 #endif
551
528 virtual void init(const SkPicture* pict, 552 virtual void init(const SkPicture* pict,
529 const SkString* writePath, 553 const SkString* writePath,
530 const SkString* mismatchPath, 554 const SkString* mismatchPath,
531 const SkString* inputFilename, 555 const SkString* inputFilename,
532 bool useChecksumBasedFilenames) SK_OVERRIDE; 556 bool useChecksumBasedFilenames) SK_OVERRIDE;
533 557
534 virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE; 558 virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE;
535 559
536 private: 560 private:
537 virtual SkString getConfigNameInternal() SK_OVERRIDE; 561 virtual SkString getConfigNameInternal() SK_OVERRIDE;
538 562
539 typedef PictureRenderer INHERITED; 563 typedef PictureRenderer INHERITED;
540 }; 564 };
541 565
542 class TiledPictureRenderer : public PictureRenderer { 566 class TiledPictureRenderer : public PictureRenderer {
543 public: 567 public:
568 #if SK_SUPPORT_GPU
569 TiledPictureRenderer(const GrContext::Options &opts);
570 #else
544 TiledPictureRenderer(); 571 TiledPictureRenderer();
572 #endif
545 573
546 virtual void init(const SkPicture* pict, 574 virtual void init(const SkPicture* pict,
547 const SkString* writePath, 575 const SkString* writePath,
548 const SkString* mismatchPath, 576 const SkString* mismatchPath,
549 const SkString* inputFilename, 577 const SkString* inputFilename,
550 bool useChecksumBasedFilenames) SK_OVERRIDE; 578 bool useChecksumBasedFilenames) SK_OVERRIDE;
551 579
552 /** 580 /**
553 * Renders to tiles, rather than a single canvas. 581 * Renders to tiles, rather than a single canvas.
554 * If fWritePath was provided, a separate file is 582 * If fWritePath was provided, a separate file is
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 689
662 typedef PictureRenderer INHERITED; 690 typedef PictureRenderer INHERITED;
663 }; 691 };
664 692
665 /** 693 /**
666 * This class does not do any rendering, but its render function executes turnin g an SkPictureRecord 694 * This class does not do any rendering, but its render function executes turnin g an SkPictureRecord
667 * into an SkPicturePlayback, which we want to time. 695 * into an SkPicturePlayback, which we want to time.
668 */ 696 */
669 class PlaybackCreationRenderer : public PictureRenderer { 697 class PlaybackCreationRenderer : public PictureRenderer {
670 public: 698 public:
699 #if SK_SUPPORT_GPU
700 PlaybackCreationRenderer(const GrContext::Options &opts) : INHERITED(opts) { }
701 #endif
702
671 virtual void setup() SK_OVERRIDE; 703 virtual void setup() SK_OVERRIDE;
672 704
673 virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE; 705 virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE;
674 706
675 virtual SkString getPerIterTimeFormat() SK_OVERRIDE { return SkString("%.4f" ); } 707 virtual SkString getPerIterTimeFormat() SK_OVERRIDE { return SkString("%.4f" ); }
676 708
677 virtual SkString getNormalTimeFormat() SK_OVERRIDE { return SkString("%6.4f" ); } 709 virtual SkString getNormalTimeFormat() SK_OVERRIDE { return SkString("%6.4f" ); }
678 710
679 private: 711 private:
680 SkAutoTDelete<SkPictureRecorder> fRecorder; 712 SkAutoTDelete<SkPictureRecorder> fRecorder;
681 713
682 virtual SkString getConfigNameInternal() SK_OVERRIDE; 714 virtual SkString getConfigNameInternal() SK_OVERRIDE;
683 715
684 typedef PictureRenderer INHERITED; 716 typedef PictureRenderer INHERITED;
685 }; 717 };
686 718
719 #if SK_SUPPORT_GPU
720 extern PictureRenderer* CreateGatherPixelRefsRenderer(const GrContext::Options& opts);
721 #else
687 extern PictureRenderer* CreateGatherPixelRefsRenderer(); 722 extern PictureRenderer* CreateGatherPixelRefsRenderer();
723 #endif
688 724
689 } 725 }
690 726
691 #endif // PictureRenderer_DEFINED 727 #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