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

Unified Diff: ui/gfx/skbitmap_operations_unittest.cc

Issue 2355583002: stop using (deprecated) setClipRegion, add flag for new clipop type (Closed)
Patch Set: rebase Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « skia/config/SkUserConfig.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/skbitmap_operations_unittest.cc
diff --git a/ui/gfx/skbitmap_operations_unittest.cc b/ui/gfx/skbitmap_operations_unittest.cc
index d41747bce58bdc608dad50e183348a0f672f52a8..778ae1166f8978c5c7521dd7578af9fa766b81de 100644
--- a/ui/gfx/skbitmap_operations_unittest.cc
+++ b/ui/gfx/skbitmap_operations_unittest.cc
@@ -506,6 +506,18 @@ TEST(SkBitmapOperationsTest, CreateTransposedBitmap) {
}
}
+void SetRectColor(SkCanvas* canvas,
danakj 2016/09/19 19:35:51 Can you name this DrawRectWithColor? Set sounds li
reed1 2016/09/19 19:42:38 Done.
+ int left,
+ int top,
+ int right,
+ int bottom,
+ SkColor color) {
+ SkPaint paint;
+ paint.setColor(color);
+ paint.setXfermodeMode(SkXfermode::kSrc_Mode);
+ canvas->drawRect(SkRect::Make({left, top, right, bottom}), paint);
danakj 2016/09/19 19:35:52 Can you use SkIRect::MakeLTRB() so we can see the
reed1 2016/09/19 19:42:38 Done.
+}
+
// Check that Rotate provides the desired results
TEST(SkBitmapOperationsTest, RotateImage) {
const int src_w = 6, src_h = 4;
@@ -519,22 +531,12 @@ TEST(SkBitmapOperationsTest, RotateImage) {
SkCanvas canvas(src);
src.eraseARGB(0, 0, 0, 0);
- SkRegion region;
- region.setRect(0, 0, src_w / 2, src_h / 2);
- canvas.setClipRegion(region);
// This region is a semi-transparent red to test non-opaque pixels.
- canvas.drawColor(0x1FFF0000, SkXfermode::kSrc_Mode);
- region.setRect(src_w / 2, 0, src_w, src_h / 2);
- canvas.setClipRegion(region);
- canvas.drawColor(SK_ColorBLUE, SkXfermode::kSrc_Mode);
- region.setRect(0, src_h / 2, src_w / 2, src_h);
- canvas.setClipRegion(region);
- canvas.drawColor(SK_ColorGREEN, SkXfermode::kSrc_Mode);
- region.setRect(src_w / 2, src_h / 2, src_w, src_h);
- canvas.setClipRegion(region);
- canvas.drawColor(SK_ColorYELLOW, SkXfermode::kSrc_Mode);
- canvas.flush();
+ SetRectColor(&canvas, 0, 0, src_w / 2, src_h / 2, 0x1FFF0000);
+ SetRectColor(&canvas, src_w / 2, 0, src_w, src_h / 2, SK_ColorBLUE);
+ SetRectColor(&canvas, 0, src_h / 2, src_w / 2, src_h, SK_ColorGREEN);
+ SetRectColor(&canvas, src_w / 2, src_h / 2, src_w, src_h, SK_ColorYELLOW);
SkBitmap rotate90, rotate180, rotate270;
rotate90 = SkBitmapOperations::Rotate(src,
« no previous file with comments | « skia/config/SkUserConfig.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698