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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 #include "SkClipStack.h" | 48 #include "SkClipStack.h" |
49 #include "SkDocument.h" | 49 #include "SkDocument.h" |
50 #include "SkMatrix.h" | 50 #include "SkMatrix.h" |
51 #include "SkNWayCanvas.h" | 51 #include "SkNWayCanvas.h" |
52 #include "SkPaint.h" | 52 #include "SkPaint.h" |
53 #include "SkPaintFilterCanvas.h" | 53 #include "SkPaintFilterCanvas.h" |
54 #include "SkPath.h" | 54 #include "SkPath.h" |
55 #include "SkPicture.h" | 55 #include "SkPicture.h" |
56 #include "SkPictureRecord.h" | 56 #include "SkPictureRecord.h" |
57 #include "SkPictureRecorder.h" | 57 #include "SkPictureRecorder.h" |
| 58 #include "SkRasterClip.h" |
58 #include "SkRect.h" | 59 #include "SkRect.h" |
59 #include "SkRegion.h" | 60 #include "SkRegion.h" |
60 #include "SkShader.h" | 61 #include "SkShader.h" |
61 #include "SkStream.h" | 62 #include "SkStream.h" |
62 #include "SkSurface.h" | 63 #include "SkSurface.h" |
63 #include "SkTemplates.h" | 64 #include "SkTemplates.h" |
64 #include "SkTDArray.h" | 65 #include "SkTDArray.h" |
65 #include "Test.h" | 66 #include "Test.h" |
66 | 67 |
67 static const int kWidth = 2, kHeight = 2; | 68 static const int kWidth = 2, kHeight = 2; |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 class CanvasTestingAccess { | 501 class CanvasTestingAccess { |
501 public: | 502 public: |
502 static bool SameState(const SkCanvas* canvas1, const SkCanvas* canvas2) { | 503 static bool SameState(const SkCanvas* canvas1, const SkCanvas* canvas2) { |
503 SkCanvas::LayerIter layerIter1(const_cast<SkCanvas*>(canvas1), false); | 504 SkCanvas::LayerIter layerIter1(const_cast<SkCanvas*>(canvas1), false); |
504 SkCanvas::LayerIter layerIter2(const_cast<SkCanvas*>(canvas2), false); | 505 SkCanvas::LayerIter layerIter2(const_cast<SkCanvas*>(canvas2), false); |
505 while (!layerIter1.done() && !layerIter2.done()) { | 506 while (!layerIter1.done() && !layerIter2.done()) { |
506 if (layerIter1.matrix() != layerIter2.matrix()) { | 507 if (layerIter1.matrix() != layerIter2.matrix()) { |
507 return false; | 508 return false; |
508 } | 509 } |
509 if (layerIter1.clip() != layerIter2.clip()) { | 510 if (layerIter1.clip() != layerIter2.clip()) { |
510 return false; | 511 return false; |
511 } | 512 } |
512 if (layerIter1.paint() != layerIter2.paint()) { | 513 if (layerIter1.paint() != layerIter2.paint()) { |
513 return false; | 514 return false; |
514 } | 515 } |
515 if (layerIter1.x() != layerIter2.x()) { | 516 if (layerIter1.x() != layerIter2.x()) { |
516 return false; | 517 return false; |
517 } | 518 } |
518 if (layerIter1.y() != layerIter2.y()) { | 519 if (layerIter1.y() != layerIter2.y()) { |
519 return false; | 520 return false; |
520 } | 521 } |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 REPORTER_ASSERT(reporter, canvas.getTotalMatrix() == filterCanvas.getTotalMa
trix()); | 766 REPORTER_ASSERT(reporter, canvas.getTotalMatrix() == filterCanvas.getTotalMa
trix()); |
766 REPORTER_ASSERT(reporter, canvas.getClipBounds(&clip1) == filterCanvas.getCl
ipBounds(&clip2)); | 767 REPORTER_ASSERT(reporter, canvas.getClipBounds(&clip1) == filterCanvas.getCl
ipBounds(&clip2)); |
767 REPORTER_ASSERT(reporter, clip1 == clip2); | 768 REPORTER_ASSERT(reporter, clip1 == clip2); |
768 | 769 |
769 filterCanvas.clipRect(SkRect::MakeXYWH(30.5f, 30.7f, 100, 100)); | 770 filterCanvas.clipRect(SkRect::MakeXYWH(30.5f, 30.7f, 100, 100)); |
770 filterCanvas.scale(0.75f, 0.5f); | 771 filterCanvas.scale(0.75f, 0.5f); |
771 REPORTER_ASSERT(reporter, canvas.getTotalMatrix() == filterCanvas.getTotalMa
trix()); | 772 REPORTER_ASSERT(reporter, canvas.getTotalMatrix() == filterCanvas.getTotalMa
trix()); |
772 REPORTER_ASSERT(reporter, canvas.getClipBounds(&clip1) == filterCanvas.getCl
ipBounds(&clip2)); | 773 REPORTER_ASSERT(reporter, canvas.getClipBounds(&clip1) == filterCanvas.getCl
ipBounds(&clip2)); |
773 REPORTER_ASSERT(reporter, clip1 == clip2); | 774 REPORTER_ASSERT(reporter, clip1 == clip2); |
774 } | 775 } |
OLD | NEW |