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

Side by Side Diff: tests/PictureTest.cpp

Issue 544233002: "NULL !=" = NULL (Closed) Base URL: https://skia.googlesource.com/skia.git@are
Patch Set: rebase Created 6 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 unified diff | Download patch
« no previous file with comments | « tests/PathTest.cpp ('k') | tests/RTreeTest.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 "SkBBoxHierarchy.h" 8 #include "SkBBoxHierarchy.h"
9 #include "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 paint.setStyle(SkPaint::kStroke_Style); 763 paint.setStyle(SkPaint::kStroke_Style);
764 paint.setPathEffect(dash); 764 paint.setPathEffect(dash);
765 765
766 canvas->drawPath(path, paint); 766 canvas->drawPath(path, paint);
767 } 767 }
768 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); 768 SkAutoTUnref<SkPicture> picture(recorder.endRecording());
769 // path effects currently render an SkPicture undesireable for GPU rendering 769 // path effects currently render an SkPicture undesireable for GPU rendering
770 770
771 const char *reason = NULL; 771 const char *reason = NULL;
772 REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(NULL, &reaso n)); 772 REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(NULL, &reaso n));
773 REPORTER_ASSERT(reporter, NULL != reason); 773 REPORTER_ASSERT(reporter, reason);
774 774
775 canvas = GENERATE_CANVAS(recorder, useNewPath); 775 canvas = GENERATE_CANVAS(recorder, useNewPath);
776 { 776 {
777 SkPath path; 777 SkPath path;
778 778
779 path.moveTo(0, 0); 779 path.moveTo(0, 0);
780 path.lineTo(0, 50); 780 path.lineTo(0, 50);
781 path.lineTo(25, 25); 781 path.lineTo(25, 25);
782 path.lineTo(50, 50); 782 path.lineTo(50, 50);
783 path.lineTo(50, 0); 783 path.lineTo(50, 0);
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 961
962 SkAutoTUnref<SkSurface> surface(SkSurface::NewScratchRenderTarget(co ntext, info)); 962 SkAutoTUnref<SkSurface> surface(SkSurface::NewScratchRenderTarget(co ntext, info));
963 963
964 SkCanvas* canvas = surface->getCanvas(); 964 SkCanvas* canvas = surface->getCanvas();
965 965
966 canvas->EXPERIMENTAL_optimize(pict); 966 canvas->EXPERIMENTAL_optimize(pict);
967 967
968 SkPicture::AccelData::Key key = GrAccelData::ComputeAccelDataKey(); 968 SkPicture::AccelData::Key key = GrAccelData::ComputeAccelDataKey();
969 969
970 const SkPicture::AccelData* data = pict->EXPERIMENTAL_getAccelData(k ey); 970 const SkPicture::AccelData* data = pict->EXPERIMENTAL_getAccelData(k ey);
971 REPORTER_ASSERT(reporter, NULL != data); 971 REPORTER_ASSERT(reporter, data);
972 972
973 const GrAccelData *gpuData = static_cast<const GrAccelData*>(data); 973 const GrAccelData *gpuData = static_cast<const GrAccelData*>(data);
974 REPORTER_ASSERT(reporter, 8 == gpuData->numSaveLayers()); 974 REPORTER_ASSERT(reporter, 8 == gpuData->numSaveLayers());
975 975
976 const GrAccelData::SaveLayerInfo& info0 = gpuData->saveLayerInfo(0); 976 const GrAccelData::SaveLayerInfo& info0 = gpuData->saveLayerInfo(0);
977 // The parent/child layers appear in reverse order 977 // The parent/child layers appear in reverse order
978 const GrAccelData::SaveLayerInfo& info1 = gpuData->saveLayerInfo(2); 978 const GrAccelData::SaveLayerInfo& info1 = gpuData->saveLayerInfo(2);
979 const GrAccelData::SaveLayerInfo& info2 = gpuData->saveLayerInfo(1); 979 const GrAccelData::SaveLayerInfo& info2 = gpuData->saveLayerInfo(1);
980 980
981 const GrAccelData::SaveLayerInfo& info3 = gpuData->saveLayerInfo(3); 981 const GrAccelData::SaveLayerInfo& info3 = gpuData->saveLayerInfo(3);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 kHeight/2 == info2.fOffset.fY); 1016 kHeight/2 == info2.fOffset.fY);
1017 REPORTER_ASSERT(reporter, NULL == info1.fPaint); 1017 REPORTER_ASSERT(reporter, NULL == info1.fPaint);
1018 REPORTER_ASSERT(reporter, info2.fIsNested && !info2.fHasNestedLayers ); // is nested 1018 REPORTER_ASSERT(reporter, info2.fIsNested && !info2.fHasNestedLayers ); // is nested
1019 1019
1020 REPORTER_ASSERT(reporter, info3.fValid); 1020 REPORTER_ASSERT(reporter, info3.fValid);
1021 REPORTER_ASSERT(reporter, pict->uniqueID() == info3.fPictureID); 1021 REPORTER_ASSERT(reporter, pict->uniqueID() == info3.fPictureID);
1022 REPORTER_ASSERT(reporter, kWidth == info3.fSize.fWidth && 1022 REPORTER_ASSERT(reporter, kWidth == info3.fSize.fWidth &&
1023 kHeight == info3.fSize.fHeight); 1023 kHeight == info3.fSize.fHeight);
1024 REPORTER_ASSERT(reporter, info3.fOriginXform.isIdentity()); 1024 REPORTER_ASSERT(reporter, info3.fOriginXform.isIdentity());
1025 REPORTER_ASSERT(reporter, 0 == info3.fOffset.fX && 0 == info3.fOffse t.fY); 1025 REPORTER_ASSERT(reporter, 0 == info3.fOffset.fX && 0 == info3.fOffse t.fY);
1026 REPORTER_ASSERT(reporter, NULL != info3.fPaint); 1026 REPORTER_ASSERT(reporter, info3.fPaint);
1027 REPORTER_ASSERT(reporter, !info3.fIsNested && !info3.fHasNestedLayer s); 1027 REPORTER_ASSERT(reporter, !info3.fIsNested && !info3.fHasNestedLayer s);
1028 1028
1029 REPORTER_ASSERT(reporter, info4.fValid); 1029 REPORTER_ASSERT(reporter, info4.fValid);
1030 REPORTER_ASSERT(reporter, pict->uniqueID() == info4.fPictureID); 1030 REPORTER_ASSERT(reporter, pict->uniqueID() == info4.fPictureID);
1031 REPORTER_ASSERT(reporter, kWidth == info4.fSize.fWidth && 1031 REPORTER_ASSERT(reporter, kWidth == info4.fSize.fWidth &&
1032 kHeight == info4.fSize.fHeight); 1032 kHeight == info4.fSize.fHeight);
1033 REPORTER_ASSERT(reporter, 0 == info4.fOffset.fX && 0 == info4.fOffse t.fY); 1033 REPORTER_ASSERT(reporter, 0 == info4.fOffset.fX && 0 == info4.fOffse t.fY);
1034 REPORTER_ASSERT(reporter, info4.fOriginXform.isIdentity()); 1034 REPORTER_ASSERT(reporter, info4.fOriginXform.isIdentity());
1035 REPORTER_ASSERT(reporter, NULL == info4.fPaint); 1035 REPORTER_ASSERT(reporter, NULL == info4.fPaint);
1036 REPORTER_ASSERT(reporter, !info4.fIsNested && 1036 REPORTER_ASSERT(reporter, !info4.fIsNested &&
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 1941
1942 // The picture shares the immutable pixels but copies the mutable ones. 1942 // The picture shares the immutable pixels but copies the mutable ones.
1943 REPORTER_ASSERT(r, mut.pixelRef()->unique()); 1943 REPORTER_ASSERT(r, mut.pixelRef()->unique());
1944 REPORTER_ASSERT(r, !immut.pixelRef()->unique()); 1944 REPORTER_ASSERT(r, !immut.pixelRef()->unique());
1945 1945
1946 // When the picture goes away, it's just our bitmaps holding the refs. 1946 // When the picture goes away, it's just our bitmaps holding the refs.
1947 pic.reset(NULL); 1947 pic.reset(NULL);
1948 REPORTER_ASSERT(r, mut.pixelRef()->unique()); 1948 REPORTER_ASSERT(r, mut.pixelRef()->unique());
1949 REPORTER_ASSERT(r, immut.pixelRef()->unique()); 1949 REPORTER_ASSERT(r, immut.pixelRef()->unique());
1950 } 1950 }
OLDNEW
« no previous file with comments | « tests/PathTest.cpp ('k') | tests/RTreeTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698