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

Side by Side Diff: tools/PictureRenderer.cpp

Issue 239703006: Retract SkPicture::kOptimizeForClippedPlayback_RecordingFlag from public API (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: 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
« no previous file with comments | « tests/TileGridTest.cpp ('k') | tools/bench_record.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 10 matching lines...) Expand all
21 #include "SkGraphics.h" 21 #include "SkGraphics.h"
22 #include "SkImageEncoder.h" 22 #include "SkImageEncoder.h"
23 #include "SkMaskFilter.h" 23 #include "SkMaskFilter.h"
24 #include "SkMatrix.h" 24 #include "SkMatrix.h"
25 #include "SkOSFile.h" 25 #include "SkOSFile.h"
26 #include "SkPicture.h" 26 #include "SkPicture.h"
27 #include "SkPictureUtils.h" 27 #include "SkPictureUtils.h"
28 #include "SkPixelRef.h" 28 #include "SkPixelRef.h"
29 #include "SkQuadTree.h" 29 #include "SkQuadTree.h"
30 #include "SkQuadTreePicture.h" 30 #include "SkQuadTreePicture.h"
31 #include "SkRTree.h" 31 #include "SkRTreePicture.h"
32 #include "SkScalar.h" 32 #include "SkScalar.h"
33 #include "SkStream.h" 33 #include "SkStream.h"
34 #include "SkString.h" 34 #include "SkString.h"
35 #include "SkTemplates.h" 35 #include "SkTemplates.h"
36 #include "SkTileGridPicture.h" 36 #include "SkTileGridPicture.h"
37 #include "SkTDArray.h" 37 #include "SkTDArray.h"
38 #include "SkThreadUtils.h" 38 #include "SkThreadUtils.h"
39 #include "SkTypes.h" 39 #include "SkTypes.h"
40 40
41 static inline SkScalar scalar_log2(SkScalar x) { 41 static inline SkScalar scalar_log2(SkScalar x) {
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 } 312 }
313 313
314 // resetState should've already done this 314 // resetState should've already done this
315 fGrContext->flush(); 315 fGrContext->flush();
316 316
317 fGrContext->purgeAllUnlockedResources(); 317 fGrContext->purgeAllUnlockedResources();
318 #endif 318 #endif
319 } 319 }
320 320
321 uint32_t PictureRenderer::recordFlags() { 321 uint32_t PictureRenderer::recordFlags() {
322 return ((kNone_BBoxHierarchyType == fBBoxHierarchyType) ? 0 : 322 return (kNone_BBoxHierarchyType == fBBoxHierarchyType)
323 SkPicture::kOptimizeForClippedPlayback_RecordingFlag) | 323 ? 0
324 SkPicture::kUsePathBoundsForClip_RecordingFlag; 324 : SkPicture::kUsePathBoundsForClip_RecordingFlag;
325 } 325 }
326 326
327 /** 327 /**
328 * Write the canvas to the specified path. 328 * Write the canvas to the specified path.
329 * 329 *
330 * @param canvas Must be non-null. Canvas to be written to a file. 330 * @param canvas Must be non-null. Canvas to be written to a file.
331 * @param outputDir If nonempty, write the binary image to a file within this di rectory. 331 * @param outputDir If nonempty, write the binary image to a file within this di rectory.
332 * @param inputFilename If we are writing out a binary image, use this to build its filename. 332 * @param inputFilename If we are writing out a binary image, use this to build its filename.
333 * @param jsonSummaryPtr If not null, add image results to this summary. 333 * @param jsonSummaryPtr If not null, add image results to this summary.
334 * @param useChecksumBasedFilenames If true, use checksum-based filenames when w riting to disk. 334 * @param useChecksumBasedFilenames If true, use checksum-based filenames when w riting to disk.
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 return false; 968 return false;
969 } 969 }
970 970
971 SkString PlaybackCreationRenderer::getConfigNameInternal() { 971 SkString PlaybackCreationRenderer::getConfigNameInternal() {
972 return SkString("playback_creation"); 972 return SkString("playback_creation");
973 } 973 }
974 974
975 //////////////////////////////////////////////////////////////////////////////// /////////////// 975 //////////////////////////////////////////////////////////////////////////////// ///////////////
976 // SkPicture variants for each BBoxHierarchy type 976 // SkPicture variants for each BBoxHierarchy type
977 977
978 class RTreePicture : public SkPicture {
979 public:
980 virtual SkBBoxHierarchy* createBBoxHierarchy() const SK_OVERRIDE {
981 static const int kRTreeMinChildren = 6;
982 static const int kRTreeMaxChildren = 11;
983 SkScalar aspectRatio = SkScalarDiv(SkIntToScalar(fWidth),
984 SkIntToScalar(fHeight));
985 bool sortDraws = false;
986 return SkRTree::Create(kRTreeMinChildren, kRTreeMaxChildren,
987 aspectRatio, sortDraws);
988 }
989 };
990
991 class SkRTreePictureFactory : public SkPictureFactory {
992 private:
993 virtual SkPicture* create(int width, int height) SK_OVERRIDE {
994 return SkNEW(RTreePicture);
995 }
996
997 private:
998 typedef SkPictureFactory INHERITED;
999 };
1000
1001 SkPictureFactory* PictureRenderer::getFactory() { 978 SkPictureFactory* PictureRenderer::getFactory() {
1002 switch (fBBoxHierarchyType) { 979 switch (fBBoxHierarchyType) {
1003 case kNone_BBoxHierarchyType: 980 case kNone_BBoxHierarchyType:
1004 return NULL; 981 return NULL;
1005 case kQuadTree_BBoxHierarchyType: 982 case kQuadTree_BBoxHierarchyType:
1006 return SkNEW(SkQuadTreePictureFactory); 983 return SkNEW(SkQuadTreePictureFactory);
1007 case kRTree_BBoxHierarchyType: 984 case kRTree_BBoxHierarchyType:
1008 return SkNEW(SkRTreePictureFactory); 985 return SkNEW(SkRTreePictureFactory);
1009 case kTileGrid_BBoxHierarchyType: 986 case kTileGrid_BBoxHierarchyType:
1010 return new SkTileGridPictureFactory(fGridInfo); 987 return new SkTileGridPictureFactory(fGridInfo);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 virtual SkString getConfigNameInternal() SK_OVERRIDE { 1030 virtual SkString getConfigNameInternal() SK_OVERRIDE {
1054 return SkString("picture_clone"); 1031 return SkString("picture_clone");
1055 } 1032 }
1056 }; 1033 };
1057 1034
1058 PictureRenderer* CreatePictureCloneRenderer() { 1035 PictureRenderer* CreatePictureCloneRenderer() {
1059 return SkNEW(PictureCloneRenderer); 1036 return SkNEW(PictureCloneRenderer);
1060 } 1037 }
1061 1038
1062 } // namespace sk_tools 1039 } // namespace sk_tools
OLDNEW
« no previous file with comments | « tests/TileGridTest.cpp ('k') | tools/bench_record.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698