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

Side by Side Diff: tests/RecorderTest.cpp

Issue 790733003: remove (dumb) canvas::NewRaster, and rename surface::NewRasterPMColor to N32Premul (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase after chrome patches have landed Created 6 years 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/RecordDrawTest.cpp ('k') | tests/SkResourceCacheTest.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 "SkPictureRecorder.h" 10 #include "SkPictureRecorder.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 recorder.restore(); 148 recorder.restore();
149 REPORTER_ASSERT(r, !recorder.isDrawingToLayer()); 149 REPORTER_ASSERT(r, !recorder.isDrawingToLayer());
150 recorder.restore(); 150 recorder.restore();
151 REPORTER_ASSERT(r, !recorder.isDrawingToLayer()); 151 REPORTER_ASSERT(r, !recorder.isDrawingToLayer());
152 } 152 }
153 153
154 DEF_TEST(Recorder_drawImage_takeReference, reporter) { 154 DEF_TEST(Recorder_drawImage_takeReference, reporter) {
155 155
156 SkAutoTUnref<SkImage> image; 156 SkAutoTUnref<SkImage> image;
157 { 157 {
158 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterPMColor(100, 100)); 158 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(100, 100)) ;
159 surface->getCanvas()->clear(SK_ColorGREEN); 159 surface->getCanvas()->clear(SK_ColorGREEN);
160 image.reset(surface->newImageSnapshot()); 160 image.reset(surface->newImageSnapshot());
161 } 161 }
162 { 162 {
163 SkRecord record; 163 SkRecord record;
164 SkRecorder recorder(&record, 100, 100); 164 SkRecorder recorder(&record, 100, 100);
165 165
166 // DrawImage is supposed to take a reference 166 // DrawImage is supposed to take a reference
167 recorder.drawImage(image.get(), 0, 0); 167 recorder.drawImage(image.get(), 0, 0);
168 REPORTER_ASSERT(reporter, !image->unique()); 168 REPORTER_ASSERT(reporter, !image->unique());
(...skipping 13 matching lines...) Expand all
182 recorder.drawImageRect(image.get(), 0, SkRect::MakeWH(100, 100)); 182 recorder.drawImageRect(image.get(), 0, SkRect::MakeWH(100, 100));
183 REPORTER_ASSERT(reporter, !image->unique()); 183 REPORTER_ASSERT(reporter, !image->unique());
184 184
185 Tally tally; 185 Tally tally;
186 tally.apply(record); 186 tally.apply(record);
187 187
188 REPORTER_ASSERT(reporter, 1 == tally.count<SkRecords::DrawImageRect>()); 188 REPORTER_ASSERT(reporter, 1 == tally.count<SkRecords::DrawImageRect>());
189 } 189 }
190 REPORTER_ASSERT(reporter, image->unique()); 190 REPORTER_ASSERT(reporter, image->unique());
191 } 191 }
OLDNEW
« no previous file with comments | « tests/RecordDrawTest.cpp ('k') | tests/SkResourceCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698