| 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 #if SK_SUPPORT_GPU | 8 #if SK_SUPPORT_GPU |
| 9 | 9 |
| 10 #include "Test.h" | 10 #include "Test.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 canvas->save(); | 78 canvas->save(); |
| 79 canvas->scale(2, 2); | 79 canvas->scale(2, 2); |
| 80 pic.reset(recorder.endRecording()); | 80 pic.reset(recorder.endRecording()); |
| 81 } | 81 } |
| 82 | 82 |
| 83 SkRecord rerecord; | 83 SkRecord rerecord; |
| 84 SkRecorder canvas(&rerecord, kWidth, kHeight); | 84 SkRecorder canvas(&rerecord, kWidth, kHeight); |
| 85 | 85 |
| 86 GrRecordReplaceDraw(pic, &canvas, NULL, SkMatrix::I(), NULL/*callback*/); | 86 GrRecordReplaceDraw(pic, &canvas, NULL, SkMatrix::I(), NULL/*callback*/); |
| 87 | 87 |
| 88 // ensure rerecord is balanced (in this case by checking that the count is e
ven) | 88 // ensure rerecord is balanced (in this case by checking that the count is o
dd) |
| 89 REPORTER_ASSERT(r, (rerecord.count() & 1) == 0); | 89 REPORTER_ASSERT(r, (rerecord.count() & 1) == 1); |
| 90 } | 90 } |
| 91 | 91 |
| 92 // Test out the layer replacement functionality with and w/o a BBH | 92 // Test out the layer replacement functionality with and w/o a BBH |
| 93 void test_replacements(skiatest::Reporter* r, GrContext* context, bool useBBH) { | 93 void test_replacements(skiatest::Reporter* r, GrContext* context, bool useBBH) { |
| 94 SkAutoTUnref<const SkPicture> pic; | 94 SkAutoTUnref<const SkPicture> pic; |
| 95 | 95 |
| 96 { | 96 { |
| 97 SkRTreeFactory bbhFactory; | 97 SkRTreeFactory bbhFactory; |
| 98 SkPictureRecorder recorder; | 98 SkPictureRecorder recorder; |
| 99 SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(kWidth), SkIntT
oScalar(kHeight), | 99 SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(kWidth), SkIntT
oScalar(kHeight), |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 if (NULL == context) { | 160 if (NULL == context) { |
| 161 continue; | 161 continue; |
| 162 } | 162 } |
| 163 | 163 |
| 164 test_replacements(r, context, true); | 164 test_replacements(r, context, true); |
| 165 test_replacements(r, context, false); | 165 test_replacements(r, context, false); |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 | 168 |
| 169 #endif | 169 #endif |
| OLD | NEW |