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

Side by Side Diff: tests/DeferredCanvasTest.cpp

Issue 777643003: use ClipOp instead of SkRegion for clipping (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/CanvasTest.cpp ('k') | tests/PictureBBHTest.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 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 "../src/image/SkImagePriv.h" 8 #include "../src/image/SkImagePriv.h"
9 #include "../src/image/SkSurface_Base.h" 9 #include "../src/image/SkSurface_Base.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 paint.setStyle(SkPaint::kFill_Style); 358 paint.setStyle(SkPaint::kFill_Style);
359 paint.setAlpha(255); 359 paint.setAlpha(255);
360 canvas->drawRect(partialRect, paint); 360 canvas->drawRect(partialRect, paint);
361 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); 361 REPORTER_ASSERT(reporter, !canvas->isFreshFrame());
362 } 362 }
363 363
364 // Verify that incomplete coverage due to clipping does not trigger a fresh 364 // Verify that incomplete coverage due to clipping does not trigger a fresh
365 // frame 365 // frame
366 { 366 {
367 canvas->save(); 367 canvas->save();
368 canvas->clipRect(partialRect, SkRegion::kIntersect_Op, false); 368 canvas->clipRect(partialRect);
369 SkPaint paint; 369 SkPaint paint;
370 paint.setStyle(SkPaint::kFill_Style); 370 paint.setStyle(SkPaint::kFill_Style);
371 paint.setAlpha(255); 371 paint.setAlpha(255);
372 canvas->drawRect(fullRect, paint); 372 canvas->drawRect(fullRect, paint);
373 canvas->restore(); 373 canvas->restore();
374 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); 374 REPORTER_ASSERT(reporter, !canvas->isFreshFrame());
375 } 375 }
376 { 376 {
377 canvas->save(); 377 canvas->save();
378 SkPaint paint; 378 SkPaint paint;
379 paint.setStyle(SkPaint::kFill_Style); 379 paint.setStyle(SkPaint::kFill_Style);
380 paint.setAlpha(255); 380 paint.setAlpha(255);
381 SkPath path; 381 SkPath path;
382 path.addCircle(SkIntToScalar(0), SkIntToScalar(0), SkIntToScalar(2)); 382 path.addCircle(SkIntToScalar(0), SkIntToScalar(0), SkIntToScalar(2));
383 canvas->clipPath(path, SkRegion::kIntersect_Op, false); 383 canvas->clipPath(path);
384 canvas->drawRect(fullRect, paint); 384 canvas->drawRect(fullRect, paint);
385 canvas->restore(); 385 canvas->restore();
386 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); 386 REPORTER_ASSERT(reporter, !canvas->isFreshFrame());
387 } 387 }
388 388
389 // Verify that stroked rect does not trigger a fresh frame 389 // Verify that stroked rect does not trigger a fresh frame
390 { 390 {
391 SkPaint paint; 391 SkPaint paint;
392 paint.setStyle(SkPaint::kStroke_Style); 392 paint.setStyle(SkPaint::kStroke_Style);
393 paint.setAlpha(255); 393 paint.setAlpha(255);
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 if (i == 1) { 849 if (i == 1) {
850 canvas->setSurface(newSurface); 850 canvas->setSurface(newSurface);
851 size = SkISize::Make(4, 4); 851 size = SkISize::Make(4, 4);
852 } 852 }
853 853
854 // verify that canvas size is correctly initialized or set 854 // verify that canvas size is correctly initialized or set
855 REPORTER_ASSERT(reporter, size == canvas->getCanvasSize()); 855 REPORTER_ASSERT(reporter, size == canvas->getCanvasSize());
856 856
857 // Verify that clear, clip and draw the canvas will not change its size 857 // Verify that clear, clip and draw the canvas will not change its size
858 canvas->clear(0x00000000); 858 canvas->clear(0x00000000);
859 canvas->clipRect(clip, SkRegion::kIntersect_Op, false); 859 canvas->clipRect(clip);
860 canvas->drawRect(rect, paint); 860 canvas->drawRect(rect, paint);
861 REPORTER_ASSERT(reporter, size == canvas->getCanvasSize()); 861 REPORTER_ASSERT(reporter, size == canvas->getCanvasSize());
862 862
863 // Verify that flush the canvas will not change its size 863 // Verify that flush the canvas will not change its size
864 canvas->flush(); 864 canvas->flush();
865 REPORTER_ASSERT(reporter, size == canvas->getCanvasSize()); 865 REPORTER_ASSERT(reporter, size == canvas->getCanvasSize());
866 866
867 // Verify that clear canvas with saved state will not change its size 867 // Verify that clear canvas with saved state will not change its size
868 canvas->save(); 868 canvas->save();
869 canvas->clear(0xFFFFFFFF); 869 canvas->clear(0xFFFFFFFF);
(...skipping 29 matching lines...) Expand all
899 TestDeferredCanvasSurface(reporter, NULL); 899 TestDeferredCanvasSurface(reporter, NULL);
900 TestDeferredCanvasSetSurface(reporter, NULL); 900 TestDeferredCanvasSetSurface(reporter, NULL);
901 } 901 }
902 902
903 DEF_GPUTEST(DeferredCanvas_GPU, reporter, factory) { 903 DEF_GPUTEST(DeferredCanvas_GPU, reporter, factory) {
904 if (factory != NULL) { 904 if (factory != NULL) {
905 TestDeferredCanvasSurface(reporter, factory); 905 TestDeferredCanvasSurface(reporter, factory);
906 TestDeferredCanvasSetSurface(reporter, factory); 906 TestDeferredCanvasSetSurface(reporter, factory);
907 } 907 }
908 } 908 }
OLDNEW
« no previous file with comments | « tests/CanvasTest.cpp ('k') | tests/PictureBBHTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698