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

Side by Side Diff: tests/RecordTest.cpp

Issue 245853002: Refactor SkRecord opts, converting playback optimizations where possible. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: notes 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
« no previous file with comments | « tests/RecordCullingTest.cpp ('k') | tests/RecorderTest.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 "Test.h" 8 #include "Test.h"
9 9
10 #include "SkRecord.h" 10 #include "SkRecord.h"
(...skipping 28 matching lines...) Expand all
39 DEF_TEST(Record, r) { 39 DEF_TEST(Record, r) {
40 SkRecord record; 40 SkRecord record;
41 41
42 // Add a simple DrawRect command. 42 // Add a simple DrawRect command.
43 SkRect rect = SkRect::MakeWH(10, 10); 43 SkRect rect = SkRect::MakeWH(10, 10);
44 SkPaint paint; 44 SkPaint paint;
45 SkNEW_PLACEMENT_ARGS(record.append<SkRecords::DrawRect>(), SkRecords::DrawRe ct, (rect, paint)); 45 SkNEW_PLACEMENT_ARGS(record.append<SkRecords::DrawRect>(), SkRecords::DrawRe ct, (rect, paint));
46 46
47 // Its area should be 100. 47 // Its area should be 100.
48 AreaSummer summer; 48 AreaSummer summer;
49 record.visit(summer); 49 for (unsigned i = 0; i < record.count(); i++) {
f(malita) 2014/04/22 12:16:10 This loop appears quite common - can we set up a h
mtklein 2014/04/22 15:36:27 Added apply() to AreaSummer, Stretch, and the othe
50 record.visit(i, summer);
51 }
50 REPORTER_ASSERT(r, summer.area() == 100); 52 REPORTER_ASSERT(r, summer.area() == 100);
51 53
52 // Scale 2x. 54 // Scale 2x.
53 Stretch stretch; 55 Stretch stretch;
54 record.mutate(stretch); 56 for (unsigned i = 0; i < record.count(); i++) {
57 record.mutate(i, stretch);
58 }
55 59
56 // Now its area should be 100 + 400. 60 // Now its area should be 100 + 400.
57 record.visit(summer); 61 for (unsigned i = 0; i < record.count(); i++) {
62 record.visit(i, summer);
63 }
58 REPORTER_ASSERT(r, summer.area() == 500); 64 REPORTER_ASSERT(r, summer.area() == 500);
59 } 65 }
OLDNEW
« no previous file with comments | « tests/RecordCullingTest.cpp ('k') | tests/RecorderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698