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 "SkAutoPixmapStorage.h" | 8 #include "SkAutoPixmapStorage.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 const sk_sp<SkSpecialImage>& orig, | 206 const sk_sp<SkSpecialImage>& orig, |
207 const sk_sp<SkSpecialImage>& gpuBacked) { | 207 const sk_sp<SkSpecialImage>& gpuBacked) { |
208 REPORTER_ASSERT(reporter, gpuBacked); | 208 REPORTER_ASSERT(reporter, gpuBacked); |
209 REPORTER_ASSERT(reporter, gpuBacked->isTextureBacked()); | 209 REPORTER_ASSERT(reporter, gpuBacked->isTextureBacked()); |
210 REPORTER_ASSERT(reporter, gpuBacked->uniqueID() == orig->uniqueID()); | 210 REPORTER_ASSERT(reporter, gpuBacked->uniqueID() == orig->uniqueID()); |
211 REPORTER_ASSERT(reporter, gpuBacked->subset().width() == orig->subset().widt
h() && | 211 REPORTER_ASSERT(reporter, gpuBacked->subset().width() == orig->subset().widt
h() && |
212 gpuBacked->subset().height() == orig->subset().hei
ght()); | 212 gpuBacked->subset().height() == orig->subset().hei
ght()); |
213 } | 213 } |
214 | 214 |
215 // Test out the SkSpecialImage::makeTextureImage entry point | 215 // Test out the SkSpecialImage::makeTextureImage entry point |
216 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, ctxInf
o) { | 216 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, ctxInfo)
{ |
217 GrContext* context = ctxInfo.fGrContext; | 217 GrContext* context = ctxInfo.fGrContext; |
218 SkBitmap bm = create_bm(); | 218 SkBitmap bm = create_bm(); |
219 | 219 |
220 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller
Size); | 220 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller
Size); |
221 | 221 |
222 { | 222 { |
223 // raster | 223 // raster |
224 sk_sp<SkSpecialImage> rasterImage(SkSpecialImage::MakeFromRaster( | 224 sk_sp<SkSpecialImage> rasterImage(SkSpecialImage::MakeFromRaster( |
225 nullptr, | 225 nullptr, |
226 SkIRect:
:MakeWH(kFullSize, | 226 SkIRect:
:MakeWH(kFullSize, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 | 270 |
271 { | 271 { |
272 sk_sp<SkSpecialImage> subGPUImage(gpuImage->makeSubset(subset)); | 272 sk_sp<SkSpecialImage> subGPUImage(gpuImage->makeSubset(subset)); |
273 | 273 |
274 sk_sp<SkSpecialImage> fromSubGPU(subGPUImage->makeTextureImage(nullp
tr, context)); | 274 sk_sp<SkSpecialImage> fromSubGPU(subGPUImage->makeTextureImage(nullp
tr, context)); |
275 test_texture_backed(reporter, subGPUImage, fromSubGPU); | 275 test_texture_backed(reporter, subGPUImage, fromSubGPU); |
276 } | 276 } |
277 } | 277 } |
278 } | 278 } |
279 | 279 |
280 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) { | 280 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) { |
281 GrContext* context = ctxInfo.fGrContext; | 281 GrContext* context = ctxInfo.fGrContext; |
282 SkBitmap bm = create_bm(); | 282 SkBitmap bm = create_bm(); |
283 | 283 |
284 GrSurfaceDesc desc; | 284 GrSurfaceDesc desc; |
285 desc.fConfig = kSkia8888_GrPixelConfig; | 285 desc.fConfig = kSkia8888_GrPixelConfig; |
286 desc.fFlags = kNone_GrSurfaceFlags; | 286 desc.fFlags = kNone_GrSurfaceFlags; |
287 desc.fWidth = kFullSize; | 287 desc.fWidth = kFullSize; |
288 desc.fHeight = kFullSize; | 288 desc.fHeight = kFullSize; |
289 | 289 |
290 SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(de
sc, | 290 SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(de
sc, |
(...skipping 19 matching lines...) Expand all Loading... |
310 test_image(subSImg1, reporter, context, true, kPad, kFullSize); | 310 test_image(subSImg1, reporter, context, true, kPad, kFullSize); |
311 } | 311 } |
312 | 312 |
313 { | 313 { |
314 sk_sp<SkSpecialImage> subSImg2(fullSImg->makeSubset(subset)); | 314 sk_sp<SkSpecialImage> subSImg2(fullSImg->makeSubset(subset)); |
315 test_image(subSImg2, reporter, context, true, kPad, kFullSize); | 315 test_image(subSImg2, reporter, context, true, kPad, kFullSize); |
316 } | 316 } |
317 } | 317 } |
318 | 318 |
319 #endif | 319 #endif |
OLD | NEW |