OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 GrSurfaceDesc desc; | 184 GrSurfaceDesc desc; |
185 desc.fConfig = kSkia8888_GrPixelConfig; | 185 desc.fConfig = kSkia8888_GrPixelConfig; |
186 desc.fFlags = kNone_GrSurfaceFlags; | 186 desc.fFlags = kNone_GrSurfaceFlags; |
187 desc.fWidth = kFullSize; | 187 desc.fWidth = kFullSize; |
188 desc.fHeight = kFullSize; | 188 desc.fHeight = kFullSize; |
189 | 189 |
190 return context->textureProvider()->createTexture(desc, SkBudgeted::kNo, srcB
M.getPixels(), 0); | 190 return context->textureProvider()->createTexture(desc, SkBudgeted::kNo, srcB
M.getPixels(), 0); |
191 } | 191 } |
192 | 192 |
193 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterCache_ImageBackedGPU, reporter,
ctxInfo) { | 193 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterCache_ImageBackedGPU, reporter,
ctxInfo) { |
194 SkAutoTUnref<GrTexture> srcTexture(create_texture(ctxInfo.fGrContext)); | 194 SkAutoTUnref<GrTexture> srcTexture(create_texture(ctxInfo.grContext())); |
195 if (!srcTexture) { | 195 if (!srcTexture) { |
196 return; | 196 return; |
197 } | 197 } |
198 | 198 |
199 GrBackendTextureDesc backendDesc; | 199 GrBackendTextureDesc backendDesc; |
200 backendDesc.fConfig = kSkia8888_GrPixelConfig; | 200 backendDesc.fConfig = kSkia8888_GrPixelConfig; |
201 backendDesc.fFlags = kNone_GrBackendTextureFlag; | 201 backendDesc.fFlags = kNone_GrBackendTextureFlag; |
202 backendDesc.fWidth = kFullSize; | 202 backendDesc.fWidth = kFullSize; |
203 backendDesc.fHeight = kFullSize; | 203 backendDesc.fHeight = kFullSize; |
204 backendDesc.fSampleCnt = 0; | 204 backendDesc.fSampleCnt = 0; |
205 backendDesc.fTextureHandle = srcTexture->getTextureHandle(); | 205 backendDesc.fTextureHandle = srcTexture->getTextureHandle(); |
206 sk_sp<SkImage> srcImage(SkImage::MakeFromTexture(ctxInfo.fGrContext, backend
Desc, kPremul_SkAlphaType)); | 206 sk_sp<SkImage> srcImage(SkImage::MakeFromTexture(ctxInfo.grContext(), backen
dDesc, kPremul_SkAlphaType)); |
207 if (!srcImage) { | 207 if (!srcImage) { |
208 return; | 208 return; |
209 } | 209 } |
210 | 210 |
211 test_image_backed(reporter, srcImage); | 211 test_image_backed(reporter, srcImage); |
212 } | 212 } |
213 | 213 |
214 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_GPUBacked, reporter, ctxInfo
) { | 214 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_GPUBacked, reporter, ctxInfo
) { |
215 | 215 |
216 sk_sp<GrTexture> srcTexture(create_texture(ctxInfo.fGrContext)); | 216 sk_sp<GrTexture> srcTexture(create_texture(ctxInfo.grContext())); |
217 if (!srcTexture) { | 217 if (!srcTexture) { |
218 return; | 218 return; |
219 } | 219 } |
220 | 220 |
221 const SkIRect& full = SkIRect::MakeWH(kFullSize, kFullSize); | 221 const SkIRect& full = SkIRect::MakeWH(kFullSize, kFullSize); |
222 | 222 |
223 sk_sp<SkSpecialImage> fullImg(SkSpecialImage::MakeFromGpu(full, | 223 sk_sp<SkSpecialImage> fullImg(SkSpecialImage::MakeFromGpu(full, |
224 kNeedNewImageUniqu
eID_SpecialImage, | 224 kNeedNewImageUniqu
eID_SpecialImage, |
225 srcTexture)); | 225 srcTexture)); |
226 | 226 |
227 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller
Size); | 227 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller
Size); |
228 | 228 |
229 sk_sp<SkSpecialImage> subsetImg(SkSpecialImage::MakeFromGpu(subset, | 229 sk_sp<SkSpecialImage> subsetImg(SkSpecialImage::MakeFromGpu(subset, |
230 kNeedNewImageUni
queID_SpecialImage, | 230 kNeedNewImageUni
queID_SpecialImage, |
231 srcTexture)); | 231 srcTexture)); |
232 | 232 |
233 test_find_existing(reporter, fullImg, subsetImg); | 233 test_find_existing(reporter, fullImg, subsetImg); |
234 test_dont_find_if_diff_key(reporter, fullImg, subsetImg); | 234 test_dont_find_if_diff_key(reporter, fullImg, subsetImg); |
235 test_internal_purge(reporter, fullImg); | 235 test_internal_purge(reporter, fullImg); |
236 test_explicit_purging(reporter, fullImg, subsetImg); | 236 test_explicit_purging(reporter, fullImg, subsetImg); |
237 } | 237 } |
238 #endif | 238 #endif |
OLD | NEW |