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

Side by Side Diff: tools/CopyTilesRenderer.cpp

Issue 214953003: split SkPictureRecorder out of SkPicture (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: update to ToT (again) Created 6 years, 8 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 | Annotate | Revision Log
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 "picture_utils.h" 8 #include "picture_utils.h"
9 #include "CopyTilesRenderer.h" 9 #include "CopyTilesRenderer.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
11 #include "SkDevice.h" 11 #include "SkDevice.h"
12 #include "SkImageEncoder.h" 12 #include "SkImageEncoder.h"
13 #include "SkPicture.h" 13 #include "SkPicture.h"
14 #include "SkPixelRef.h" 14 #include "SkPixelRef.h"
15 #include "SkRect.h" 15 #include "SkRect.h"
16 #include "SkString.h" 16 #include "SkString.h"
17 17
18 namespace sk_tools { 18 namespace sk_tools {
19 CopyTilesRenderer::CopyTilesRenderer(int x, int y) 19 CopyTilesRenderer::CopyTilesRenderer(int x, int y)
20 : fXTilesPerLargeTile(x) 20 : fXTilesPerLargeTile(x)
21 , fYTilesPerLargeTile(y) { 21 , fYTilesPerLargeTile(y) {
22 } 22 }
23 void CopyTilesRenderer::init(SkPicture* pict, const SkString* outputDir, 23 void CopyTilesRenderer::init(SkPicture* pict, const SkString* outputDir,
24 const SkString* inputFilename, bool useChecksum BasedFilenames) { 24 const SkString* inputFilename, bool useChecksum BasedFilenames) {
25 // Do not call INHERITED::init(), which would create a (potentially larg e) canvas which is 25 // Do not call INHERITED::init(), which would create a (potentially larg e) canvas which is
26 // not used by bench_pictures. 26 // not used by bench_pictures.
27 SkASSERT(pict != NULL); 27 SkASSERT(pict != NULL);
28 // Only work with absolute widths (as opposed to percentages). 28 // Only work with absolute widths (as opposed to percentages).
29 SkASSERT(this->getTileWidth() != 0 && this->getTileHeight() != 0); 29 SkASSERT(this->getTileWidth() != 0 && this->getTileHeight() != 0);
30 fPicture = pict; 30 fPicture.reset(pict)->ref();
31 this->CopyString(&fOutputDir, outputDir); 31 this->CopyString(&fOutputDir, outputDir);
32 this->CopyString(&fInputFilename, inputFilename); 32 this->CopyString(&fInputFilename, inputFilename);
33 fUseChecksumBasedFilenames = useChecksumBasedFilenames; 33 fUseChecksumBasedFilenames = useChecksumBasedFilenames;
34 fPicture->ref();
35 this->buildBBoxHierarchy(); 34 this->buildBBoxHierarchy();
36 // In order to avoid allocating a large canvas (particularly important f or GPU), create one 35 // In order to avoid allocating a large canvas (particularly important f or GPU), create one
37 // canvas that is a multiple of the tile size, and draw portions of the picture. 36 // canvas that is a multiple of the tile size, and draw portions of the picture.
38 fLargeTileWidth = fXTilesPerLargeTile * this->getTileWidth(); 37 fLargeTileWidth = fXTilesPerLargeTile * this->getTileWidth();
39 fLargeTileHeight = fYTilesPerLargeTile * this->getTileHeight(); 38 fLargeTileHeight = fYTilesPerLargeTile * this->getTileHeight();
40 fCanvas.reset(this->INHERITED::setupCanvas(fLargeTileWidth, fLargeTileHe ight)); 39 fCanvas.reset(this->INHERITED::setupCanvas(fLargeTileWidth, fLargeTileHe ight));
41 } 40 }
42 41
43 bool CopyTilesRenderer::render(SkBitmap** out) { 42 bool CopyTilesRenderer::render(SkBitmap** out) {
44 int i = 0; 43 int i = 0;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 } 90 }
92 } 91 }
93 } 92 }
94 return success; 93 return success;
95 } 94 }
96 95
97 SkString CopyTilesRenderer::getConfigNameInternal() { 96 SkString CopyTilesRenderer::getConfigNameInternal() {
98 return SkString("copy_tiles"); 97 return SkString("copy_tiles");
99 } 98 }
100 } 99 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698