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

Side by Side Diff: tests/RecorderTest.cpp

Issue 366133002: move SkChecksum and SkEmptyShader to private (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « tests/GradientTest.cpp ('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 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"
11 #include "SkRecorder.h" 11 #include "SkRecorder.h"
12 #include "SkRecords.h" 12 #include "SkRecords.h"
13 13 #include "SkShader.h"
14 #include "SkEmptyShader.h"
15 14
16 #define COUNT(T) + 1 15 #define COUNT(T) + 1
17 static const int kRecordTypes = SK_RECORD_TYPES(COUNT); 16 static const int kRecordTypes = SK_RECORD_TYPES(COUNT);
18 #undef COUNT 17 #undef COUNT
19 18
20 // Tallies the types of commands it sees into a histogram. 19 // Tallies the types of commands it sees into a histogram.
21 class Tally { 20 class Tally {
22 public: 21 public:
23 Tally() { sk_bzero(&fHistogram, sizeof(fHistogram)); } 22 Tally() { sk_bzero(&fHistogram, sizeof(fHistogram)); }
24 23
(...skipping 25 matching lines...) Expand all
50 } 49 }
51 50
52 // Regression test for leaking refs held by optional arguments. 51 // Regression test for leaking refs held by optional arguments.
53 DEF_TEST(Recorder_RefLeaking, r) { 52 DEF_TEST(Recorder_RefLeaking, r) {
54 // We use SaveLayer to test: 53 // We use SaveLayer to test:
55 // - its SkRect argument is optional and SkRect is POD. Just testing that that works. 54 // - its SkRect argument is optional and SkRect is POD. Just testing that that works.
56 // - its SkPaint argument is optional and SkPaint is not POD. The bug was here. 55 // - its SkPaint argument is optional and SkPaint is not POD. The bug was here.
57 56
58 SkRect bounds = SkRect::MakeWH(320, 240); 57 SkRect bounds = SkRect::MakeWH(320, 240);
59 SkPaint paint; 58 SkPaint paint;
60 paint.setShader(SkNEW(SkEmptyShader))->unref(); 59 paint.setShader(SkShader::CreateEmptyShader())->unref();
61 60
62 REPORTER_ASSERT(r, paint.getShader()->unique()); 61 REPORTER_ASSERT(r, paint.getShader()->unique());
63 { 62 {
64 SkRecord record; 63 SkRecord record;
65 SkRecorder recorder(&record, 1920, 1080); 64 SkRecorder recorder(&record, 1920, 1080);
66 recorder.saveLayer(&bounds, &paint); 65 recorder.saveLayer(&bounds, &paint);
67 REPORTER_ASSERT(r, !paint.getShader()->unique()); 66 REPORTER_ASSERT(r, !paint.getShader()->unique());
68 } 67 }
69 REPORTER_ASSERT(r, paint.getShader()->unique()); 68 REPORTER_ASSERT(r, paint.getShader()->unique());
70 } 69 }
OLDNEW
« no previous file with comments | « tests/GradientTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698