| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1172 // Unfortunately the new one could be allocated in the same | 1172 // Unfortunately the new one could be allocated in the same |
| 1173 // spot as the old one so ref the first one to prolong its life. | 1173 // spot as the old one so ref the first one to prolong its life. |
| 1174 IntSize size(1, 1); | 1174 IntSize size(1, 1); |
| 1175 SkCanvas* canvas1 = dl->beginRecording(size); | 1175 SkCanvas* canvas1 = dl->beginRecording(size); |
| 1176 EXPECT_TRUE(canvas1); | 1176 EXPECT_TRUE(canvas1); |
| 1177 canvas1->ref(); | 1177 canvas1->ref(); |
| 1178 SkCanvas* canvas2 = dl->beginRecording(size); | 1178 SkCanvas* canvas2 = dl->beginRecording(size); |
| 1179 EXPECT_TRUE(canvas2); | 1179 EXPECT_TRUE(canvas2); |
| 1180 | 1180 |
| 1181 EXPECT_NE(canvas1, canvas2); | 1181 EXPECT_NE(canvas1, canvas2); |
| 1182 EXPECT_EQ(1, canvas1->getRefCnt()); | 1182 EXPECT_TRUE(canvas1->unique()); |
| 1183 canvas1->unref(); | 1183 canvas1->unref(); |
| 1184 | 1184 |
| 1185 EXPECT_TRUE(dl->isRecording()); | 1185 EXPECT_TRUE(dl->isRecording()); |
| 1186 | 1186 |
| 1187 // picture() returns 0 during recording | 1187 // picture() returns 0 during recording |
| 1188 pic = dl->picture(); | 1188 pic = dl->picture(); |
| 1189 EXPECT_FALSE(pic); | 1189 EXPECT_FALSE(pic); |
| 1190 | 1190 |
| 1191 // endRecording finally makes the picture accessible | 1191 // endRecording finally makes the picture accessible |
| 1192 dl->endRecording(); | 1192 dl->endRecording(); |
| 1193 pic = dl->picture(); | 1193 pic = dl->picture(); |
| 1194 EXPECT_TRUE(pic); | 1194 EXPECT_TRUE(pic); |
| 1195 EXPECT_EQ(1, pic->getRefCnt()); | 1195 EXPECT_TRUE(pic->unique()); |
| 1196 } | 1196 } |
| 1197 | 1197 |
| 1198 } // namespace | 1198 } // namespace |
| OLD | NEW |