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

Unified Diff: tests/ImageFilterTest.cpp

Issue 513983002: Try out scalar picture sizes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update to ToT again Created 6 years, 4 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 | « tests/CanvasTest.cpp ('k') | tests/PathOpsSkpClipTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ImageFilterTest.cpp
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index 778cc3f4343307ffe0de85d437bcb5a7416052f4..a8cd5d0cf99066f2aca633c529f0d002d1fb667d 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -421,7 +421,8 @@ DEF_TEST(ImageFilterDrawTiled, reporter) {
}
}
-static void drawSaveLayerPicture(int width, int height, int tileSize, SkBBHFactory* factory, SkBitmap* result) {
+static void draw_saveLayer_picture(int width, int height, int tileSize,
+ SkBBHFactory* factory, SkBitmap* result) {
SkMatrix matrix;
matrix.setTranslate(SkIntToScalar(50), 0);
@@ -434,7 +435,9 @@ static void drawSaveLayerPicture(int width, int height, int tileSize, SkBBHFacto
paint.setImageFilter(imageFilter.get());
SkPictureRecorder recorder;
SkRect bounds = SkRect::Make(SkIRect::MakeXYWH(0, 0, 50, 50));
- SkCanvas* recordingCanvas = recorder.beginRecording(width, height, factory, 0);
+ SkCanvas* recordingCanvas = recorder.beginRecording(SkIntToScalar(width),
+ SkIntToScalar(height),
+ factory, 0);
recordingCanvas->translate(-55, 0);
recordingCanvas->saveLayer(&bounds, &paint);
recordingCanvas->restore();
@@ -457,8 +460,8 @@ DEF_TEST(ImageFilterDrawMatrixBBH, reporter) {
SkBitmap result1, result2;
SkRTreeFactory factory;
- drawSaveLayerPicture(width, height, tileSize, &factory, &result1);
- drawSaveLayerPicture(width, height, tileSize, NULL, &result2);
+ draw_saveLayer_picture(width, height, tileSize, &factory, &result1);
+ draw_saveLayer_picture(width, height, tileSize, NULL, &result2);
for (int y = 0; y < height; y++) {
int diffs = memcmp(result1.getAddr32(0, y), result2.getAddr32(0, y), result1.rowBytes());
@@ -513,7 +516,7 @@ DEF_TEST(ImageFilterDilateThenBlurBounds, reporter) {
REPORTER_ASSERT(reporter, bounds == expectedBounds);
}
-static void drawBlurredRect(SkCanvas* canvas) {
+static void draw_blurred_rect(SkCanvas* canvas) {
SkAutoTUnref<SkImageFilter> filter(SkBlurImageFilter::Create(SkIntToScalar(8), 0));
SkPaint filterPaint;
filterPaint.setColor(SK_ColorWHITE);
@@ -525,7 +528,7 @@ static void drawBlurredRect(SkCanvas* canvas) {
canvas->restore();
}
-static void drawPictureClipped(SkCanvas* canvas, const SkRect& clipRect, const SkPicture* picture) {
+static void draw_picture_clipped(SkCanvas* canvas, const SkRect& clipRect, const SkPicture* picture) {
canvas->save();
canvas->clipRect(clipRect);
canvas->drawPicture(picture);
@@ -555,17 +558,21 @@ DEF_TEST(ImageFilterDrawTiledBlurRTree, reporter) {
SkPictureRecorder recorder1, recorder2;
// The only difference between these two pictures is that one has RTree aceleration.
- SkCanvas* recordingCanvas1 = recorder1.beginRecording(width, height, NULL, 0);
- SkCanvas* recordingCanvas2 = recorder2.beginRecording(width, height, &factory, 0);
- drawBlurredRect(recordingCanvas1);
- drawBlurredRect(recordingCanvas2);
+ SkCanvas* recordingCanvas1 = recorder1.beginRecording(SkIntToScalar(width),
+ SkIntToScalar(height),
+ NULL, 0);
+ SkCanvas* recordingCanvas2 = recorder2.beginRecording(SkIntToScalar(width),
+ SkIntToScalar(height),
+ &factory, 0);
+ draw_blurred_rect(recordingCanvas1);
+ draw_blurred_rect(recordingCanvas2);
SkAutoTUnref<SkPicture> picture1(recorder1.endRecording());
SkAutoTUnref<SkPicture> picture2(recorder2.endRecording());
for (int y = 0; y < height; y += tileSize) {
for (int x = 0; x < width; x += tileSize) {
SkRect tileRect = SkRect::Make(SkIRect::MakeXYWH(x, y, tileSize, tileSize));
- drawPictureClipped(&canvas1, tileRect, picture1);
- drawPictureClipped(&canvas2, tileRect, picture2);
+ draw_picture_clipped(&canvas1, tileRect, picture1);
+ draw_picture_clipped(&canvas2, tileRect, picture2);
}
}
for (int y = 0; y < height; y++) {
« no previous file with comments | « tests/CanvasTest.cpp ('k') | tests/PathOpsSkpClipTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698