| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 88     // then a 2x,3x scale that's been concatted with that +20,+20 translate. | 88     // then a 2x,3x scale that's been concatted with that +20,+20 translate. | 
| 89     const SkRecords::SetMatrix* setMatrix; | 89     const SkRecords::SetMatrix* setMatrix; | 
| 90     setMatrix = assert_type<SkRecords::SetMatrix>(r, translateRecord, 0); | 90     setMatrix = assert_type<SkRecords::SetMatrix>(r, translateRecord, 0); | 
| 91     REPORTER_ASSERT(r, setMatrix->matrix == translate); | 91     REPORTER_ASSERT(r, setMatrix->matrix == translate); | 
| 92 | 92 | 
| 93     setMatrix = assert_type<SkRecords::SetMatrix>(r, translateRecord, 2); | 93     setMatrix = assert_type<SkRecords::SetMatrix>(r, translateRecord, 2); | 
| 94     SkMatrix expected = scale; | 94     SkMatrix expected = scale; | 
| 95     expected.postConcat(translate); | 95     expected.postConcat(translate); | 
| 96     REPORTER_ASSERT(r, setMatrix->matrix == expected); | 96     REPORTER_ASSERT(r, setMatrix->matrix == expected); | 
| 97 } | 97 } | 
|  | 98 | 
|  | 99 struct TestBBH : public SkBBoxHierarchy { | 
|  | 100     virtual void insert(void* data, const SkIRect& bounds, bool defer) SK_OVERRI
     DE { | 
|  | 101         Entry e = { (uintptr_t)data, bounds }; | 
|  | 102         entries.push(e); | 
|  | 103     } | 
|  | 104     virtual int getCount() const SK_OVERRIDE { return entries.count(); } | 
|  | 105 | 
|  | 106     virtual void flushDeferredInserts() SK_OVERRIDE {} | 
|  | 107 | 
|  | 108     virtual void search(const SkIRect& query, SkTDArray<void*>* results) const S
     K_OVERRIDE {} | 
|  | 109     virtual void clear() SK_OVERRIDE {} | 
|  | 110     virtual void rewindInserts() SK_OVERRIDE {} | 
|  | 111     virtual int getDepth() const SK_OVERRIDE { return -1; } | 
|  | 112 | 
|  | 113     struct Entry { | 
|  | 114         uintptr_t data; | 
|  | 115         SkIRect bounds; | 
|  | 116     }; | 
|  | 117     SkTDArray<Entry> entries; | 
|  | 118 }; | 
|  | 119 | 
|  | 120 // This test is not meant to make total sense yet.  It's testing the status quo | 
|  | 121 // of SkRecordFillBounds(), which itself doesn't make total sense yet. | 
|  | 122 DEF_TEST(RecordDraw_BBH, r) { | 
|  | 123     TestBBH bbh; | 
|  | 124 | 
|  | 125     SkRecord record; | 
|  | 126 | 
|  | 127     SkRecorder recorder(&record, W, H); | 
|  | 128     recorder.save(); | 
|  | 129         recorder.clipRect(SkRect::MakeWH(400, 500)); | 
|  | 130         recorder.scale(2, 2); | 
|  | 131         recorder.drawRect(SkRect::MakeWH(320, 240), SkPaint()); | 
|  | 132     recorder.restore(); | 
|  | 133 | 
|  | 134     SkRecordFillBounds(record, &bbh); | 
|  | 135 | 
|  | 136     REPORTER_ASSERT(r, bbh.entries.count() == 5); | 
|  | 137     for (int i = 0; i < bbh.entries.count(); i++) { | 
|  | 138         REPORTER_ASSERT(r, bbh.entries[i].data == (uintptr_t)i); | 
|  | 139 | 
|  | 140         REPORTER_ASSERT(r, bbh.entries[i].bounds == SkIRect::MakeWH(400, 500)); | 
|  | 141     } | 
|  | 142 } | 
| OLD | NEW | 
|---|