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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 162 |
163 test_find_existing(reporter, fullImg, subsetImg); | 163 test_find_existing(reporter, fullImg, subsetImg); |
164 test_dont_find_if_diff_key(reporter, fullImg, subsetImg); | 164 test_dont_find_if_diff_key(reporter, fullImg, subsetImg); |
165 test_internal_purge(reporter, fullImg); | 165 test_internal_purge(reporter, fullImg); |
166 test_explicit_purging(reporter, fullImg, subsetImg); | 166 test_explicit_purging(reporter, fullImg, subsetImg); |
167 } | 167 } |
168 | 168 |
169 DEF_TEST(ImageFilterCache_ImageBackedRaster, reporter) { | 169 DEF_TEST(ImageFilterCache_ImageBackedRaster, reporter) { |
170 SkBitmap srcBM = create_bm(); | 170 SkBitmap srcBM = create_bm(); |
171 | 171 |
172 SkAutoTUnref<SkImage> srcImage(SkImage::NewFromBitmap(srcBM)); | 172 sk_sp<SkImage> srcImage(SkImage::MakeFromBitmap(srcBM)); |
173 | 173 |
174 test_image_backed(reporter, srcImage); | 174 test_image_backed(reporter, srcImage.get()); |
175 } | 175 } |
176 | 176 |
177 #if SK_SUPPORT_GPU | 177 #if SK_SUPPORT_GPU |
178 #include "GrContext.h" | 178 #include "GrContext.h" |
179 | 179 |
180 static GrTexture* create_texture(GrContext* context) { | 180 static GrTexture* create_texture(GrContext* context) { |
181 SkBitmap srcBM = create_bm(); | 181 SkBitmap srcBM = create_bm(); |
182 | 182 |
183 GrSurfaceDesc desc; | 183 GrSurfaceDesc desc; |
184 desc.fConfig = kSkia8888_GrPixelConfig; | 184 desc.fConfig = kSkia8888_GrPixelConfig; |
(...skipping 10 matching lines...) Expand all Loading... |
195 return; | 195 return; |
196 } | 196 } |
197 | 197 |
198 GrBackendTextureDesc backendDesc; | 198 GrBackendTextureDesc backendDesc; |
199 backendDesc.fConfig = kSkia8888_GrPixelConfig; | 199 backendDesc.fConfig = kSkia8888_GrPixelConfig; |
200 backendDesc.fFlags = kNone_GrBackendTextureFlag; | 200 backendDesc.fFlags = kNone_GrBackendTextureFlag; |
201 backendDesc.fWidth = kFullSize; | 201 backendDesc.fWidth = kFullSize; |
202 backendDesc.fHeight = kFullSize; | 202 backendDesc.fHeight = kFullSize; |
203 backendDesc.fSampleCnt = 0; | 203 backendDesc.fSampleCnt = 0; |
204 backendDesc.fTextureHandle = srcTexture->getTextureHandle(); | 204 backendDesc.fTextureHandle = srcTexture->getTextureHandle(); |
205 SkAutoTUnref<SkImage> srcImage(SkImage::NewFromTexture(context, backendDesc, | 205 sk_sp<SkImage> srcImage(SkImage::MakeFromTexture(context, backendDesc, kPrem
ul_SkAlphaType)); |
206 kPremul_SkAlphaType))
; | |
207 if (!srcImage) { | 206 if (!srcImage) { |
208 return; | 207 return; |
209 } | 208 } |
210 | 209 |
211 test_image_backed(reporter, srcImage); | 210 test_image_backed(reporter, srcImage.get()); |
212 } | 211 } |
213 | 212 |
214 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_GPUBacked, reporter, context
) { | 213 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_GPUBacked, reporter, context
) { |
215 | 214 |
216 SkAutoTUnref<GrTexture> srcTexture(create_texture(context)); | 215 SkAutoTUnref<GrTexture> srcTexture(create_texture(context)); |
217 if (!srcTexture) { | 216 if (!srcTexture) { |
218 return; | 217 return; |
219 } | 218 } |
220 | 219 |
221 const SkIRect& full = SkIRect::MakeWH(kFullSize, kFullSize); | 220 const SkIRect& full = SkIRect::MakeWH(kFullSize, kFullSize); |
(...skipping 10 matching lines...) Expand all Loading... |
232 kNeedNewImageUni
queID_SpecialImage, | 231 kNeedNewImageUni
queID_SpecialImage, |
233 srcTexture)); | 232 srcTexture)); |
234 | 233 |
235 test_find_existing(reporter, fullImg, subsetImg); | 234 test_find_existing(reporter, fullImg, subsetImg); |
236 test_dont_find_if_diff_key(reporter, fullImg, subsetImg); | 235 test_dont_find_if_diff_key(reporter, fullImg, subsetImg); |
237 test_internal_purge(reporter, fullImg); | 236 test_internal_purge(reporter, fullImg); |
238 test_explicit_purging(reporter, fullImg, subsetImg); | 237 test_explicit_purging(reporter, fullImg, subsetImg); |
239 } | 238 } |
240 #endif | 239 #endif |
241 | 240 |
OLD | NEW |