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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 a.getClipDeviceBounds(&ar); | 186 a.getClipDeviceBounds(&ar); |
187 b.getClipDeviceBounds(&br); | 187 b.getClipDeviceBounds(&br); |
188 return ar == br; | 188 return ar == br; |
189 } | 189 } |
190 | 190 |
191 class Canvas2CanvasClipVisitor : public SkCanvas::ClipVisitor { | 191 class Canvas2CanvasClipVisitor : public SkCanvas::ClipVisitor { |
192 public: | 192 public: |
193 Canvas2CanvasClipVisitor(SkCanvas* target) : fTarget(target) {} | 193 Canvas2CanvasClipVisitor(SkCanvas* target) : fTarget(target) {} |
194 | 194 |
195 virtual void clipRect(const SkRect& r, SkRegion::Op op, bool aa) SK_OVERRIDE
{ | 195 virtual void clipRect(const SkRect& r, SkRegion::Op op, bool aa) SK_OVERRIDE
{ |
196 fTarget->clipRect(r, op, aa); | 196 fTarget->legacyClipRect(r, op, aa); |
197 } | 197 } |
198 virtual void clipRRect(const SkRRect& r, SkRegion::Op op, bool aa) SK_OVERRI
DE { | 198 virtual void clipRRect(const SkRRect& r, SkRegion::Op op, bool aa) SK_OVERRI
DE { |
199 fTarget->clipRRect(r, op, aa); | 199 fTarget->legacyClipRRect(r, op, aa); |
200 } | 200 } |
201 virtual void clipPath(const SkPath& p, SkRegion::Op op, bool aa) SK_OVERRIDE
{ | 201 virtual void clipPath(const SkPath& p, SkRegion::Op op, bool aa) SK_OVERRIDE
{ |
202 fTarget->clipPath(p, op, aa); | 202 fTarget->legacyClipPath(p, op, aa); |
203 } | 203 } |
204 | 204 |
205 private: | 205 private: |
206 SkCanvas* fTarget; | 206 SkCanvas* fTarget; |
207 }; | 207 }; |
208 | 208 |
209 static void test_clipVisitor(skiatest::Reporter* reporter, SkCanvas* canvas) { | 209 static void test_clipVisitor(skiatest::Reporter* reporter, SkCanvas* canvas) { |
210 SkISize size = canvas->getDeviceSize(); | 210 SkISize size = canvas->getDeviceSize(); |
211 | 211 |
212 SkBitmap bm; | 212 SkBitmap bm; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 // the state of the canvas. | 334 // the state of the canvas. |
335 | 335 |
336 SIMPLE_TEST_STEP(Translate, translate(SkIntToScalar(1), SkIntToScalar(2))); | 336 SIMPLE_TEST_STEP(Translate, translate(SkIntToScalar(1), SkIntToScalar(2))); |
337 SIMPLE_TEST_STEP(Scale, scale(SkIntToScalar(1), SkIntToScalar(2))); | 337 SIMPLE_TEST_STEP(Scale, scale(SkIntToScalar(1), SkIntToScalar(2))); |
338 SIMPLE_TEST_STEP(Rotate, rotate(SkIntToScalar(1))); | 338 SIMPLE_TEST_STEP(Rotate, rotate(SkIntToScalar(1))); |
339 SIMPLE_TEST_STEP(Skew, skew(SkIntToScalar(1), SkIntToScalar(2))); | 339 SIMPLE_TEST_STEP(Skew, skew(SkIntToScalar(1), SkIntToScalar(2))); |
340 SIMPLE_TEST_STEP(Concat, concat(d.fMatrix)); | 340 SIMPLE_TEST_STEP(Concat, concat(d.fMatrix)); |
341 SIMPLE_TEST_STEP(SetMatrix, setMatrix(d.fMatrix)); | 341 SIMPLE_TEST_STEP(SetMatrix, setMatrix(d.fMatrix)); |
342 SIMPLE_TEST_STEP(ClipRect, clipRect(d.fRect)); | 342 SIMPLE_TEST_STEP(ClipRect, clipRect(d.fRect)); |
343 SIMPLE_TEST_STEP(ClipPath, clipPath(d.fPath)); | 343 SIMPLE_TEST_STEP(ClipPath, clipPath(d.fPath)); |
344 SIMPLE_TEST_STEP(ClipRegion, clipRegion(d.fRegion, SkRegion::kReplace_Op)); | 344 SIMPLE_TEST_STEP(ClipRegion, legacyClipRegion(d.fRegion, SkRegion::kReplace_Op))
; |
345 SIMPLE_TEST_STEP(Clear, clear(d.fColor)); | 345 SIMPLE_TEST_STEP(Clear, clear(d.fColor)); |
346 SIMPLE_TEST_STEP(BeginGroup, beginCommentGroup(d.fText.c_str())); | 346 SIMPLE_TEST_STEP(BeginGroup, beginCommentGroup(d.fText.c_str())); |
347 SIMPLE_TEST_STEP(AddComment, addComment(d.fText.c_str(), d.fText.c_str())); | 347 SIMPLE_TEST_STEP(AddComment, addComment(d.fText.c_str(), d.fText.c_str())); |
348 SIMPLE_TEST_STEP(EndGroup, endCommentGroup()); | 348 SIMPLE_TEST_STEP(EndGroup, endCommentGroup()); |
349 | 349 |
350 /////////////////////////////////////////////////////////////////////////////// | 350 /////////////////////////////////////////////////////////////////////////////// |
351 // Complex test steps | 351 // Complex test steps |
352 | 352 |
353 static void SaveMatrixClipStep(SkCanvas* canvas, const TestData& d, | 353 static void SaveMatrixClipStep(SkCanvas* canvas, const TestData& d, |
354 skiatest::Reporter* reporter, CanvasTestStep* tes
tStep) { | 354 skiatest::Reporter* reporter, CanvasTestStep* tes
tStep) { |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 | 806 |
807 n = canvas.saveLayer(NULL, NULL); | 807 n = canvas.saveLayer(NULL, NULL); |
808 REPORTER_ASSERT(reporter, 2 == n); | 808 REPORTER_ASSERT(reporter, 2 == n); |
809 REPORTER_ASSERT(reporter, 3 == canvas.getSaveCount()); | 809 REPORTER_ASSERT(reporter, 3 == canvas.getSaveCount()); |
810 | 810 |
811 canvas.restore(); | 811 canvas.restore(); |
812 REPORTER_ASSERT(reporter, 2 == canvas.getSaveCount()); | 812 REPORTER_ASSERT(reporter, 2 == canvas.getSaveCount()); |
813 canvas.restore(); | 813 canvas.restore(); |
814 REPORTER_ASSERT(reporter, 1 == canvas.getSaveCount()); | 814 REPORTER_ASSERT(reporter, 1 == canvas.getSaveCount()); |
815 } | 815 } |
OLD | NEW |