| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 SkMatrix expected = scale; | 95 SkMatrix expected = scale; |
| 96 expected.postConcat(translate); | 96 expected.postConcat(translate); |
| 97 REPORTER_ASSERT(r, setMatrix->matrix == expected); | 97 REPORTER_ASSERT(r, setMatrix->matrix == expected); |
| 98 } | 98 } |
| 99 | 99 |
| 100 struct TestBBH : public SkBBoxHierarchy { | 100 struct TestBBH : public SkBBoxHierarchy { |
| 101 virtual void insert(unsigned opIndex, const SkRect& bounds, bool defer) SK_O
VERRIDE { | 101 virtual void insert(unsigned opIndex, const SkRect& bounds, bool defer) SK_O
VERRIDE { |
| 102 Entry e = { opIndex, bounds }; | 102 Entry e = { opIndex, bounds }; |
| 103 fEntries.push(e); | 103 fEntries.push(e); |
| 104 } | 104 } |
| 105 virtual int getCount() const SK_OVERRIDE { return fEntries.count(); } | |
| 106 | 105 |
| 107 virtual void flushDeferredInserts() SK_OVERRIDE {} | 106 virtual void flushDeferredInserts() SK_OVERRIDE {} |
| 108 | |
| 109 virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const
SK_OVERRIDE {} | 107 virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const
SK_OVERRIDE {} |
| 110 virtual void clear() SK_OVERRIDE {} | |
| 111 virtual int getDepth() const SK_OVERRIDE { return -1; } | |
| 112 | 108 |
| 113 struct Entry { | 109 struct Entry { |
| 114 unsigned opIndex; | 110 unsigned opIndex; |
| 115 SkRect bounds; | 111 SkRect bounds; |
| 116 }; | 112 }; |
| 117 SkTDArray<Entry> fEntries; | 113 SkTDArray<Entry> fEntries; |
| 118 }; | 114 }; |
| 119 | 115 |
| 120 // Like a==b, with a little slop recognizing that float equality can be weird. | 116 // Like a==b, with a little slop recognizing that float equality can be weird. |
| 121 static bool sloppy_rect_eq(SkRect a, SkRect b) { | 117 static bool sloppy_rect_eq(SkRect a, SkRect b) { |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 // The second bug showed up as adjusting the picture bounds (0,0,50,50) by t
he drop shadow too. | 246 // The second bug showed up as adjusting the picture bounds (0,0,50,50) by t
he drop shadow too. |
| 251 // The saveLayer, clipRect, and restore bounds were incorrectly (0,0,70,50). | 247 // The saveLayer, clipRect, and restore bounds were incorrectly (0,0,70,50). |
| 252 TestBBH bbh; | 248 TestBBH bbh; |
| 253 SkRecordFillBounds(record, &bbh); | 249 SkRecordFillBounds(record, &bbh); |
| 254 REPORTER_ASSERT(r, bbh.fEntries.count() == 4); | 250 REPORTER_ASSERT(r, bbh.fEntries.count() == 4); |
| 255 REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[0].bounds, SkRect::MakeLTRB(0
, 0, 50, 50))); | 251 REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[0].bounds, SkRect::MakeLTRB(0
, 0, 50, 50))); |
| 256 REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[1].bounds, SkRect::MakeLTRB(0
, 0, 50, 50))); | 252 REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[1].bounds, SkRect::MakeLTRB(0
, 0, 50, 50))); |
| 257 REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[2].bounds, SkRect::MakeLTRB(0
, 0, 40, 40))); | 253 REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[2].bounds, SkRect::MakeLTRB(0
, 0, 40, 40))); |
| 258 REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[3].bounds, SkRect::MakeLTRB(0
, 0, 50, 50))); | 254 REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[3].bounds, SkRect::MakeLTRB(0
, 0, 50, 50))); |
| 259 } | 255 } |
| OLD | NEW |