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

Side by Side Diff: tools/PictureRenderer.h

Issue 1158433006: Store context options on caps. (Closed) Base URL: https://skia.googlesource.com/skia.git@onecaps
Patch Set: remove case statement accidentally checked in Created 5 years, 7 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 10 matching lines...) Expand all
21 #include "SkTDArray.h" 21 #include "SkTDArray.h"
22 #include "SkTypes.h" 22 #include "SkTypes.h"
23 23
24 #if SK_SUPPORT_GPU 24 #if SK_SUPPORT_GPU
25 #include "GrContextFactory.h" 25 #include "GrContextFactory.h"
26 #include "GrContext.h" 26 #include "GrContext.h"
27 #endif 27 #endif
28 28
29 #include "image_expectations.h" 29 #include "image_expectations.h"
30 30
31 struct GrContextOptions;
31 class SkBitmap; 32 class SkBitmap;
32 class SkCanvas; 33 class SkCanvas;
33 class SkGLContext; 34 class SkGLContext;
34 class SkThread; 35 class SkThread;
35 36
36 namespace sk_tools { 37 namespace sk_tools {
37 38
38 class TiledPictureRenderer; 39 class TiledPictureRenderer;
39 40
40 class PictureRenderer : public SkRefCnt { 41 class PictureRenderer : public SkRefCnt {
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 default: 386 default:
386 return NULL; 387 return NULL;
387 } 388 }
388 return fGrContextFactory.getGLContext(glContextType); 389 return fGrContextFactory.getGLContext(glContextType);
389 } 390 }
390 391
391 GrContext* getGrContext() { 392 GrContext* getGrContext() {
392 return fGrContext; 393 return fGrContext;
393 } 394 }
394 395
395 const GrContext::Options& getGrContextOptions() { 396 const GrContextOptions& getGrContextOptions() {
396 return fGrContextFactory.getGlobalOptions(); 397 return fGrContextFactory.getGlobalOptions();
397 } 398 }
398 #endif 399 #endif
399 400
400 SkCanvas* getCanvas() { 401 SkCanvas* getCanvas() {
401 return fCanvas; 402 return fCanvas;
402 } 403 }
403 404
404 const SkPicture* getPicture() { 405 const SkPicture* getPicture() {
405 return fPicture; 406 return fPicture;
406 } 407 }
407 408
408 #if SK_SUPPORT_GPU 409 #if SK_SUPPORT_GPU
409 explicit PictureRenderer(const GrContext::Options &opts) 410 explicit PictureRenderer(const GrContextOptions &opts)
410 #else 411 #else
411 PictureRenderer() 412 PictureRenderer()
412 #endif 413 #endif
413 : fJsonSummaryPtr(NULL) 414 : fJsonSummaryPtr(NULL)
414 , fDeviceType(kBitmap_DeviceType) 415 , fDeviceType(kBitmap_DeviceType)
415 , fEnableWrites(false) 416 , fEnableWrites(false)
416 , fBBoxHierarchyType(kNone_BBoxHierarchyType) 417 , fBBoxHierarchyType(kNone_BBoxHierarchyType)
417 , fScaleFactor(SK_Scalar1) 418 , fScaleFactor(SK_Scalar1)
418 #if SK_SUPPORT_GPU 419 #if SK_SUPPORT_GPU
419 , fGrContextFactory(opts) 420 , fGrContextFactory(opts)
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 typedef SkRefCnt INHERITED; 492 typedef SkRefCnt INHERITED;
492 }; 493 };
493 494
494 /** 495 /**
495 * This class does not do any rendering, but its render function executes record ing, which we want 496 * This class does not do any rendering, but its render function executes record ing, which we want
496 * to time. 497 * to time.
497 */ 498 */
498 class RecordPictureRenderer : public PictureRenderer { 499 class RecordPictureRenderer : public PictureRenderer {
499 public: 500 public:
500 #if SK_SUPPORT_GPU 501 #if SK_SUPPORT_GPU
501 RecordPictureRenderer(const GrContext::Options &opts) : INHERITED(opts) { } 502 RecordPictureRenderer(const GrContextOptions &opts) : INHERITED(opts) { }
502 #endif 503 #endif
503 504
504 bool render(SkBitmap** out = NULL) override; 505 bool render(SkBitmap** out = NULL) override;
505 506
506 SkString getPerIterTimeFormat() override { return SkString("%.4f"); } 507 SkString getPerIterTimeFormat() override { return SkString("%.4f"); }
507 508
508 SkString getNormalTimeFormat() override { return SkString("%6.4f"); } 509 SkString getNormalTimeFormat() override { return SkString("%6.4f"); }
509 510
510 protected: 511 protected:
511 SkCanvas* setupCanvas(int width, int height) override; 512 SkCanvas* setupCanvas(int width, int height) override;
512 513
513 private: 514 private:
514 SkString getConfigNameInternal() override; 515 SkString getConfigNameInternal() override;
515 516
516 typedef PictureRenderer INHERITED; 517 typedef PictureRenderer INHERITED;
517 }; 518 };
518 519
519 class PipePictureRenderer : public PictureRenderer { 520 class PipePictureRenderer : public PictureRenderer {
520 public: 521 public:
521 #if SK_SUPPORT_GPU 522 #if SK_SUPPORT_GPU
522 PipePictureRenderer(const GrContext::Options &opts) : INHERITED(opts) { } 523 PipePictureRenderer(const GrContextOptions &opts) : INHERITED(opts) { }
523 #endif 524 #endif
524 525
525 bool render(SkBitmap** out = NULL) override; 526 bool render(SkBitmap** out = NULL) override;
526 527
527 private: 528 private:
528 SkString getConfigNameInternal() override; 529 SkString getConfigNameInternal() override;
529 530
530 typedef PictureRenderer INHERITED; 531 typedef PictureRenderer INHERITED;
531 }; 532 };
532 533
533 class SimplePictureRenderer : public PictureRenderer { 534 class SimplePictureRenderer : public PictureRenderer {
534 public: 535 public:
535 #if SK_SUPPORT_GPU 536 #if SK_SUPPORT_GPU
536 SimplePictureRenderer(const GrContext::Options &opts) : INHERITED(opts) { } 537 SimplePictureRenderer(const GrContextOptions &opts) : INHERITED(opts) { }
537 #endif 538 #endif
538 539
539 virtual void init(const SkPicture* pict, 540 virtual void init(const SkPicture* pict,
540 const SkString* writePath, 541 const SkString* writePath,
541 const SkString* mismatchPath, 542 const SkString* mismatchPath,
542 const SkString* inputFilename, 543 const SkString* inputFilename,
543 bool useChecksumBasedFilenames, 544 bool useChecksumBasedFilenames,
544 bool useMultiPictureDraw) override; 545 bool useMultiPictureDraw) override;
545 546
546 bool render(SkBitmap** out = NULL) override; 547 bool render(SkBitmap** out = NULL) override;
547 548
548 private: 549 private:
549 SkString getConfigNameInternal() override; 550 SkString getConfigNameInternal() override;
550 551
551 typedef PictureRenderer INHERITED; 552 typedef PictureRenderer INHERITED;
552 }; 553 };
553 554
554 class TiledPictureRenderer : public PictureRenderer { 555 class TiledPictureRenderer : public PictureRenderer {
555 public: 556 public:
556 #if SK_SUPPORT_GPU 557 #if SK_SUPPORT_GPU
557 TiledPictureRenderer(const GrContext::Options &opts); 558 TiledPictureRenderer(const GrContextOptions &opts);
558 #else 559 #else
559 TiledPictureRenderer(); 560 TiledPictureRenderer();
560 #endif 561 #endif
561 562
562 virtual void init(const SkPicture* pict, 563 virtual void init(const SkPicture* pict,
563 const SkString* writePath, 564 const SkString* writePath,
564 const SkString* mismatchPath, 565 const SkString* mismatchPath,
565 const SkString* inputFilename, 566 const SkString* inputFilename,
566 bool useChecksumBasedFilenames, 567 bool useChecksumBasedFilenames,
567 bool useMultiPictureDraw) override; 568 bool useMultiPictureDraw) override;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 typedef PictureRenderer INHERITED; 683 typedef PictureRenderer INHERITED;
683 }; 684 };
684 685
685 /** 686 /**
686 * This class does not do any rendering, but its render function executes turnin g an SkPictureRecord 687 * This class does not do any rendering, but its render function executes turnin g an SkPictureRecord
687 * into an SkPicturePlayback, which we want to time. 688 * into an SkPicturePlayback, which we want to time.
688 */ 689 */
689 class PlaybackCreationRenderer : public PictureRenderer { 690 class PlaybackCreationRenderer : public PictureRenderer {
690 public: 691 public:
691 #if SK_SUPPORT_GPU 692 #if SK_SUPPORT_GPU
692 PlaybackCreationRenderer(const GrContext::Options &opts) : INHERITED(opts) { } 693 PlaybackCreationRenderer(const GrContextOptions &opts) : INHERITED(opts) { }
693 #endif 694 #endif
694 695
695 void setup() override; 696 void setup() override;
696 697
697 bool render(SkBitmap** out = NULL) override; 698 bool render(SkBitmap** out = NULL) override;
698 699
699 SkString getPerIterTimeFormat() override { return SkString("%.4f"); } 700 SkString getPerIterTimeFormat() override { return SkString("%.4f"); }
700 701
701 SkString getNormalTimeFormat() override { return SkString("%6.4f"); } 702 SkString getNormalTimeFormat() override { return SkString("%6.4f"); }
702 703
703 private: 704 private:
704 SkAutoTDelete<SkPictureRecorder> fRecorder; 705 SkAutoTDelete<SkPictureRecorder> fRecorder;
705 706
706 SkString getConfigNameInternal() override; 707 SkString getConfigNameInternal() override;
707 708
708 typedef PictureRenderer INHERITED; 709 typedef PictureRenderer INHERITED;
709 }; 710 };
710 711
711 #if SK_SUPPORT_GPU 712 #if SK_SUPPORT_GPU
712 extern PictureRenderer* CreateGatherPixelRefsRenderer(const GrContext::Options& opts); 713 extern PictureRenderer* CreateGatherPixelRefsRenderer(const GrContextOptions& op ts);
713 #else 714 #else
714 extern PictureRenderer* CreateGatherPixelRefsRenderer(); 715 extern PictureRenderer* CreateGatherPixelRefsRenderer();
715 #endif 716 #endif
716 717
717 } 718 }
718 719
719 #endif // PictureRenderer_DEFINED 720 #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