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 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 SkIRect::MakeWH(kWi
dth, kHeight), | 117 SkIRect::MakeWH(kWi
dth, kHeight), |
118 SkMatrix::I(), key,
1, &paint); | 118 SkMatrix::I(), key,
1, &paint); |
119 | 119 |
120 GrSurfaceDesc desc; | 120 GrSurfaceDesc desc; |
121 desc.fConfig = kSkia8888_GrPixelConfig; | 121 desc.fConfig = kSkia8888_GrPixelConfig; |
122 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 122 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
123 desc.fWidth = kWidth; | 123 desc.fWidth = kWidth; |
124 desc.fHeight = kHeight; | 124 desc.fHeight = kHeight; |
125 desc.fSampleCnt = 0; | 125 desc.fSampleCnt = 0; |
126 | 126 |
127 texture.reset(context->textureProvider()->createTexture( | 127 texture.reset(context->textureProvider()->createTexture(desc, false, nul
lptr, 0)); |
128 desc, SkBudgeted::kNo, nullptr, 0)); | |
129 layer->setTexture(texture, SkIRect::MakeWH(kWidth, kHeight), false); | 128 layer->setTexture(texture, SkIRect::MakeWH(kWidth, kHeight), false); |
130 } | 129 } |
131 | 130 |
132 SkRecord rerecord; | 131 SkRecord rerecord; |
133 SkRecorder canvas(&rerecord, kWidth, kHeight); | 132 SkRecorder canvas(&rerecord, kWidth, kHeight); |
134 GrRecordReplaceDraw(pic, &canvas, layerCache, SkMatrix::I(), nullptr/*callba
ck*/); | 133 GrRecordReplaceDraw(pic, &canvas, layerCache, SkMatrix::I(), nullptr/*callba
ck*/); |
135 | 134 |
136 int numLayers = count_instances_of_type<SkRecords::SaveLayer>(rerecord); | 135 int numLayers = count_instances_of_type<SkRecords::SaveLayer>(rerecord); |
137 if (doReplace) { | 136 if (doReplace) { |
138 REPORTER_ASSERT(r, 0 == numLayers); | 137 REPORTER_ASSERT(r, 0 == numLayers); |
139 } else { | 138 } else { |
140 REPORTER_ASSERT(r, 1 == numLayers); | 139 REPORTER_ASSERT(r, 1 == numLayers); |
141 } | 140 } |
142 } | 141 } |
143 | 142 |
144 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(RecordReplaceDraw, r, context) { | 143 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(RecordReplaceDraw, r, context) { |
145 test_replacements(r, context, false); | 144 test_replacements(r, context, false); |
146 test_replacements(r, context, true); | 145 test_replacements(r, context, true); |
147 } | 146 } |
148 | 147 |
149 #endif | 148 #endif |
OLD | NEW |