| 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 | 9 |
| 10 #if SK_SUPPORT_GPU | 10 #if SK_SUPPORT_GPU |
| 11 | 11 |
| 12 #include "GrContextFactory.h" | 12 #include "GrContext.h" |
| 13 #include "GrLayerCache.h" | 13 #include "GrLayerCache.h" |
| 14 #include "GrRecordReplaceDraw.h" | 14 #include "GrRecordReplaceDraw.h" |
| 15 #include "RecordTestUtils.h" | 15 #include "RecordTestUtils.h" |
| 16 #include "SkBBHFactory.h" | 16 #include "SkBBHFactory.h" |
| 17 #include "SkPictureRecorder.h" | 17 #include "SkPictureRecorder.h" |
| 18 #include "SkRecordDraw.h" | 18 #include "SkRecordDraw.h" |
| 19 #include "SkRecorder.h" | 19 #include "SkRecorder.h" |
| 20 #include "SkUtils.h" | 20 #include "SkUtils.h" |
| 21 | 21 |
| 22 static const int kWidth = 100; | 22 static const int kWidth = 100; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 GrRecordReplaceDraw(pic, &canvas, layerCache, SkMatrix::I(), nullptr/*callba
ck*/); | 133 GrRecordReplaceDraw(pic, &canvas, layerCache, SkMatrix::I(), nullptr/*callba
ck*/); |
| 134 | 134 |
| 135 int numLayers = count_instances_of_type<SkRecords::SaveLayer>(rerecord); | 135 int numLayers = count_instances_of_type<SkRecords::SaveLayer>(rerecord); |
| 136 if (doReplace) { | 136 if (doReplace) { |
| 137 REPORTER_ASSERT(r, 0 == numLayers); | 137 REPORTER_ASSERT(r, 0 == numLayers); |
| 138 } else { | 138 } else { |
| 139 REPORTER_ASSERT(r, 1 == numLayers); | 139 REPORTER_ASSERT(r, 1 == numLayers); |
| 140 } | 140 } |
| 141 } | 141 } |
| 142 | 142 |
| 143 DEF_GPUTEST(RecordReplaceDraw, r, factory) { | 143 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(RecordReplaceDraw, r, context) { |
| 144 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { | 144 test_replacements(r, context, false); |
| 145 GrContextFactory::GLContextType glType = static_cast<GrContextFactory::G
LContextType>(type); | 145 test_replacements(r, context, true); |
| 146 if (!GrContextFactory::IsRenderingGLContext(glType)) { | |
| 147 continue; | |
| 148 } | |
| 149 GrContext* context = factory->get(glType); | |
| 150 if (nullptr == context) { | |
| 151 continue; | |
| 152 } | |
| 153 | |
| 154 test_replacements(r, context, false); | |
| 155 test_replacements(r, context, true); | |
| 156 } | |
| 157 } | 146 } |
| 158 | 147 |
| 159 #endif | 148 #endif |
| OLD | NEW |