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

Side by Side Diff: tests/CanvasTest.cpp

Issue 1793303002: Reland of "more shader-->sp conversions (patchset #5 id:80001 of https://codereview.chromium… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: make pictureRef a value, so its clearer what's going on Created 4 years, 9 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/BlitRowTest.cpp ('k') | tests/DrawBitmapRectTest.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 /* 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
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
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 }
OLDNEW
« no previous file with comments | « tests/BlitRowTest.cpp ('k') | tests/DrawBitmapRectTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698