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

Side by Side Diff: skia/ext/vector_canvas_unittest.cc

Issue 771563003: use SkClipOps where we can, legacyClip where we need to rework Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « content/renderer/skia_benchmarking_extension_unittest.cc ('k') | ui/gfx/canvas.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if !defined(OS_WIN) 7 #if !defined(OS_WIN)
8 #include <unistd.h> 8 #include <unistd.h>
9 #endif 9 #endif
10 10
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 SkPath path; 841 SkPath path;
842 path.addCircle(20, 20, 10); 842 path.addCircle(20, 20, 10);
843 vcanvas_->clipPath(path); 843 vcanvas_->clipPath(path);
844 pcanvas_->clipPath(path); 844 pcanvas_->clipPath(path);
845 845
846 vcanvas_->drawBitmap(bitmap, 14, 3, NULL); 846 vcanvas_->drawBitmap(bitmap, 14, 3, NULL);
847 pcanvas_->drawBitmap(bitmap, 14, 3, NULL); 847 pcanvas_->drawBitmap(bitmap, 14, 3, NULL);
848 EXPECT_EQ(0., ProcessImage(FILE_PATH_LITERAL("path"))); 848 EXPECT_EQ(0., ProcessImage(FILE_PATH_LITERAL("path")));
849 } 849 }
850 850
851 TEST_F(VectorCanvasTest, ClippingCombined) {
852 SkBitmap bitmap;
853 LoadPngFileToSkBitmap(test_file(L"..\\bitmaps\\bitmap_opaque.png"), &bitmap,
854 true);
855
856 SkRect rect;
857 rect.fLeft = 2;
858 rect.fTop = 2;
859 rect.fRight = 30.5f;
860 rect.fBottom = 30.5f;
861 vcanvas_->clipRect(rect);
862 pcanvas_->clipRect(rect);
863 SkPath path;
864 path.addCircle(20, 20, 10);
865 vcanvas_->clipPath(path, SkRegion::kUnion_Op);
866 pcanvas_->clipPath(path, SkRegion::kUnion_Op);
867
868 vcanvas_->drawBitmap(bitmap, 15, 3, NULL);
869 pcanvas_->drawBitmap(bitmap, 15, 3, NULL);
870 EXPECT_EQ(0., ProcessImage(FILE_PATH_LITERAL("combined")));
871 }
872
873 TEST_F(VectorCanvasTest, ClippingIntersect) { 851 TEST_F(VectorCanvasTest, ClippingIntersect) {
874 SkBitmap bitmap; 852 SkBitmap bitmap;
875 LoadPngFileToSkBitmap(test_file(L"..\\bitmaps\\bitmap_opaque.png"), &bitmap, 853 LoadPngFileToSkBitmap(test_file(L"..\\bitmaps\\bitmap_opaque.png"), &bitmap,
876 true); 854 true);
877 855
878 SkRect rect; 856 SkRect rect;
879 rect.fLeft = 2; 857 rect.fLeft = 2;
880 rect.fTop = 2; 858 rect.fTop = 2;
881 rect.fRight = 30.5f; 859 rect.fRight = 30.5f;
882 rect.fBottom = 30.5f; 860 rect.fBottom = 30.5f;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 pcanvas_->rotate(67); 939 pcanvas_->rotate(67);
962 vcanvas_->drawBitmap(bitmap, 20, -50, NULL); 940 vcanvas_->drawBitmap(bitmap, 20, -50, NULL);
963 pcanvas_->drawBitmap(bitmap, 20, -50, NULL); 941 pcanvas_->drawBitmap(bitmap, 20, -50, NULL);
964 EXPECT_EQ(0., ProcessImage(FILE_PATH_LITERAL("rotate"))); 942 EXPECT_EQ(0., ProcessImage(FILE_PATH_LITERAL("rotate")));
965 } 943 }
966 } 944 }
967 945
968 #endif // !defined(USE_AURA) 946 #endif // !defined(USE_AURA)
969 947
970 } // namespace skia 948 } // namespace skia
OLDNEW
« no previous file with comments | « content/renderer/skia_benchmarking_extension_unittest.cc ('k') | ui/gfx/canvas.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698