OLD | NEW |
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 /* Description: | 8 /* Description: |
9 * This test defines a series of elementatry test steps that perform | 9 * This test defines a series of elementatry test steps that perform |
10 * a single or a small group of canvas API calls. Each test step is | 10 * a single or a small group of canvas API calls. Each test step is |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 TEST_STEP(DrawNearlyZeroLengthPath, DrawNearlyZeroLengthPathTestStep); | 408 TEST_STEP(DrawNearlyZeroLengthPath, DrawNearlyZeroLengthPathTestStep); |
409 | 409 |
410 static void DrawVerticesShaderTestStep(SkCanvas* canvas, const TestData& d, | 410 static void DrawVerticesShaderTestStep(SkCanvas* canvas, const TestData& d, |
411 skiatest::Reporter*, CanvasTestStep*) { | 411 skiatest::Reporter*, CanvasTestStep*) { |
412 SkPoint pts[4]; | 412 SkPoint pts[4]; |
413 pts[0].set(0, 0); | 413 pts[0].set(0, 0); |
414 pts[1].set(SkIntToScalar(d.fWidth), 0); | 414 pts[1].set(SkIntToScalar(d.fWidth), 0); |
415 pts[2].set(SkIntToScalar(d.fWidth), SkIntToScalar(d.fHeight)); | 415 pts[2].set(SkIntToScalar(d.fWidth), SkIntToScalar(d.fHeight)); |
416 pts[3].set(0, SkIntToScalar(d.fHeight)); | 416 pts[3].set(0, SkIntToScalar(d.fHeight)); |
417 SkPaint paint; | 417 SkPaint paint; |
418 paint.setShader(SkShader::MakeBitmapShader(d.fBitmap, SkShader::kClamp_TileM
ode, | 418 SkShader* shader = SkShader::CreateBitmapShader(d.fBitmap, |
419 SkShader::kClamp_TileMode)); | 419 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode); |
| 420 paint.setShader(shader)->unref(); |
420 canvas->drawVertices(SkCanvas::kTriangleFan_VertexMode, 4, pts, pts, | 421 canvas->drawVertices(SkCanvas::kTriangleFan_VertexMode, 4, pts, pts, |
421 nullptr, nullptr, nullptr, 0, paint); | 422 nullptr, nullptr, nullptr, 0, paint); |
422 } | 423 } |
423 // NYI: issue 240. | 424 // NYI: issue 240. |
424 TEST_STEP_NO_PDF(DrawVerticesShader, DrawVerticesShaderTestStep); | 425 TEST_STEP_NO_PDF(DrawVerticesShader, DrawVerticesShaderTestStep); |
425 | 426 |
426 static void DrawPictureTestStep(SkCanvas* canvas, const TestData& d, | 427 static void DrawPictureTestStep(SkCanvas* canvas, const TestData& d, |
427 skiatest::Reporter*, CanvasTestStep*) { | 428 skiatest::Reporter*, CanvasTestStep*) { |
428 SkPictureRecorder recorder; | 429 SkPictureRecorder recorder; |
429 SkCanvas* testCanvas = recorder.beginRecording(SkIntToScalar(d.fWidth), SkIn
tToScalar(d.fHeight), | 430 SkCanvas* testCanvas = recorder.beginRecording(SkIntToScalar(d.fWidth), SkIn
tToScalar(d.fHeight), |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 REPORTER_ASSERT(reporter, canvas.getTotalMatrix() == filterCanvas.getTotalMa
trix()); | 752 REPORTER_ASSERT(reporter, canvas.getTotalMatrix() == filterCanvas.getTotalMa
trix()); |
752 REPORTER_ASSERT(reporter, canvas.getClipBounds(&clip1) == filterCanvas.getCl
ipBounds(&clip2)); | 753 REPORTER_ASSERT(reporter, canvas.getClipBounds(&clip1) == filterCanvas.getCl
ipBounds(&clip2)); |
753 REPORTER_ASSERT(reporter, clip1 == clip2); | 754 REPORTER_ASSERT(reporter, clip1 == clip2); |
754 | 755 |
755 filterCanvas.clipRect(SkRect::MakeXYWH(30.5f, 30.7f, 100, 100)); | 756 filterCanvas.clipRect(SkRect::MakeXYWH(30.5f, 30.7f, 100, 100)); |
756 filterCanvas.scale(0.75f, 0.5f); | 757 filterCanvas.scale(0.75f, 0.5f); |
757 REPORTER_ASSERT(reporter, canvas.getTotalMatrix() == filterCanvas.getTotalMa
trix()); | 758 REPORTER_ASSERT(reporter, canvas.getTotalMatrix() == filterCanvas.getTotalMa
trix()); |
758 REPORTER_ASSERT(reporter, canvas.getClipBounds(&clip1) == filterCanvas.getCl
ipBounds(&clip2)); | 759 REPORTER_ASSERT(reporter, canvas.getClipBounds(&clip1) == filterCanvas.getCl
ipBounds(&clip2)); |
759 REPORTER_ASSERT(reporter, clip1 == clip2); | 760 REPORTER_ASSERT(reporter, clip1 == clip2); |
760 } | 761 } |
OLD | NEW |