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

Side by Side Diff: tools/PictureRenderer.h

Issue 500373005: Remove SkQuadTree. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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 | « tests/PictureTest.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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #endif 49 #endif
50 kBitmap_DeviceType, 50 kBitmap_DeviceType,
51 #if SK_SUPPORT_GPU 51 #if SK_SUPPORT_GPU
52 kGPU_DeviceType, 52 kGPU_DeviceType,
53 kNVPR_DeviceType, 53 kNVPR_DeviceType,
54 #endif 54 #endif
55 }; 55 };
56 56
57 enum BBoxHierarchyType { 57 enum BBoxHierarchyType {
58 kNone_BBoxHierarchyType = 0, 58 kNone_BBoxHierarchyType = 0,
59 kQuadTree_BBoxHierarchyType,
60 kRTree_BBoxHierarchyType, 59 kRTree_BBoxHierarchyType,
61 kTileGrid_BBoxHierarchyType, 60 kTileGrid_BBoxHierarchyType,
62 61
63 kLast_BBoxHierarchyType = kTileGrid_BBoxHierarchyType, 62 kLast_BBoxHierarchyType = kTileGrid_BBoxHierarchyType,
64 }; 63 };
65 64
66 // this uses SkPaint::Flags as a base and adds additional flags 65 // this uses SkPaint::Flags as a base and adds additional flags
67 enum DrawFilterFlags { 66 enum DrawFilterFlags {
68 kNone_DrawFilterFlag = 0, 67 kNone_DrawFilterFlag = 0,
69 kHinting_DrawFilterFlag = 0x10000, // toggles between no hinting and nor mal hinting 68 kHinting_DrawFilterFlag = 0x10000, // toggles between no hinting and nor mal hinting
(...skipping 13 matching lines...) Expand all
83 * 82 *
84 * @param pict The SkPicture to render. 83 * @param pict The SkPicture to render.
85 * @param writePath The output directory within which this renderer should w rite all images, 84 * @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. 85 * 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 86 * @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. 87 * 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. 88 * @param inputFilename The name of the input file we are rendering.
90 * @param useChecksumBasedFilenames Whether to use checksum-based filenames when writing 89 * @param useChecksumBasedFilenames Whether to use checksum-based filenames when writing
91 * bitmap images to disk. 90 * bitmap images to disk.
92 */ 91 */
93 virtual void init(const SkPicture* pict, 92 virtual void init(const SkPicture* pict,
94 const SkString* writePath, 93 const SkString* writePath,
95 const SkString* mismatchPath, 94 const SkString* mismatchPath,
96 const SkString* inputFilename, 95 const SkString* inputFilename,
97 bool useChecksumBasedFilenames); 96 bool useChecksumBasedFilenames);
98 97
99 /** 98 /**
100 * TODO(epoger): Temporary hack, while we work on http://skbug.com/2584 ('be nch_pictures is 99 * TODO(epoger): Temporary hack, while we work on http://skbug.com/2584 ('be nch_pictures is
101 * timing reading pixels and writing json files'), such that: 100 * timing reading pixels and writing json files'), such that:
102 * - render_pictures can call this method and continue to work 101 * - render_pictures can call this method and continue to work
103 * - any other callers (bench_pictures) will skip calls to write() by defaul t 102 * - any other callers (bench_pictures) will skip calls to write() by defaul t
104 */ 103 */
105 void enableWrites() { fEnableWrites = true; } 104 void enableWrites() { fEnableWrites = true; }
106 105
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 SkString getConfigName() { 253 SkString getConfigName() {
255 SkString config = this->getConfigNameInternal(); 254 SkString config = this->getConfigNameInternal();
256 if (!fViewport.isEmpty()) { 255 if (!fViewport.isEmpty()) {
257 config.appendf("_viewport_%ix%i", fViewport.width(), fViewport.heigh t()); 256 config.appendf("_viewport_%ix%i", fViewport.width(), fViewport.heigh t());
258 } 257 }
259 if (fScaleFactor != SK_Scalar1) { 258 if (fScaleFactor != SK_Scalar1) {
260 config.appendf("_scalar_%f", SkScalarToFloat(fScaleFactor)); 259 config.appendf("_scalar_%f", SkScalarToFloat(fScaleFactor));
261 } 260 }
262 if (kRTree_BBoxHierarchyType == fBBoxHierarchyType) { 261 if (kRTree_BBoxHierarchyType == fBBoxHierarchyType) {
263 config.append("_rtree"); 262 config.append("_rtree");
264 } else if (kQuadTree_BBoxHierarchyType == fBBoxHierarchyType) {
265 config.append("_quadtree");
266 } else if (kTileGrid_BBoxHierarchyType == fBBoxHierarchyType) { 263 } else if (kTileGrid_BBoxHierarchyType == fBBoxHierarchyType) {
267 config.append("_grid"); 264 config.append("_grid");
268 config.append("_"); 265 config.append("_");
269 config.appendS32(fGridInfo.fTileInterval.width()); 266 config.appendS32(fGridInfo.fTileInterval.width());
270 config.append("x"); 267 config.append("x");
271 config.appendS32(fGridInfo.fTileInterval.height()); 268 config.appendS32(fGridInfo.fTileInterval.height());
272 } 269 }
273 #if SK_SUPPORT_GPU 270 #if SK_SUPPORT_GPU
274 switch (fDeviceType) { 271 switch (fDeviceType) {
275 case kGPU_DeviceType: 272 case kGPU_DeviceType:
(...skipping 28 matching lines...) Expand all
304 Json::Value getJSONConfig() { 301 Json::Value getJSONConfig() {
305 Json::Value result; 302 Json::Value result;
306 303
307 result["mode"] = this->getConfigNameInternal().c_str(); 304 result["mode"] = this->getConfigNameInternal().c_str();
308 result["scale"] = 1.0f; 305 result["scale"] = 1.0f;
309 if (SK_Scalar1 != fScaleFactor) { 306 if (SK_Scalar1 != fScaleFactor) {
310 result["scale"] = SkScalarToFloat(fScaleFactor); 307 result["scale"] = SkScalarToFloat(fScaleFactor);
311 } 308 }
312 if (kRTree_BBoxHierarchyType == fBBoxHierarchyType) { 309 if (kRTree_BBoxHierarchyType == fBBoxHierarchyType) {
313 result["bbh"] = "rtree"; 310 result["bbh"] = "rtree";
314 } else if (kQuadTree_BBoxHierarchyType == fBBoxHierarchyType) {
315 result["bbh"] = "quadtree";
316 } else if (kTileGrid_BBoxHierarchyType == fBBoxHierarchyType) { 311 } else if (kTileGrid_BBoxHierarchyType == fBBoxHierarchyType) {
317 SkString tmp("grid_"); 312 SkString tmp("grid_");
318 tmp.appendS32(fGridInfo.fTileInterval.width()); 313 tmp.appendS32(fGridInfo.fTileInterval.width());
319 tmp.append("x"); 314 tmp.append("x");
320 tmp.appendS32(fGridInfo.fTileInterval.height()); 315 tmp.appendS32(fGridInfo.fTileInterval.height());
321 result["bbh"] = tmp.c_str(); 316 result["bbh"] = tmp.c_str();
322 } 317 }
323 #if SK_SUPPORT_GPU 318 #if SK_SUPPORT_GPU
324 SkString tmp; 319 SkString tmp;
325 switch (fDeviceType) { 320 switch (fDeviceType) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 } 404 }
410 #endif 405 #endif
411 406
412 SkCanvas* getCanvas() { 407 SkCanvas* getCanvas() {
413 return fCanvas; 408 return fCanvas;
414 } 409 }
415 410
416 const SkPicture* getPicture() { 411 const SkPicture* getPicture() {
417 return fPicture; 412 return fPicture;
418 } 413 }
419 414
420 #if SK_SUPPORT_GPU 415 #if SK_SUPPORT_GPU
421 explicit PictureRenderer(const GrContext::Options &opts) 416 explicit PictureRenderer(const GrContext::Options &opts)
422 #else 417 #else
423 PictureRenderer() 418 PictureRenderer()
424 #endif 419 #endif
425 : fJsonSummaryPtr(NULL) 420 : fJsonSummaryPtr(NULL)
426 , fDeviceType(kBitmap_DeviceType) 421 , fDeviceType(kBitmap_DeviceType)
427 , fEnableWrites(false) 422 , fEnableWrites(false)
428 , fBBoxHierarchyType(kNone_BBoxHierarchyType) 423 , fBBoxHierarchyType(kNone_BBoxHierarchyType)
429 , fScaleFactor(SK_Scalar1) 424 , fScaleFactor(SK_Scalar1)
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 typedef PictureRenderer INHERITED; 538 typedef PictureRenderer INHERITED;
544 }; 539 };
545 540
546 class SimplePictureRenderer : public PictureRenderer { 541 class SimplePictureRenderer : public PictureRenderer {
547 public: 542 public:
548 #if SK_SUPPORT_GPU 543 #if SK_SUPPORT_GPU
549 SimplePictureRenderer(const GrContext::Options &opts) : INHERITED(opts) { } 544 SimplePictureRenderer(const GrContext::Options &opts) : INHERITED(opts) { }
550 #endif 545 #endif
551 546
552 virtual void init(const SkPicture* pict, 547 virtual void init(const SkPicture* pict,
553 const SkString* writePath, 548 const SkString* writePath,
554 const SkString* mismatchPath, 549 const SkString* mismatchPath,
555 const SkString* inputFilename, 550 const SkString* inputFilename,
556 bool useChecksumBasedFilenames) SK_OVERRIDE; 551 bool useChecksumBasedFilenames) SK_OVERRIDE;
557 552
558 virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE; 553 virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE;
559 554
560 private: 555 private:
561 virtual SkString getConfigNameInternal() SK_OVERRIDE; 556 virtual SkString getConfigNameInternal() SK_OVERRIDE;
562 557
563 typedef PictureRenderer INHERITED; 558 typedef PictureRenderer INHERITED;
564 }; 559 };
565 560
566 class TiledPictureRenderer : public PictureRenderer { 561 class TiledPictureRenderer : public PictureRenderer {
567 public: 562 public:
568 #if SK_SUPPORT_GPU 563 #if SK_SUPPORT_GPU
569 TiledPictureRenderer(const GrContext::Options &opts); 564 TiledPictureRenderer(const GrContext::Options &opts);
570 #else 565 #else
571 TiledPictureRenderer(); 566 TiledPictureRenderer();
572 #endif 567 #endif
573 568
574 virtual void init(const SkPicture* pict, 569 virtual void init(const SkPicture* pict,
575 const SkString* writePath, 570 const SkString* writePath,
576 const SkString* mismatchPath, 571 const SkString* mismatchPath,
577 const SkString* inputFilename, 572 const SkString* inputFilename,
578 bool useChecksumBasedFilenames) SK_OVERRIDE; 573 bool useChecksumBasedFilenames) SK_OVERRIDE;
579 574
580 /** 575 /**
581 * Renders to tiles, rather than a single canvas. 576 * Renders to tiles, rather than a single canvas.
582 * If fWritePath was provided, a separate file is 577 * If fWritePath was provided, a separate file is
583 * created for each tile, named "path0.png", "path1.png", etc. 578 * created for each tile, named "path0.png", "path1.png", etc.
584 */ 579 */
585 virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE; 580 virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE;
586 581
587 virtual void end() SK_OVERRIDE; 582 virtual void end() SK_OVERRIDE;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 713
719 #if SK_SUPPORT_GPU 714 #if SK_SUPPORT_GPU
720 extern PictureRenderer* CreateGatherPixelRefsRenderer(const GrContext::Options& opts); 715 extern PictureRenderer* CreateGatherPixelRefsRenderer(const GrContext::Options& opts);
721 #else 716 #else
722 extern PictureRenderer* CreateGatherPixelRefsRenderer(); 717 extern PictureRenderer* CreateGatherPixelRefsRenderer();
723 #endif 718 #endif
724 719
725 } 720 }
726 721
727 #endif // PictureRenderer_DEFINED 722 #endif // PictureRenderer_DEFINED
OLDNEW
« no previous file with comments | « tests/PictureTest.cpp ('k') | tools/PictureRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698