OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkBitmapDevice.h" | 10 #include "SkBitmapDevice.h" |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 matrix.setTranslate(SK_Scalar1, SK_Scalar1); | 583 matrix.setTranslate(SK_Scalar1, SK_Scalar1); |
584 matrix.postRotate(SkIntToScalar(45), SK_Scalar1, SK_Scalar1); | 584 matrix.postRotate(SkIntToScalar(45), SK_Scalar1, SK_Scalar1); |
585 | 585 |
586 SkRTreeFactory factory; | 586 SkRTreeFactory factory; |
587 SkPictureRecorder recorder; | 587 SkPictureRecorder recorder; |
588 SkCanvas* recordingCanvas = recorder.beginRecording(64, 64, &factory, 0); | 588 SkCanvas* recordingCanvas = recorder.beginRecording(64, 64, &factory, 0); |
589 | 589 |
590 SkPaint greenPaint; | 590 SkPaint greenPaint; |
591 greenPaint.setColor(SK_ColorGREEN); | 591 greenPaint.setColor(SK_ColorGREEN); |
592 recordingCanvas->drawRect(SkRect::Make(SkIRect::MakeXYWH(10, 10, 30, 20)), g
reenPaint); | 592 recordingCanvas->drawRect(SkRect::Make(SkIRect::MakeXYWH(10, 10, 30, 20)), g
reenPaint); |
593 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | 593 sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture()); |
594 SkAutoTUnref<SkImageFilter> pictureFilter(SkPictureImageFilter::Create(pictu
re.get())); | 594 SkAutoTUnref<SkImageFilter> pictureFilter(SkPictureImageFilter::Create(pictu
re.get())); |
595 SkAutoTUnref<SkShader> shader(SkPerlinNoiseShader::CreateTurbulence(SK_Scala
r1, SK_Scalar1, 1, 0)); | 595 SkAutoTUnref<SkShader> shader(SkPerlinNoiseShader::CreateTurbulence(SK_Scala
r1, SK_Scalar1, 1, 0)); |
596 SkPaint noisePaint; | 596 SkPaint noisePaint; |
597 noisePaint.setShader(shader); | 597 noisePaint.setShader(shader); |
598 | 598 |
599 SkAutoTUnref<SkImageFilter> paintFilter(SkPaintImageFilter::Create(noisePain
t)); | 599 SkAutoTUnref<SkImageFilter> paintFilter(SkPaintImageFilter::Create(noisePain
t)); |
600 | 600 |
601 SkImageFilter::CropRect leftSideCropRect(SkRect::MakeXYWH(0, 0, 32, 64)); | 601 SkImageFilter::CropRect leftSideCropRect(SkRect::MakeXYWH(0, 0, 32, 64)); |
602 SkAutoTUnref<SkImageFilter> paintFilterLeft(SkPaintImageFilter::Create(green
Paint, &leftSideCropRect)); | 602 SkAutoTUnref<SkImageFilter> paintFilterLeft(SkPaintImageFilter::Create(green
Paint, &leftSideCropRect)); |
603 SkImageFilter::CropRect rightSideCropRect(SkRect::MakeXYWH(32, 0, 32, 64)); | 603 SkImageFilter::CropRect rightSideCropRect(SkRect::MakeXYWH(32, 0, 32, 64)); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 SkPaint paint; | 700 SkPaint paint; |
701 paint.setImageFilter(imageFilter.get()); | 701 paint.setImageFilter(imageFilter.get()); |
702 SkPictureRecorder recorder; | 702 SkPictureRecorder recorder; |
703 SkRect bounds = SkRect::Make(SkIRect::MakeXYWH(0, 0, 50, 50)); | 703 SkRect bounds = SkRect::Make(SkIRect::MakeXYWH(0, 0, 50, 50)); |
704 SkCanvas* recordingCanvas = recorder.beginRecording(SkIntToScalar(width), | 704 SkCanvas* recordingCanvas = recorder.beginRecording(SkIntToScalar(width), |
705 SkIntToScalar(height), | 705 SkIntToScalar(height), |
706 factory, 0); | 706 factory, 0); |
707 recordingCanvas->translate(-55, 0); | 707 recordingCanvas->translate(-55, 0); |
708 recordingCanvas->saveLayer(&bounds, &paint); | 708 recordingCanvas->saveLayer(&bounds, &paint); |
709 recordingCanvas->restore(); | 709 recordingCanvas->restore(); |
710 SkAutoTUnref<SkPicture> picture1(recorder.endRecording()); | 710 sk_sp<SkPicture> picture1(recorder.finishRecordingAsPicture()); |
711 | 711 |
712 result->allocN32Pixels(width, height); | 712 result->allocN32Pixels(width, height); |
713 SkCanvas canvas(*result); | 713 SkCanvas canvas(*result); |
714 canvas.clear(0); | 714 canvas.clear(0); |
715 canvas.clipRect(SkRect::Make(SkIRect::MakeWH(tileSize, tileSize))); | 715 canvas.clipRect(SkRect::Make(SkIRect::MakeWH(tileSize, tileSize))); |
716 canvas.drawPicture(picture1.get()); | 716 canvas.drawPicture(picture1.get()); |
717 } | 717 } |
718 | 718 |
719 DEF_TEST(ImageFilterDrawMatrixBBH, reporter) { | 719 DEF_TEST(ImageFilterDrawMatrixBBH, reporter) { |
720 // Check that matrix filter when drawn tiled with BBH exactly | 720 // Check that matrix filter when drawn tiled with BBH exactly |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 SkPictureRecorder recorder1, recorder2; | 893 SkPictureRecorder recorder1, recorder2; |
894 // The only difference between these two pictures is that one has RTree acel
eration. | 894 // The only difference between these two pictures is that one has RTree acel
eration. |
895 SkCanvas* recordingCanvas1 = recorder1.beginRecording(SkIntToScalar(width), | 895 SkCanvas* recordingCanvas1 = recorder1.beginRecording(SkIntToScalar(width), |
896 SkIntToScalar(height), | 896 SkIntToScalar(height), |
897 nullptr, 0); | 897 nullptr, 0); |
898 SkCanvas* recordingCanvas2 = recorder2.beginRecording(SkIntToScalar(width), | 898 SkCanvas* recordingCanvas2 = recorder2.beginRecording(SkIntToScalar(width), |
899 SkIntToScalar(height), | 899 SkIntToScalar(height), |
900 &factory, 0); | 900 &factory, 0); |
901 draw_blurred_rect(recordingCanvas1); | 901 draw_blurred_rect(recordingCanvas1); |
902 draw_blurred_rect(recordingCanvas2); | 902 draw_blurred_rect(recordingCanvas2); |
903 SkAutoTUnref<SkPicture> picture1(recorder1.endRecording()); | 903 sk_sp<SkPicture> picture1(recorder1.finishRecordingAsPicture()); |
904 SkAutoTUnref<SkPicture> picture2(recorder2.endRecording()); | 904 sk_sp<SkPicture> picture2(recorder2.finishRecordingAsPicture()); |
905 for (int y = 0; y < height; y += tileSize) { | 905 for (int y = 0; y < height; y += tileSize) { |
906 for (int x = 0; x < width; x += tileSize) { | 906 for (int x = 0; x < width; x += tileSize) { |
907 SkRect tileRect = SkRect::Make(SkIRect::MakeXYWH(x, y, tileSize, til
eSize)); | 907 SkRect tileRect = SkRect::Make(SkIRect::MakeXYWH(x, y, tileSize, til
eSize)); |
908 draw_picture_clipped(&canvas1, tileRect, picture1); | 908 draw_picture_clipped(&canvas1, tileRect, picture1.get()); |
909 draw_picture_clipped(&canvas2, tileRect, picture2); | 909 draw_picture_clipped(&canvas2, tileRect, picture2.get()); |
910 } | 910 } |
911 } | 911 } |
912 for (int y = 0; y < height; y++) { | 912 for (int y = 0; y < height; y++) { |
913 int diffs = memcmp(result1.getAddr32(0, y), result2.getAddr32(0, y), res
ult1.rowBytes()); | 913 int diffs = memcmp(result1.getAddr32(0, y), result2.getAddr32(0, y), res
ult1.rowBytes()); |
914 REPORTER_ASSERT(reporter, !diffs); | 914 REPORTER_ASSERT(reporter, !diffs); |
915 if (diffs) { | 915 if (diffs) { |
916 break; | 916 break; |
917 } | 917 } |
918 } | 918 } |
919 } | 919 } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 new MatrixTestImageFilter(reporter, expectedMatrix)); | 1003 new MatrixTestImageFilter(reporter, expectedMatrix)); |
1004 paint.setImageFilter(imageFilter.get()); | 1004 paint.setImageFilter(imageFilter.get()); |
1005 recordingCanvas->saveLayer(nullptr, &paint); | 1005 recordingCanvas->saveLayer(nullptr, &paint); |
1006 SkPaint solidPaint; | 1006 SkPaint solidPaint; |
1007 solidPaint.setColor(0xFFFFFFFF); | 1007 solidPaint.setColor(0xFFFFFFFF); |
1008 recordingCanvas->save(); | 1008 recordingCanvas->save(); |
1009 recordingCanvas->scale(SkIntToScalar(10), SkIntToScalar(10)); | 1009 recordingCanvas->scale(SkIntToScalar(10), SkIntToScalar(10)); |
1010 recordingCanvas->drawRect(SkRect::Make(SkIRect::MakeWH(100, 100)), solidPain
t); | 1010 recordingCanvas->drawRect(SkRect::Make(SkIRect::MakeWH(100, 100)), solidPain
t); |
1011 recordingCanvas->restore(); // scale | 1011 recordingCanvas->restore(); // scale |
1012 recordingCanvas->restore(); // saveLayer | 1012 recordingCanvas->restore(); // saveLayer |
1013 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | |
1014 | 1013 |
1015 canvas.drawPicture(picture); | 1014 canvas.drawPicture(recorder.finishRecordingAsPicture()); |
1016 } | 1015 } |
1017 | 1016 |
1018 DEF_TEST(ImageFilterCrossProcessPictureImageFilter, reporter) { | 1017 DEF_TEST(ImageFilterCrossProcessPictureImageFilter, reporter) { |
1019 SkRTreeFactory factory; | 1018 SkRTreeFactory factory; |
1020 SkPictureRecorder recorder; | 1019 SkPictureRecorder recorder; |
1021 SkCanvas* recordingCanvas = recorder.beginRecording(1, 1, &factory, 0); | 1020 SkCanvas* recordingCanvas = recorder.beginRecording(1, 1, &factory, 0); |
1022 | 1021 |
1023 // Create an SkPicture which simply draws a green 1x1 rectangle. | 1022 // Create an SkPicture which simply draws a green 1x1 rectangle. |
1024 SkPaint greenPaint; | 1023 SkPaint greenPaint; |
1025 greenPaint.setColor(SK_ColorGREEN); | 1024 greenPaint.setColor(SK_ColorGREEN); |
1026 recordingCanvas->drawRect(SkRect::Make(SkIRect::MakeWH(1, 1)), greenPaint); | 1025 recordingCanvas->drawRect(SkRect::Make(SkIRect::MakeWH(1, 1)), greenPaint); |
1027 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | 1026 sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture()); |
1028 | 1027 |
1029 // Wrap that SkPicture in an SkPictureImageFilter. | 1028 // Wrap that SkPicture in an SkPictureImageFilter. |
1030 SkAutoTUnref<SkImageFilter> imageFilter( | 1029 SkAutoTUnref<SkImageFilter> imageFilter( |
1031 SkPictureImageFilter::Create(picture.get())); | 1030 SkPictureImageFilter::Create(picture.get())); |
1032 | 1031 |
1033 // Check that SkPictureImageFilter successfully serializes its contained | 1032 // Check that SkPictureImageFilter successfully serializes its contained |
1034 // SkPicture when not in cross-process mode. | 1033 // SkPicture when not in cross-process mode. |
1035 SkPaint paint; | 1034 SkPaint paint; |
1036 paint.setImageFilter(imageFilter.get()); | 1035 paint.setImageFilter(imageFilter.get()); |
1037 SkPictureRecorder outerRecorder; | 1036 SkPictureRecorder outerRecorder; |
1038 SkCanvas* outerCanvas = outerRecorder.beginRecording(1, 1, &factory, 0); | 1037 SkCanvas* outerCanvas = outerRecorder.beginRecording(1, 1, &factory, 0); |
1039 SkPaint redPaintWithFilter; | 1038 SkPaint redPaintWithFilter; |
1040 redPaintWithFilter.setColor(SK_ColorRED); | 1039 redPaintWithFilter.setColor(SK_ColorRED); |
1041 redPaintWithFilter.setImageFilter(imageFilter.get()); | 1040 redPaintWithFilter.setImageFilter(imageFilter.get()); |
1042 outerCanvas->drawRect(SkRect::Make(SkIRect::MakeWH(1, 1)), redPaintWithFilte
r); | 1041 outerCanvas->drawRect(SkRect::Make(SkIRect::MakeWH(1, 1)), redPaintWithFilte
r); |
1043 SkAutoTUnref<SkPicture> outerPicture(outerRecorder.endRecording()); | 1042 sk_sp<SkPicture> outerPicture(outerRecorder.finishRecordingAsPicture()); |
1044 | 1043 |
1045 SkBitmap bitmap; | 1044 SkBitmap bitmap; |
1046 bitmap.allocN32Pixels(1, 1); | 1045 bitmap.allocN32Pixels(1, 1); |
1047 SkCanvas canvas(bitmap); | 1046 SkCanvas canvas(bitmap); |
1048 | 1047 |
1049 // The result here should be green, since the filter replaces the primitive'
s red interior. | 1048 // The result here should be green, since the filter replaces the primitive'
s red interior. |
1050 canvas.clear(0x0); | 1049 canvas.clear(0x0); |
1051 canvas.drawPicture(outerPicture); | 1050 canvas.drawPicture(outerPicture); |
1052 uint32_t pixel = *bitmap.getAddr32(0, 0); | 1051 uint32_t pixel = *bitmap.getAddr32(0, 0); |
1053 REPORTER_ASSERT(reporter, pixel == SK_ColorGREEN); | 1052 REPORTER_ASSERT(reporter, pixel == SK_ColorGREEN); |
1054 | 1053 |
1055 // Check that, for now, SkPictureImageFilter does not serialize or | 1054 // Check that, for now, SkPictureImageFilter does not serialize or |
1056 // deserialize its contained picture when the filter is serialized | 1055 // deserialize its contained picture when the filter is serialized |
1057 // cross-process. Do this by "laundering" it through SkValidatingReadBuffer. | 1056 // cross-process. Do this by "laundering" it through SkValidatingReadBuffer. |
1058 SkAutoTUnref<SkData> data(SkValidatingSerializeFlattenable(imageFilter.get()
)); | 1057 SkAutoTUnref<SkData> data(SkValidatingSerializeFlattenable(imageFilter.get()
)); |
1059 SkAutoTUnref<SkFlattenable> flattenable(SkValidatingDeserializeFlattenable( | 1058 SkAutoTUnref<SkFlattenable> flattenable(SkValidatingDeserializeFlattenable( |
1060 data->data(), data->size(), SkImageFilter::GetFlattenableType())); | 1059 data->data(), data->size(), SkImageFilter::GetFlattenableType())); |
1061 SkImageFilter* unflattenedFilter = static_cast<SkImageFilter*>(flattenable.g
et()); | 1060 SkImageFilter* unflattenedFilter = static_cast<SkImageFilter*>(flattenable.g
et()); |
1062 | 1061 |
1063 redPaintWithFilter.setImageFilter(unflattenedFilter); | 1062 redPaintWithFilter.setImageFilter(unflattenedFilter); |
1064 SkPictureRecorder crossProcessRecorder; | 1063 SkPictureRecorder crossProcessRecorder; |
1065 SkCanvas* crossProcessCanvas = crossProcessRecorder.beginRecording(1, 1, &fa
ctory, 0); | 1064 SkCanvas* crossProcessCanvas = crossProcessRecorder.beginRecording(1, 1, &fa
ctory, 0); |
1066 crossProcessCanvas->drawRect(SkRect::Make(SkIRect::MakeWH(1, 1)), redPaintWi
thFilter); | 1065 crossProcessCanvas->drawRect(SkRect::Make(SkIRect::MakeWH(1, 1)), redPaintWi
thFilter); |
1067 SkAutoTUnref<SkPicture> crossProcessPicture(crossProcessRecorder.endRecordin
g()); | 1066 sk_sp<SkPicture> crossProcessPicture(crossProcessRecorder.finishRecordingAsP
icture()); |
1068 | 1067 |
1069 canvas.clear(0x0); | 1068 canvas.clear(0x0); |
1070 canvas.drawPicture(crossProcessPicture); | 1069 canvas.drawPicture(crossProcessPicture); |
1071 pixel = *bitmap.getAddr32(0, 0); | 1070 pixel = *bitmap.getAddr32(0, 0); |
1072 // If the security precautions are enabled, the result here should not be gr
een, since the | 1071 // If the security precautions are enabled, the result here should not be gr
een, since the |
1073 // filter draws nothing. | 1072 // filter draws nothing. |
1074 REPORTER_ASSERT(reporter, SkPicture::PictureIOSecurityPrecautionsEnabled() | 1073 REPORTER_ASSERT(reporter, SkPicture::PictureIOSecurityPrecautionsEnabled() |
1075 ? pixel != SK_ColorGREEN : pixel == SK_ColorGREEN); | 1074 ? pixel != SK_ColorGREEN : pixel == SK_ColorGREEN); |
1076 } | 1075 } |
1077 | 1076 |
1078 static void test_clipped_picture_imagefilter(SkImageFilter::Proxy* proxy, | 1077 static void test_clipped_picture_imagefilter(SkImageFilter::Proxy* proxy, |
1079 skiatest::Reporter* reporter, | 1078 skiatest::Reporter* reporter, |
1080 GrContext* context) { | 1079 GrContext* context) { |
1081 SkAutoTUnref<SkPicture> picture; | 1080 sk_sp<SkPicture> picture; |
1082 | 1081 |
1083 { | 1082 { |
1084 SkRTreeFactory factory; | 1083 SkRTreeFactory factory; |
1085 SkPictureRecorder recorder; | 1084 SkPictureRecorder recorder; |
1086 SkCanvas* recordingCanvas = recorder.beginRecording(1, 1, &factory, 0); | 1085 SkCanvas* recordingCanvas = recorder.beginRecording(1, 1, &factory, 0); |
1087 | 1086 |
1088 // Create an SkPicture which simply draws a green 1x1 rectangle. | 1087 // Create an SkPicture which simply draws a green 1x1 rectangle. |
1089 SkPaint greenPaint; | 1088 SkPaint greenPaint; |
1090 greenPaint.setColor(SK_ColorGREEN); | 1089 greenPaint.setColor(SK_ColorGREEN); |
1091 recordingCanvas->drawRect(SkRect::Make(SkIRect::MakeWH(1, 1)), greenPain
t); | 1090 recordingCanvas->drawRect(SkRect::Make(SkIRect::MakeWH(1, 1)), greenPain
t); |
1092 picture.reset(recorder.endRecording()); | 1091 picture = recorder.finishRecordingAsPicture(); |
1093 } | 1092 } |
1094 | 1093 |
1095 sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, proxy, 2)); | 1094 sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, proxy, 2)); |
1096 | 1095 |
1097 SkAutoTUnref<SkImageFilter> imageFilter(SkPictureImageFilter::Create(picture
.get())); | 1096 SkAutoTUnref<SkImageFilter> imageFilter(SkPictureImageFilter::Create(picture
.get())); |
1098 | 1097 |
1099 SkIPoint offset; | 1098 SkIPoint offset; |
1100 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeXYWH(1, 1, 1, 1), nul
lptr); | 1099 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeXYWH(1, 1, 1, 1), nul
lptr); |
1101 | 1100 |
1102 SkAutoTUnref<SkSpecialImage> resultImage(imageFilter->filterImage(srcImg.get
(), ctx, &offset)); | 1101 SkAutoTUnref<SkSpecialImage> resultImage(imageFilter->filterImage(srcImg.get
(), ctx, &offset)); |
(...skipping 28 matching lines...) Expand all Loading... |
1131 SkPaint imageFilterPaint; | 1130 SkPaint imageFilterPaint; |
1132 imageFilterPaint.setImageFilter(imageFilter.get()); | 1131 imageFilterPaint.setImageFilter(imageFilter.get()); |
1133 SkPaint colorFilterPaint; | 1132 SkPaint colorFilterPaint; |
1134 colorFilterPaint.setColorFilter(green.get()); | 1133 colorFilterPaint.setColorFilter(green.get()); |
1135 | 1134 |
1136 SkRect bounds = SkRect::MakeWH(10, 10); | 1135 SkRect bounds = SkRect::MakeWH(10, 10); |
1137 | 1136 |
1138 SkCanvas* recordingCanvas = recorder.beginRecording(10, 10, &factory, 0); | 1137 SkCanvas* recordingCanvas = recorder.beginRecording(10, 10, &factory, 0); |
1139 recordingCanvas->saveLayer(&bounds, &imageFilterPaint); | 1138 recordingCanvas->saveLayer(&bounds, &imageFilterPaint); |
1140 recordingCanvas->restore(); | 1139 recordingCanvas->restore(); |
1141 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | 1140 sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture()); |
1142 | 1141 |
1143 canvas.clear(0); | 1142 canvas.clear(0); |
1144 canvas.drawPicture(picture); | 1143 canvas.drawPicture(picture); |
1145 uint32_t pixel = *bitmap.getAddr32(0, 0); | 1144 uint32_t pixel = *bitmap.getAddr32(0, 0); |
1146 REPORTER_ASSERT(reporter, pixel == SK_ColorGREEN); | 1145 REPORTER_ASSERT(reporter, pixel == SK_ColorGREEN); |
1147 | 1146 |
1148 recordingCanvas = recorder.beginRecording(10, 10, &factory, 0); | 1147 recordingCanvas = recorder.beginRecording(10, 10, &factory, 0); |
1149 recordingCanvas->saveLayer(nullptr, &imageFilterPaint); | 1148 recordingCanvas->saveLayer(nullptr, &imageFilterPaint); |
1150 recordingCanvas->restore(); | 1149 recordingCanvas->restore(); |
1151 SkAutoTUnref<SkPicture> picture2(recorder.endRecording()); | 1150 sk_sp<SkPicture> picture2(recorder.finishRecordingAsPicture()); |
1152 | 1151 |
1153 canvas.clear(0); | 1152 canvas.clear(0); |
1154 canvas.drawPicture(picture2); | 1153 canvas.drawPicture(picture2); |
1155 pixel = *bitmap.getAddr32(0, 0); | 1154 pixel = *bitmap.getAddr32(0, 0); |
1156 REPORTER_ASSERT(reporter, pixel == SK_ColorGREEN); | 1155 REPORTER_ASSERT(reporter, pixel == SK_ColorGREEN); |
1157 | 1156 |
1158 recordingCanvas = recorder.beginRecording(10, 10, &factory, 0); | 1157 recordingCanvas = recorder.beginRecording(10, 10, &factory, 0); |
1159 recordingCanvas->saveLayer(&bounds, &colorFilterPaint); | 1158 recordingCanvas->saveLayer(&bounds, &colorFilterPaint); |
1160 recordingCanvas->restore(); | 1159 recordingCanvas->restore(); |
1161 SkAutoTUnref<SkPicture> picture3(recorder.endRecording()); | 1160 sk_sp<SkPicture> picture3(recorder.finishRecordingAsPicture()); |
1162 | 1161 |
1163 canvas.clear(0); | 1162 canvas.clear(0); |
1164 canvas.drawPicture(picture3); | 1163 canvas.drawPicture(picture3); |
1165 pixel = *bitmap.getAddr32(0, 0); | 1164 pixel = *bitmap.getAddr32(0, 0); |
1166 REPORTER_ASSERT(reporter, pixel == SK_ColorGREEN); | 1165 REPORTER_ASSERT(reporter, pixel == SK_ColorGREEN); |
1167 } | 1166 } |
1168 | 1167 |
1169 static void test_huge_blur(SkCanvas* canvas, skiatest::Reporter* reporter) { | 1168 static void test_huge_blur(SkCanvas* canvas, skiatest::Reporter* reporter) { |
1170 SkBitmap bitmap; | 1169 SkBitmap bitmap; |
1171 bitmap.allocN32Pixels(100, 100); | 1170 bitmap.allocN32Pixels(100, 100); |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1555 test_xfermode_cropped_input(&canvas, reporter); | 1554 test_xfermode_cropped_input(&canvas, reporter); |
1556 } | 1555 } |
1557 | 1556 |
1558 DEF_GPUTEST_FOR_ALL_CONTEXTS(BlurLargeImage_Gpu, reporter, context) { | 1557 DEF_GPUTEST_FOR_ALL_CONTEXTS(BlurLargeImage_Gpu, reporter, context) { |
1559 SkAutoTUnref<SkSurface> surface( | 1558 SkAutoTUnref<SkSurface> surface( |
1560 SkSurface::NewRenderTarget(context, SkBudgeted::kYes, | 1559 SkSurface::NewRenderTarget(context, SkBudgeted::kYes, |
1561 SkImageInfo::MakeN32Premul(100, 100))); | 1560 SkImageInfo::MakeN32Premul(100, 100))); |
1562 test_large_blur_input(reporter, surface->getCanvas()); | 1561 test_large_blur_input(reporter, surface->getCanvas()); |
1563 } | 1562 } |
1564 #endif | 1563 #endif |
OLD | NEW |