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

Side by Side Diff: tests/AAClipTest.cpp

Issue 1925693002: remove 'deprecated' region from SkDraw (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update dox Created 4 years, 7 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/xps/SkXPSDevice.cpp ('k') | tests/CanvasTest.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 2011 Google Inc. 2 * Copyright 2011 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 "SkAAClip.h" 8 #include "SkAAClip.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkMask.h" 10 #include "SkMask.h"
11 #include "SkPath.h" 11 #include "SkPath.h"
12 #include "SkRandom.h" 12 #include "SkRandom.h"
13 #include "SkRasterClip.h"
13 #include "SkRRect.h" 14 #include "SkRRect.h"
14 #include "Test.h" 15 #include "Test.h"
15 16
16 static bool operator==(const SkMask& a, const SkMask& b) { 17 static bool operator==(const SkMask& a, const SkMask& b) {
17 if (a.fFormat != b.fFormat || a.fBounds != b.fBounds) { 18 if (a.fFormat != b.fFormat || a.fBounds != b.fBounds) {
18 return false; 19 return false;
19 } 20 }
20 if (!a.fImage && !b.fImage) { 21 if (!a.fImage && !b.fImage) {
21 return true; 22 return true;
22 } 23 }
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 // leaving just a rect. 336 // leaving just a rect.
336 const SkIRect ir = SkIRect::MakeLTRB(10, -10, 50, 90); 337 const SkIRect ir = SkIRect::MakeLTRB(10, -10, 50, 90);
337 338
338 clip.op(ir, SkRegion::kIntersect_Op); 339 clip.op(ir, SkRegion::kIntersect_Op);
339 340
340 REPORTER_ASSERT(reporter, clip.getBounds() == SkIRect::MakeLTRB(10, 0, 50, 9 0)); 341 REPORTER_ASSERT(reporter, clip.getBounds() == SkIRect::MakeLTRB(10, 0, 50, 9 0));
341 // the clip recognized that that it is just a rect! 342 // the clip recognized that that it is just a rect!
342 REPORTER_ASSERT(reporter, clip.isRect()); 343 REPORTER_ASSERT(reporter, clip.isRect());
343 } 344 }
344 345
345 #include "SkRasterClip.h"
346
347 static void copyToMask(const SkRasterClip& rc, SkMask* mask) {
348 if (rc.isAA()) {
349 rc.aaRgn().copyToMask(mask);
350 } else {
351 copyToMask(rc.bwRgn(), mask);
352 }
353 }
354
355 static bool operator==(const SkRasterClip& a, const SkRasterClip& b) {
356 if (a.isEmpty()) {
357 return b.isEmpty();
358 }
359 if (b.isEmpty()) {
360 return false;
361 }
362
363 SkMask ma, mb;
364 copyToMask(a, &ma);
365 copyToMask(b, &mb);
366 SkAutoMaskFreeImage aCleanUp(ma.fImage);
367 SkAutoMaskFreeImage bCleanUp(mb.fImage);
368
369 return ma == mb;
370 }
371
372 static void did_dx_affect(skiatest::Reporter* reporter, const SkScalar dx[], 346 static void did_dx_affect(skiatest::Reporter* reporter, const SkScalar dx[],
373 size_t count, bool changed) { 347 size_t count, bool changed) {
374 const SkIRect baseBounds = SkIRect::MakeXYWH(0, 0, 10, 10); 348 const SkIRect baseBounds = SkIRect::MakeXYWH(0, 0, 10, 10);
375 SkIRect ir = { 0, 0, 10, 10 }; 349 SkIRect ir = { 0, 0, 10, 10 };
376 350
377 for (size_t i = 0; i < count; ++i) { 351 for (size_t i = 0; i < count; ++i) {
378 SkRect r; 352 SkRect r;
379 r.set(ir); 353 r.set(ir);
380 354
381 SkRasterClip rc0(ir); 355 SkRasterClip rc0(ir);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 test_empty(reporter); 413 test_empty(reporter);
440 test_path_bounds(reporter); 414 test_path_bounds(reporter);
441 test_irect(reporter); 415 test_irect(reporter);
442 test_rgn(reporter); 416 test_rgn(reporter);
443 test_path_with_hole(reporter); 417 test_path_with_hole(reporter);
444 test_regressions(); 418 test_regressions();
445 test_nearly_integral(reporter); 419 test_nearly_integral(reporter);
446 test_really_a_rect(reporter); 420 test_really_a_rect(reporter);
447 test_crbug_422693(reporter); 421 test_crbug_422693(reporter);
448 } 422 }
OLDNEW
« no previous file with comments | « src/xps/SkXPSDevice.cpp ('k') | tests/CanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698