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

Side by Side Diff: src/core/SkRecordOpts.cpp

Issue 550083006: Turn on all pixel-perfect SkRecord optimizations. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update unit test 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 | « src/core/SkPicture.cpp ('k') | tests/PictureTest.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 2014 Google Inc. 2 * Copyright 2014 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 "SkRecordOpts.h" 8 #include "SkRecordOpts.h"
9 9
10 #include "SkRecordPattern.h" 10 #include "SkRecordPattern.h"
11 #include "SkRecords.h" 11 #include "SkRecords.h"
12 #include "SkTDArray.h" 12 #include "SkTDArray.h"
13 13
14 using namespace SkRecords; 14 using namespace SkRecords;
15 15
16 void SkRecordOptimize(SkRecord* record) { 16 void SkRecordOptimize(SkRecord* record) {
17 // TODO(mtklein): fuse independent optimizations to reduce number of passes? 17 // TODO(mtklein): rebaseline and re-enable
18 //SkRecordNoopSaveLayerDrawRestores(record);
18 SkRecordNoopSaveRestores(record); 19 SkRecordNoopSaveRestores(record);
19 // TODO(mtklein): figure out why we draw differently and reenable 20 SkRecordReduceDrawPosTextStrength(record);
20 //SkRecordNoopSaveLayerDrawRestores(record);
21
22 SkRecordReduceDrawPosTextStrength(record); // Helpful to run this before Bo undDrawPosTextH.
23 } 21 }
24 22
25 // Most of the optimizations in this file are pattern-based. These are all defi ned as structs with: 23 // Most of the optimizations in this file are pattern-based. These are all defi ned as structs with:
26 // - a Pattern typedef 24 // - a Pattern typedef
27 // - a bool onMatch(SkRceord*, Pattern*, unsigned begin, unsigned end) method, 25 // - a bool onMatch(SkRceord*, Pattern*, unsigned begin, unsigned end) method,
28 // which returns true if it made changes and false if not. 26 // which returns true if it made changes and false if not.
29 27
30 // Run a pattern-based optimization once across the SkRecord, returning true if it made any changes. 28 // Run a pattern-based optimization once across the SkRecord, returning true if it made any changes.
31 // It looks for spans which match Pass::Pattern, and when found calls onMatch() with the pattern, 29 // It looks for spans which match Pass::Pattern, and when found calls onMatch() with the pattern,
32 // record, and [begin,end) span of the commands that matched. 30 // record, and [begin,end) span of the commands that matched.
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 DrawPosTextH, 183 DrawPosTextH,
186 (draw->paint, draw->text, draw->byteLength, scalars , firstY)); 184 (draw->paint, draw->text, draw->byteLength, scalars , firstY));
187 return true; 185 return true;
188 } 186 }
189 }; 187 };
190 void SkRecordReduceDrawPosTextStrength(SkRecord* record) { 188 void SkRecordReduceDrawPosTextStrength(SkRecord* record) {
191 StrengthReducer pass; 189 StrengthReducer pass;
192 apply(&pass, record); 190 apply(&pass, record);
193 } 191 }
194 192
OLDNEW
« no previous file with comments | « src/core/SkPicture.cpp ('k') | tests/PictureTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698