| 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 backendDesc.fSampleCnt = 0; | 201 backendDesc.fSampleCnt = 0; |
| 202 backendDesc.fTextureHandle = srcTexture->getTextureHandle(); | 202 backendDesc.fTextureHandle = srcTexture->getTextureHandle(); |
| 203 sk_sp<SkImage> srcImage(SkImage::MakeFromTexture(ctxInfo.fGrContext, backend
Desc, kPremul_SkAlphaType)); | 203 sk_sp<SkImage> srcImage(SkImage::MakeFromTexture(ctxInfo.fGrContext, backend
Desc, kPremul_SkAlphaType)); |
| 204 if (!srcImage) { | 204 if (!srcImage) { |
| 205 return; | 205 return; |
| 206 } | 206 } |
| 207 | 207 |
| 208 test_image_backed(reporter, srcImage); | 208 test_image_backed(reporter, srcImage); |
| 209 } | 209 } |
| 210 | 210 |
| 211 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterCache_GPUBacked, reporter, ctxI
nfo) { | 211 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_GPUBacked, reporter, ctxInfo
) { |
| 212 | 212 |
| 213 SkAutoTUnref<GrTexture> srcTexture(create_texture(ctxInfo.fGrContext)); | 213 SkAutoTUnref<GrTexture> srcTexture(create_texture(ctxInfo.fGrContext)); |
| 214 if (!srcTexture) { | 214 if (!srcTexture) { |
| 215 return; | 215 return; |
| 216 } | 216 } |
| 217 | 217 |
| 218 const SkIRect& full = SkIRect::MakeWH(kFullSize, kFullSize); | 218 const SkIRect& full = SkIRect::MakeWH(kFullSize, kFullSize); |
| 219 | 219 |
| 220 sk_sp<SkSpecialImage> fullImg(SkSpecialImage::MakeFromGpu(nullptr, full, | 220 sk_sp<SkSpecialImage> fullImg(SkSpecialImage::MakeFromGpu(nullptr, full, |
| 221 kNeedNewImageUniqu
eID_SpecialImage, | 221 kNeedNewImageUniqu
eID_SpecialImage, |
| 222 srcTexture)); | 222 srcTexture)); |
| 223 | 223 |
| 224 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller
Size); | 224 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller
Size); |
| 225 | 225 |
| 226 sk_sp<SkSpecialImage> subsetImg(SkSpecialImage::MakeFromGpu(nullptr, subset, | 226 sk_sp<SkSpecialImage> subsetImg(SkSpecialImage::MakeFromGpu(nullptr, subset, |
| 227 kNeedNewImageUni
queID_SpecialImage, | 227 kNeedNewImageUni
queID_SpecialImage, |
| 228 srcTexture)); | 228 srcTexture)); |
| 229 | 229 |
| 230 test_find_existing(reporter, fullImg, subsetImg); | 230 test_find_existing(reporter, fullImg, subsetImg); |
| 231 test_dont_find_if_diff_key(reporter, fullImg, subsetImg); | 231 test_dont_find_if_diff_key(reporter, fullImg, subsetImg); |
| 232 test_internal_purge(reporter, fullImg); | 232 test_internal_purge(reporter, fullImg); |
| 233 test_explicit_purging(reporter, fullImg, subsetImg); | 233 test_explicit_purging(reporter, fullImg, subsetImg); |
| 234 } | 234 } |
| 235 #endif | 235 #endif |
| OLD | NEW |