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

Side by Side Diff: tests/PictureTest.cpp

Issue 640773004: Add clip to layer cache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: clean up Created 6 years, 2 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 | « tests/GpuLayerCacheTest.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 963 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 974
975 // The parent/child layers appear in reverse order 975 // The parent/child layers appear in reverse order
976 const GrAccelData::SaveLayerInfo& info4 = gpuData->saveLayerInfo(5); 976 const GrAccelData::SaveLayerInfo& info4 = gpuData->saveLayerInfo(5);
977 const GrAccelData::SaveLayerInfo& info5 = gpuData->saveLayerInfo(4); 977 const GrAccelData::SaveLayerInfo& info5 = gpuData->saveLayerInfo(4);
978 978
979 // The parent/child layers appear in reverse order 979 // The parent/child layers appear in reverse order
980 const GrAccelData::SaveLayerInfo& info6 = gpuData->saveLayerInfo(7); 980 const GrAccelData::SaveLayerInfo& info6 = gpuData->saveLayerInfo(7);
981 const GrAccelData::SaveLayerInfo& info7 = gpuData->saveLayerInfo(6); 981 const GrAccelData::SaveLayerInfo& info7 = gpuData->saveLayerInfo(6);
982 982
983 REPORTER_ASSERT(reporter, NULL == info0.fPicture); 983 REPORTER_ASSERT(reporter, NULL == info0.fPicture);
984 REPORTER_ASSERT(reporter, kWidth == info0.fSize.fWidth && 984 REPORTER_ASSERT(reporter, kWidth == info0.fBounds.width() &&
985 kHeight == info0.fSize.fHeight); 985 kHeight == info0.fBounds.height());
986 REPORTER_ASSERT(reporter, info0.fOriginXform.isIdentity()); 986 REPORTER_ASSERT(reporter, info0.fOriginXform.isIdentity());
987 REPORTER_ASSERT(reporter, 0 == info0.fOffset.fX && 0 == info0.fOffse t.fY); 987 REPORTER_ASSERT(reporter, 0 == info0.fBounds.fLeft && 0 == info0.fBo unds.fTop);
988 REPORTER_ASSERT(reporter, NULL == info0.fPaint); 988 REPORTER_ASSERT(reporter, NULL == info0.fPaint);
989 REPORTER_ASSERT(reporter, !info0.fIsNested && !info0.fHasNestedLayer s); 989 REPORTER_ASSERT(reporter, !info0.fIsNested && !info0.fHasNestedLayer s);
990 990
991 REPORTER_ASSERT(reporter, NULL == info1.fPicture); 991 REPORTER_ASSERT(reporter, NULL == info1.fPicture);
992 REPORTER_ASSERT(reporter, kWidth == info1.fSize.fWidth && 992 REPORTER_ASSERT(reporter, kWidth == info1.fBounds.width() &&
993 kHeight == info1.fSize.fHeight); 993 kHeight == info1.fBounds.height());
994 REPORTER_ASSERT(reporter, info1.fOriginXform.isIdentity()); 994 REPORTER_ASSERT(reporter, info1.fOriginXform.isIdentity());
995 REPORTER_ASSERT(reporter, 0 == info1.fOffset.fX && 0 == info1.fOffse t.fY); 995 REPORTER_ASSERT(reporter, 0 == info1.fBounds.fLeft && 0 == info1.fBo unds.fTop);
996 REPORTER_ASSERT(reporter, NULL == info1.fPaint); 996 REPORTER_ASSERT(reporter, NULL == info1.fPaint);
997 REPORTER_ASSERT(reporter, !info1.fIsNested && 997 REPORTER_ASSERT(reporter, !info1.fIsNested &&
998 info1.fHasNestedLayers); // has a nested S L 998 info1.fHasNestedLayers); // has a nested S L
999 999
1000 REPORTER_ASSERT(reporter, NULL == info2.fPicture); 1000 REPORTER_ASSERT(reporter, NULL == info2.fPicture);
1001 REPORTER_ASSERT(reporter, kWidth / 2 == info2.fSize.fWidth && 1001 REPORTER_ASSERT(reporter, kWidth / 2 == info2.fBounds.width() &&
1002 kHeight/2 == info2.fSize.fHeight); // boun d reduces size 1002 kHeight / 2 == info2.fBounds.height()); // bound reduces size
1003 REPORTER_ASSERT(reporter, !info2.fOriginXform.isIdentity()); 1003 REPORTER_ASSERT(reporter, !info2.fOriginXform.isIdentity());
1004 REPORTER_ASSERT(reporter, kWidth/2 == info2.fOffset.fX && // trans lated 1004 REPORTER_ASSERT(reporter, kWidth / 2 == info2.fBounds.fLeft && // translated
1005 kHeight/2 == info2.fOffset.fY); 1005 kHeight / 2 == info2.fBounds.fTop);
1006 REPORTER_ASSERT(reporter, NULL == info1.fPaint); 1006 REPORTER_ASSERT(reporter, NULL == info1.fPaint);
1007 REPORTER_ASSERT(reporter, info2.fIsNested && !info2.fHasNestedLayers ); // is nested 1007 REPORTER_ASSERT(reporter, info2.fIsNested && !info2.fHasNestedLayers ); // is nested
1008 1008
1009 REPORTER_ASSERT(reporter, NULL == info3.fPicture); 1009 REPORTER_ASSERT(reporter, NULL == info3.fPicture);
1010 REPORTER_ASSERT(reporter, kWidth == info3.fSize.fWidth && 1010 REPORTER_ASSERT(reporter, kWidth == info3.fBounds.width() &&
1011 kHeight == info3.fSize.fHeight); 1011 kHeight == info3.fBounds.height());
1012 REPORTER_ASSERT(reporter, info3.fOriginXform.isIdentity()); 1012 REPORTER_ASSERT(reporter, info3.fOriginXform.isIdentity());
1013 REPORTER_ASSERT(reporter, 0 == info3.fOffset.fX && 0 == info3.fOffse t.fY); 1013 REPORTER_ASSERT(reporter, 0 == info3.fBounds.fLeft && 0 == info3.fBo unds.fTop);
1014 REPORTER_ASSERT(reporter, info3.fPaint); 1014 REPORTER_ASSERT(reporter, info3.fPaint);
1015 REPORTER_ASSERT(reporter, !info3.fIsNested && !info3.fHasNestedLayer s); 1015 REPORTER_ASSERT(reporter, !info3.fIsNested && !info3.fHasNestedLayer s);
1016 1016
1017 REPORTER_ASSERT(reporter, NULL == info4.fPicture); 1017 REPORTER_ASSERT(reporter, NULL == info4.fPicture);
1018 REPORTER_ASSERT(reporter, kWidth == info4.fSize.fWidth && 1018 REPORTER_ASSERT(reporter, kWidth == info4.fBounds.width() &&
1019 kHeight == info4.fSize.fHeight); 1019 kHeight == info4.fBounds.height());
1020 REPORTER_ASSERT(reporter, 0 == info4.fOffset.fX && 0 == info4.fOffse t.fY); 1020 REPORTER_ASSERT(reporter, 0 == info4.fBounds.fLeft && 0 == info4.fBo unds.fTop);
1021 REPORTER_ASSERT(reporter, info4.fOriginXform.isIdentity()); 1021 REPORTER_ASSERT(reporter, info4.fOriginXform.isIdentity());
1022 REPORTER_ASSERT(reporter, info4.fPaint); 1022 REPORTER_ASSERT(reporter, info4.fPaint);
1023 REPORTER_ASSERT(reporter, !info4.fIsNested && 1023 REPORTER_ASSERT(reporter, !info4.fIsNested &&
1024 info4.fHasNestedLayers); // has a nested S L 1024 info4.fHasNestedLayers); // has a nested S L
1025 1025
1026 REPORTER_ASSERT(reporter, child == info5.fPicture); // in a child pi cture 1026 REPORTER_ASSERT(reporter, child == info5.fPicture); // in a child pi cture
1027 REPORTER_ASSERT(reporter, kWidth == info5.fSize.fWidth && 1027 REPORTER_ASSERT(reporter, kWidth == info5.fBounds.width() &&
1028 kHeight == info5.fSize.fHeight); 1028 kHeight == info5.fBounds.height());
1029 REPORTER_ASSERT(reporter, 0 == info5.fOffset.fX && 0 == info5.fOffse t.fY); 1029 REPORTER_ASSERT(reporter, 0 == info5.fBounds.fLeft && 0 == info5.fBo unds.fTop);
1030 REPORTER_ASSERT(reporter, info5.fOriginXform.isIdentity()); 1030 REPORTER_ASSERT(reporter, info5.fOriginXform.isIdentity());
1031 REPORTER_ASSERT(reporter, NULL == info5.fPaint); 1031 REPORTER_ASSERT(reporter, NULL == info5.fPaint);
1032 REPORTER_ASSERT(reporter, info5.fIsNested && !info5.fHasNestedLayers ); // is nested 1032 REPORTER_ASSERT(reporter, info5.fIsNested && !info5.fHasNestedLayers ); // is nested
1033 1033
1034 REPORTER_ASSERT(reporter, NULL == info6.fPicture); 1034 REPORTER_ASSERT(reporter, NULL == info6.fPicture);
1035 REPORTER_ASSERT(reporter, kWidth == info6.fSize.fWidth && 1035 REPORTER_ASSERT(reporter, kWidth == info6.fBounds.width() &&
1036 kHeight == info6.fSize.fHeight); 1036 kHeight == info6.fBounds.height());
1037 REPORTER_ASSERT(reporter, 0 == info6.fOffset.fX && 0 == info6.fOffse t.fY); 1037 REPORTER_ASSERT(reporter, 0 == info6.fBounds.fLeft && 0 == info6.fBo unds.fTop);
1038 REPORTER_ASSERT(reporter, info6.fOriginXform.isIdentity()); 1038 REPORTER_ASSERT(reporter, info6.fOriginXform.isIdentity());
1039 REPORTER_ASSERT(reporter, info6.fPaint); 1039 REPORTER_ASSERT(reporter, info6.fPaint);
1040 REPORTER_ASSERT(reporter, !info6.fIsNested && 1040 REPORTER_ASSERT(reporter, !info6.fIsNested &&
1041 info6.fHasNestedLayers); // has a nested S L 1041 info6.fHasNestedLayers); // has a nested S L
1042 1042
1043 REPORTER_ASSERT(reporter, child == info7.fPicture); // in a child pi cture 1043 REPORTER_ASSERT(reporter, child == info7.fPicture); // in a child pi cture
1044 REPORTER_ASSERT(reporter, kWidth == info7.fSize.fWidth && 1044 REPORTER_ASSERT(reporter, kWidth == info7.fBounds.width() &&
1045 kHeight == info7.fSize.fHeight); 1045 kHeight == info7.fBounds.height());
1046 REPORTER_ASSERT(reporter, 0 == info7.fOffset.fX && 0 == info7.fOffse t.fY); 1046 REPORTER_ASSERT(reporter, 0 == info7.fBounds.fLeft && 0 == info7.fBo unds.fTop);
1047 REPORTER_ASSERT(reporter, info7.fOriginXform.isIdentity()); 1047 REPORTER_ASSERT(reporter, info7.fOriginXform.isIdentity());
1048 REPORTER_ASSERT(reporter, NULL == info7.fPaint); 1048 REPORTER_ASSERT(reporter, NULL == info7.fPaint);
1049 REPORTER_ASSERT(reporter, info7.fIsNested && !info7.fHasNestedLayers ); // is nested 1049 REPORTER_ASSERT(reporter, info7.fIsNested && !info7.fHasNestedLayers ); // is nested
1050 } 1050 }
1051 } 1051 }
1052 } 1052 }
1053 1053
1054 #endif 1054 #endif
1055 1055
1056 static void test_has_text(skiatest::Reporter* reporter) { 1056 static void test_has_text(skiatest::Reporter* reporter) {
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after
1912 1912
1913 // The picture shares the immutable pixels but copies the mutable ones. 1913 // The picture shares the immutable pixels but copies the mutable ones.
1914 REPORTER_ASSERT(r, mut.pixelRef()->unique()); 1914 REPORTER_ASSERT(r, mut.pixelRef()->unique());
1915 REPORTER_ASSERT(r, !immut.pixelRef()->unique()); 1915 REPORTER_ASSERT(r, !immut.pixelRef()->unique());
1916 1916
1917 // When the picture goes away, it's just our bitmaps holding the refs. 1917 // When the picture goes away, it's just our bitmaps holding the refs.
1918 pic.reset(NULL); 1918 pic.reset(NULL);
1919 REPORTER_ASSERT(r, mut.pixelRef()->unique()); 1919 REPORTER_ASSERT(r, mut.pixelRef()->unique());
1920 REPORTER_ASSERT(r, immut.pixelRef()->unique()); 1920 REPORTER_ASSERT(r, immut.pixelRef()->unique());
1921 } 1921 }
OLDNEW
« no previous file with comments | « tests/GpuLayerCacheTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698