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

Side by Side Diff: tools/PictureRenderer.cpp

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/PictureRenderer.h ('k') | no next file » | 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 30 matching lines...) Expand all
41 return SkScalarLog(x) * log2_conversion_factor; 41 return SkScalarLog(x) * log2_conversion_factor;
42 } 42 }
43 43
44 namespace sk_tools { 44 namespace sk_tools {
45 45
46 enum { 46 enum {
47 kDefaultTileWidth = 256, 47 kDefaultTileWidth = 256,
48 kDefaultTileHeight = 256 48 kDefaultTileHeight = 256
49 }; 49 };
50 50
51 void PictureRenderer::init(SkPicture* pict, const SkString* writePath, const SkS tring* mismatchPath, 51 void PictureRenderer::init(const SkPicture* pict,
52 const SkString* inputFilename, bool useChecksumBasedF ilenames) { 52 const SkString* writePath,
53 const SkString* mismatchPath,
54 const SkString* inputFilename,
55 bool useChecksumBasedFilenames) {
53 this->CopyString(&fWritePath, writePath); 56 this->CopyString(&fWritePath, writePath);
54 this->CopyString(&fMismatchPath, mismatchPath); 57 this->CopyString(&fMismatchPath, mismatchPath);
55 this->CopyString(&fInputFilename, inputFilename); 58 this->CopyString(&fInputFilename, inputFilename);
56 fUseChecksumBasedFilenames = useChecksumBasedFilenames; 59 fUseChecksumBasedFilenames = useChecksumBasedFilenames;
57 60
58 SkASSERT(NULL == fPicture); 61 SkASSERT(NULL == fPicture);
59 SkASSERT(NULL == fCanvas.get()); 62 SkASSERT(NULL == fCanvas.get());
60 if (NULL != fPicture || NULL != fCanvas.get()) { 63 if (NULL != fPicture || NULL != fCanvas.get()) {
61 return; 64 return;
62 } 65 }
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 return true; 402 return true;
400 } 403 }
401 } 404 }
402 405
403 SkString PipePictureRenderer::getConfigNameInternal() { 406 SkString PipePictureRenderer::getConfigNameInternal() {
404 return SkString("pipe"); 407 return SkString("pipe");
405 } 408 }
406 409
407 //////////////////////////////////////////////////////////////////////////////// /////////////// 410 //////////////////////////////////////////////////////////////////////////////// ///////////////
408 411
409 void SimplePictureRenderer::init(SkPicture* picture, const SkString* writePath, 412 void SimplePictureRenderer::init(const SkPicture* picture, const SkString* write Path,
410 const SkString* mismatchPath, const SkString* i nputFilename, 413 const SkString* mismatchPath, const SkString* i nputFilename,
411 bool useChecksumBasedFilenames) { 414 bool useChecksumBasedFilenames) {
412 INHERITED::init(picture, writePath, mismatchPath, inputFilename, useChecksum BasedFilenames); 415 INHERITED::init(picture, writePath, mismatchPath, inputFilename, useChecksum BasedFilenames);
413 this->buildBBoxHierarchy(); 416 this->buildBBoxHierarchy();
414 } 417 }
415 418
416 bool SimplePictureRenderer::render(SkBitmap** out) { 419 bool SimplePictureRenderer::render(SkBitmap** out) {
417 SkASSERT(fCanvas.get() != NULL); 420 SkASSERT(fCanvas.get() != NULL);
418 SkASSERT(NULL != fPicture); 421 SkASSERT(NULL != fPicture);
419 if (NULL == fCanvas.get() || NULL == fPicture) { 422 if (NULL == fCanvas.get() || NULL == fPicture) {
(...skipping 24 matching lines...) Expand all
444 TiledPictureRenderer::TiledPictureRenderer() 447 TiledPictureRenderer::TiledPictureRenderer()
445 : fTileWidth(kDefaultTileWidth) 448 : fTileWidth(kDefaultTileWidth)
446 , fTileHeight(kDefaultTileHeight) 449 , fTileHeight(kDefaultTileHeight)
447 , fTileWidthPercentage(0.0) 450 , fTileWidthPercentage(0.0)
448 , fTileHeightPercentage(0.0) 451 , fTileHeightPercentage(0.0)
449 , fTileMinPowerOf2Width(0) 452 , fTileMinPowerOf2Width(0)
450 , fCurrentTileOffset(-1) 453 , fCurrentTileOffset(-1)
451 , fTilesX(0) 454 , fTilesX(0)
452 , fTilesY(0) { } 455 , fTilesY(0) { }
453 456
454 void TiledPictureRenderer::init(SkPicture* pict, const SkString* writePath, 457 void TiledPictureRenderer::init(const SkPicture* pict, const SkString* writePath ,
455 const SkString* mismatchPath, const SkString* in putFilename, 458 const SkString* mismatchPath, const SkString* in putFilename,
456 bool useChecksumBasedFilenames) { 459 bool useChecksumBasedFilenames) {
457 SkASSERT(NULL != pict); 460 SkASSERT(NULL != pict);
458 SkASSERT(0 == fTileRects.count()); 461 SkASSERT(0 == fTileRects.count());
459 if (NULL == pict || fTileRects.count() != 0) { 462 if (NULL == pict || fTileRects.count() != 0) {
460 return; 463 return;
461 } 464 }
462 465
463 // Do not call INHERITED::init(), which would create a (potentially large) c anvas which is not 466 // Do not call INHERITED::init(), which would create a (potentially large) c anvas which is not
464 // used by bench_pictures. 467 // used by bench_pictures.
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 } 575 }
573 } 576 }
574 } 577 }
575 578
576 /** 579 /**
577 * Draw the specified picture to the canvas translated to rectangle provided, so that this mini 580 * Draw the specified picture to the canvas translated to rectangle provided, so that this mini
578 * canvas represents the rectangle's portion of the overall picture. 581 * canvas represents the rectangle's portion of the overall picture.
579 * Saves and restores so that the initial clip and matrix return to their state before this function 582 * Saves and restores so that the initial clip and matrix return to their state before this function
580 * is called. 583 * is called.
581 */ 584 */
582 static void draw_tile_to_canvas(SkCanvas* canvas, const SkRect& tileRect, SkPict ure* picture) { 585 static void draw_tile_to_canvas(SkCanvas* canvas,
586 const SkRect& tileRect,
587 const SkPicture* picture) {
583 int saveCount = canvas->save(); 588 int saveCount = canvas->save();
584 // Translate so that we draw the correct portion of the picture. 589 // Translate so that we draw the correct portion of the picture.
585 // Perform a postTranslate so that the scaleFactor does not interfere with t he positioning. 590 // Perform a postTranslate so that the scaleFactor does not interfere with t he positioning.
586 SkMatrix mat(canvas->getTotalMatrix()); 591 SkMatrix mat(canvas->getTotalMatrix());
587 mat.postTranslate(-tileRect.fLeft, -tileRect.fTop); 592 mat.postTranslate(-tileRect.fLeft, -tileRect.fTop);
588 canvas->setMatrix(mat); 593 canvas->setMatrix(mat);
589 canvas->drawPicture(picture); 594 canvas->drawPicture(picture);
590 canvas->restoreToCount(saveCount); 595 canvas->restoreToCount(saveCount);
591 canvas->flush(); 596 canvas->flush();
592 } 597 }
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 virtual SkString getConfigNameInternal() SK_OVERRIDE { 758 virtual SkString getConfigNameInternal() SK_OVERRIDE {
754 return SkString("gather_pixelrefs"); 759 return SkString("gather_pixelrefs");
755 } 760 }
756 }; 761 };
757 762
758 PictureRenderer* CreateGatherPixelRefsRenderer() { 763 PictureRenderer* CreateGatherPixelRefsRenderer() {
759 return SkNEW(GatherRenderer); 764 return SkNEW(GatherRenderer);
760 } 765 }
761 766
762 } // namespace sk_tools 767 } // namespace sk_tools
OLDNEW
« no previous file with comments | « tools/PictureRenderer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698