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

Side by Side Diff: tests/PictureTest.cpp

Issue 875913002: Alter gpu veto (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix PictureTest Created 5 years, 10 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') | 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 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 "SkBBoxHierarchy.h" 8 #include "SkBBoxHierarchy.h"
9 #include "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 path.moveTo(0, 0); 133 path.moveTo(0, 0);
134 path.lineTo(50, 50); 134 path.lineTo(50, 50);
135 135
136 SkScalar intervals[] = { 1.0f, 1.0f }; 136 SkScalar intervals[] = { 1.0f, 1.0f };
137 SkAutoTUnref<SkDashPathEffect> dash(SkDashPathEffect::Create(intervals, 2, 0)); 137 SkAutoTUnref<SkDashPathEffect> dash(SkDashPathEffect::Create(intervals, 2, 0));
138 138
139 SkPaint paint; 139 SkPaint paint;
140 paint.setStyle(SkPaint::kStroke_Style); 140 paint.setStyle(SkPaint::kStroke_Style);
141 paint.setPathEffect(dash); 141 paint.setPathEffect(dash);
142 142
143 canvas->drawPath(path, paint); 143 for (int i = 0; i < 50; ++i) {
144 canvas->drawPath(path, paint);
145 }
144 } 146 }
145 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); 147 SkAutoTUnref<SkPicture> picture(recorder.endRecording());
146 // path effects currently render an SkPicture undesireable for GPU rendering 148 // path effects currently render an SkPicture undesireable for GPU rendering
147 149
148 const char *reason = NULL; 150 const char *reason = NULL;
149 REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(NULL, &reaso n)); 151 REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(NULL, &reaso n));
150 REPORTER_ASSERT(reporter, reason); 152 REPORTER_ASSERT(reporter, reason);
151 153
152 canvas = recorder.beginRecording(100, 100); 154 canvas = recorder.beginRecording(100, 100);
153 { 155 {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 REPORTER_ASSERT(reporter, picture->suitableForGpuRasterization(NULL)); 220 REPORTER_ASSERT(reporter, picture->suitableForGpuRasterization(NULL));
219 221
220 canvas = recorder.beginRecording(100, 100); 222 canvas = recorder.beginRecording(100, 100);
221 { 223 {
222 SkPaint paint; 224 SkPaint paint;
223 SkScalar intervals [] = { 10, 20 }; 225 SkScalar intervals [] = { 10, 20 };
224 SkPathEffect* pe = SkDashPathEffect::Create(intervals, 2, 25); 226 SkPathEffect* pe = SkDashPathEffect::Create(intervals, 2, 25);
225 paint.setPathEffect(pe)->unref(); 227 paint.setPathEffect(pe)->unref();
226 228
227 SkPoint points [2] = { { 0, 0 }, { 100, 0 } }; 229 SkPoint points [2] = { { 0, 0 }, { 100, 0 } };
228 canvas->drawPoints(SkCanvas::kLines_PointMode, 2, points, paint); 230
231 for (int i = 0; i < 50; ++i) {
232 canvas->drawPoints(SkCanvas::kLines_PointMode, 2, points, paint);
233 }
229 } 234 }
230 picture.reset(recorder.endRecording()); 235 picture.reset(recorder.endRecording());
231 // fast-path dashed effects are fine for GPU rendering ... 236 // fast-path dashed effects are fine for GPU rendering ...
232 REPORTER_ASSERT(reporter, picture->suitableForGpuRasterization(NULL)); 237 REPORTER_ASSERT(reporter, picture->suitableForGpuRasterization(NULL));
233 238
234 canvas = recorder.beginRecording(100, 100); 239 canvas = recorder.beginRecording(100, 100);
235 { 240 {
236 SkPaint paint; 241 SkPaint paint;
237 SkScalar intervals [] = { 10, 20 }; 242 SkScalar intervals [] = { 10, 20 };
238 SkPathEffect* pe = SkDashPathEffect::Create(intervals, 2, 25); 243 SkPathEffect* pe = SkDashPathEffect::Create(intervals, 2, 25);
239 paint.setPathEffect(pe)->unref(); 244 paint.setPathEffect(pe)->unref();
240 245
241 canvas->drawRect(SkRect::MakeWH(10, 10), paint); 246 for (int i = 0; i < 50; ++i) {
247 canvas->drawRect(SkRect::MakeWH(10, 10), paint);
248 }
242 } 249 }
243 picture.reset(recorder.endRecording()); 250 picture.reset(recorder.endRecording());
244 // ... but only when applied to drawPoint() calls 251 // ... but only when applied to drawPoint() calls
245 REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(NULL)); 252 REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(NULL));
246 253
247 // Nest the previous picture inside a new one. 254 // Nest the previous picture inside a new one.
248 canvas = recorder.beginRecording(100, 100); 255 canvas = recorder.beginRecording(100, 100);
249 { 256 {
250 canvas->drawPicture(picture.get()); 257 canvas->drawPicture(picture.get());
251 } 258 }
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
1305 1312
1306 // The picture shares the immutable pixels but copies the mutable ones. 1313 // The picture shares the immutable pixels but copies the mutable ones.
1307 REPORTER_ASSERT(r, mut.pixelRef()->unique()); 1314 REPORTER_ASSERT(r, mut.pixelRef()->unique());
1308 REPORTER_ASSERT(r, !immut.pixelRef()->unique()); 1315 REPORTER_ASSERT(r, !immut.pixelRef()->unique());
1309 1316
1310 // When the picture goes away, it's just our bitmaps holding the refs. 1317 // When the picture goes away, it's just our bitmaps holding the refs.
1311 pic.reset(NULL); 1318 pic.reset(NULL);
1312 REPORTER_ASSERT(r, mut.pixelRef()->unique()); 1319 REPORTER_ASSERT(r, mut.pixelRef()->unique());
1313 REPORTER_ASSERT(r, immut.pixelRef()->unique()); 1320 REPORTER_ASSERT(r, immut.pixelRef()->unique());
1314 } 1321 }
OLDNEW
« no previous file with comments | « src/core/SkPicture.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698