| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 #include "Test.h" | 8 #include "Test.h" |
| 9 #include "RecordTestUtils.h" | 9 #include "RecordTestUtils.h" |
| 10 | 10 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 setMatrix = assert_type<SkRecords::SetMatrix>(r, translateRecord, 0); | 93 setMatrix = assert_type<SkRecords::SetMatrix>(r, translateRecord, 0); |
| 94 REPORTER_ASSERT(r, setMatrix->matrix == translate); | 94 REPORTER_ASSERT(r, setMatrix->matrix == translate); |
| 95 | 95 |
| 96 setMatrix = assert_type<SkRecords::SetMatrix>(r, translateRecord, 2); | 96 setMatrix = assert_type<SkRecords::SetMatrix>(r, translateRecord, 2); |
| 97 SkMatrix expected = scale; | 97 SkMatrix expected = scale; |
| 98 expected.postConcat(translate); | 98 expected.postConcat(translate); |
| 99 REPORTER_ASSERT(r, setMatrix->matrix == expected); | 99 REPORTER_ASSERT(r, setMatrix->matrix == expected); |
| 100 } | 100 } |
| 101 | 101 |
| 102 struct TestBBH : public SkBBoxHierarchy { | 102 struct TestBBH : public SkBBoxHierarchy { |
| 103 virtual void insert(unsigned opIndex, const SkRect& bounds, bool defer) SK_O
VERRIDE { | 103 void insert(SkAutoTMalloc<SkRect>* boundsArray, int N) SK_OVERRIDE { |
| 104 Entry e = { opIndex, bounds }; | 104 fEntries.setCount(N); |
| 105 fEntries.push(e); | 105 for (int i = 0; i < N; i++) { |
| 106 Entry e = { (unsigned)i, (*boundsArray)[i] }; |
| 107 fEntries[i] = e; |
| 108 } |
| 106 } | 109 } |
| 107 | 110 |
| 108 virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const
SK_OVERRIDE {} | 111 void search(const SkRect& query, SkTDArray<unsigned>* results) const SK_OVER
RIDE {} |
| 109 | 112 |
| 110 struct Entry { | 113 struct Entry { |
| 111 unsigned opIndex; | 114 unsigned opIndex; |
| 112 SkRect bounds; | 115 SkRect bounds; |
| 113 }; | 116 }; |
| 114 SkTDArray<Entry> fEntries; | 117 SkTDArray<Entry> fEntries; |
| 115 }; | 118 }; |
| 116 | 119 |
| 117 // Like a==b, with a little slop recognizing that float equality can be weird. | 120 // Like a==b, with a little slop recognizing that float equality can be weird. |
| 118 static bool sloppy_rect_eq(SkRect a, SkRect b) { | 121 static bool sloppy_rect_eq(SkRect a, SkRect b) { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 | 304 |
| 302 { | 305 { |
| 303 SkRecord record; | 306 SkRecord record; |
| 304 SkRecorder recorder(&record, 10, 10); | 307 SkRecorder recorder(&record, 10, 10); |
| 305 recorder.drawImageRect(image, 0, SkRect::MakeWH(10, 10)); | 308 recorder.drawImageRect(image, 0, SkRect::MakeWH(10, 10)); |
| 306 SkRecordDraw(record, &canvas, 0, 0); | 309 SkRecordDraw(record, &canvas, 0, 0); |
| 307 } | 310 } |
| 308 REPORTER_ASSERT(r, canvas.fDrawImageRectCalled); | 311 REPORTER_ASSERT(r, canvas.fDrawImageRectCalled); |
| 309 | 312 |
| 310 } | 313 } |
| OLD | NEW |