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 SkShader* shader = SkShader::CreateBitmapShader(d.fBitmap, | 418 paint.setShader(SkShader::MakeBitmapShader(d.fBitmap, SkShader::kClamp_TileM
ode, |
419 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode); | 419 SkShader::kClamp_TileMode)); |
420 paint.setShader(shader)->unref(); | |
421 canvas->drawVertices(SkCanvas::kTriangleFan_VertexMode, 4, pts, pts, | 420 canvas->drawVertices(SkCanvas::kTriangleFan_VertexMode, 4, pts, pts, |
422 nullptr, nullptr, nullptr, 0, paint); | 421 nullptr, nullptr, nullptr, 0, paint); |
423 } | 422 } |
424 // NYI: issue 240. | 423 // NYI: issue 240. |
425 TEST_STEP_NO_PDF(DrawVerticesShader, DrawVerticesShaderTestStep); | 424 TEST_STEP_NO_PDF(DrawVerticesShader, DrawVerticesShaderTestStep); |
426 | 425 |
427 static void DrawPictureTestStep(SkCanvas* canvas, const TestData& d, | 426 static void DrawPictureTestStep(SkCanvas* canvas, const TestData& d, |
428 skiatest::Reporter*, CanvasTestStep*) { | 427 skiatest::Reporter*, CanvasTestStep*) { |
429 SkPictureRecorder recorder; | 428 SkPictureRecorder recorder; |
430 SkCanvas* testCanvas = recorder.beginRecording(SkIntToScalar(d.fWidth), SkIn
tToScalar(d.fHeight), | 429 SkCanvas* testCanvas = recorder.beginRecording(SkIntToScalar(d.fWidth), SkIn
tToScalar(d.fHeight), |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 REPORTER_ASSERT(reporter, canvas.getTotalMatrix() == filterCanvas.getTotalMa
trix()); | 751 REPORTER_ASSERT(reporter, canvas.getTotalMatrix() == filterCanvas.getTotalMa
trix()); |
753 REPORTER_ASSERT(reporter, canvas.getClipBounds(&clip1) == filterCanvas.getCl
ipBounds(&clip2)); | 752 REPORTER_ASSERT(reporter, canvas.getClipBounds(&clip1) == filterCanvas.getCl
ipBounds(&clip2)); |
754 REPORTER_ASSERT(reporter, clip1 == clip2); | 753 REPORTER_ASSERT(reporter, clip1 == clip2); |
755 | 754 |
756 filterCanvas.clipRect(SkRect::MakeXYWH(30.5f, 30.7f, 100, 100)); | 755 filterCanvas.clipRect(SkRect::MakeXYWH(30.5f, 30.7f, 100, 100)); |
757 filterCanvas.scale(0.75f, 0.5f); | 756 filterCanvas.scale(0.75f, 0.5f); |
758 REPORTER_ASSERT(reporter, canvas.getTotalMatrix() == filterCanvas.getTotalMa
trix()); | 757 REPORTER_ASSERT(reporter, canvas.getTotalMatrix() == filterCanvas.getTotalMa
trix()); |
759 REPORTER_ASSERT(reporter, canvas.getClipBounds(&clip1) == filterCanvas.getCl
ipBounds(&clip2)); | 758 REPORTER_ASSERT(reporter, canvas.getClipBounds(&clip1) == filterCanvas.getCl
ipBounds(&clip2)); |
760 REPORTER_ASSERT(reporter, clip1 == clip2); | 759 REPORTER_ASSERT(reporter, clip1 == clip2); |
761 } | 760 } |
OLD | NEW |