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

Side by Side Diff: tools/PictureRenderer.cpp

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/PictureRenderer.h ('k') | tools/PictureRenderingFlags.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 #include "PictureRenderer.h" 8 #include "PictureRenderer.h"
9 #include "picture_utils.h" 9 #include "picture_utils.h"
10 #include "SamplePipeControllers.h" 10 #include "SamplePipeControllers.h"
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 return true; 437 return true;
438 } 438 }
439 } 439 }
440 440
441 SkString SimplePictureRenderer::getConfigNameInternal() { 441 SkString SimplePictureRenderer::getConfigNameInternal() {
442 return SkString("simple"); 442 return SkString("simple");
443 } 443 }
444 444
445 //////////////////////////////////////////////////////////////////////////////// /////////////// 445 //////////////////////////////////////////////////////////////////////////////// ///////////////
446 446
447 #if SK_SUPPORT_GPU
448 TiledPictureRenderer::TiledPictureRenderer(const GrContext::Options& opts)
449 : INHERITED(opts)
450 , fTileWidth(kDefaultTileWidth)
451 #else
447 TiledPictureRenderer::TiledPictureRenderer() 452 TiledPictureRenderer::TiledPictureRenderer()
448 : fTileWidth(kDefaultTileWidth) 453 : fTileWidth(kDefaultTileWidth)
454 #endif
449 , fTileHeight(kDefaultTileHeight) 455 , fTileHeight(kDefaultTileHeight)
450 , fTileWidthPercentage(0.0) 456 , fTileWidthPercentage(0.0)
451 , fTileHeightPercentage(0.0) 457 , fTileHeightPercentage(0.0)
452 , fTileMinPowerOf2Width(0) 458 , fTileMinPowerOf2Width(0)
453 , fCurrentTileOffset(-1) 459 , fCurrentTileOffset(-1)
454 , fTilesX(0) 460 , fTilesX(0)
455 , fTilesY(0) { } 461 , fTilesY(0) { }
456 462
457 void TiledPictureRenderer::init(const SkPicture* pict, const SkString* writePath , 463 void TiledPictureRenderer::init(const SkPicture* pict, const SkString* writePath ,
458 const SkString* mismatchPath, const SkString* in putFilename, 464 const SkString* mismatchPath, const SkString* in putFilename,
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 return SkNEW_ARGS(SkTileGridFactory, (fGridInfo)); 744 return SkNEW_ARGS(SkTileGridFactory, (fGridInfo));
739 } 745 }
740 SkASSERT(0); // invalid bbhType 746 SkASSERT(0); // invalid bbhType
741 return NULL; 747 return NULL;
742 } 748 }
743 749
744 /////////////////////////////////////////////////////////////////////////////// 750 ///////////////////////////////////////////////////////////////////////////////
745 751
746 class GatherRenderer : public PictureRenderer { 752 class GatherRenderer : public PictureRenderer {
747 public: 753 public:
754 #if SK_SUPPORT_GPU
755 GatherRenderer(const GrContext::Options& opts) : INHERITED(opts) { }
756 #endif
757
748 virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE { 758 virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE {
749 SkRect bounds = SkRect::MakeWH(SkIntToScalar(fPicture->width()), 759 SkRect bounds = SkRect::MakeWH(SkIntToScalar(fPicture->width()),
750 SkIntToScalar(fPicture->height())); 760 SkIntToScalar(fPicture->height()));
751 SkData* data = SkPictureUtils::GatherPixelRefs(fPicture, bounds); 761 SkData* data = SkPictureUtils::GatherPixelRefs(fPicture, bounds);
752 SkSafeUnref(data); 762 SkSafeUnref(data);
753 763
754 return (fWritePath.isEmpty()); // we don't have anything to write 764 return (fWritePath.isEmpty()); // we don't have anything to write
755 } 765 }
756 766
757 private: 767 private:
758 virtual SkString getConfigNameInternal() SK_OVERRIDE { 768 virtual SkString getConfigNameInternal() SK_OVERRIDE {
759 return SkString("gather_pixelrefs"); 769 return SkString("gather_pixelrefs");
760 } 770 }
771
772 typedef PictureRenderer INHERITED;
761 }; 773 };
762 774
775 #if SK_SUPPORT_GPU
776 PictureRenderer* CreateGatherPixelRefsRenderer(const GrContext::Options& opts) {
777 return SkNEW_ARGS(GatherRenderer, (opts));
778 }
779 #else
763 PictureRenderer* CreateGatherPixelRefsRenderer() { 780 PictureRenderer* CreateGatherPixelRefsRenderer() {
764 return SkNEW(GatherRenderer); 781 return SkNEW(GatherRenderer);
765 } 782 }
783 #endif
766 784
767 } // namespace sk_tools 785 } // namespace sk_tools
OLDNEW
« no previous file with comments | « tools/PictureRenderer.h ('k') | tools/PictureRenderingFlags.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698