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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 const sk_sp<SkSpecialImage>& orig, | 196 const sk_sp<SkSpecialImage>& orig, |
197 const sk_sp<SkSpecialImage>& gpuBacked) { | 197 const sk_sp<SkSpecialImage>& gpuBacked) { |
198 REPORTER_ASSERT(reporter, gpuBacked); | 198 REPORTER_ASSERT(reporter, gpuBacked); |
199 REPORTER_ASSERT(reporter, gpuBacked->peekTexture()); | 199 REPORTER_ASSERT(reporter, gpuBacked->peekTexture()); |
200 REPORTER_ASSERT(reporter, gpuBacked->uniqueID() == orig->uniqueID()); | 200 REPORTER_ASSERT(reporter, gpuBacked->uniqueID() == orig->uniqueID()); |
201 REPORTER_ASSERT(reporter, gpuBacked->subset().width() == orig->subset().widt
h() && | 201 REPORTER_ASSERT(reporter, gpuBacked->subset().width() == orig->subset().widt
h() && |
202 gpuBacked->subset().height() == orig->subset().hei
ght()); | 202 gpuBacked->subset().height() == orig->subset().hei
ght()); |
203 } | 203 } |
204 | 204 |
205 // Test out the SkSpecialImage::makeTextureImage entry point | 205 // Test out the SkSpecialImage::makeTextureImage entry point |
206 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, ctxInfo)
{ | 206 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, ctxInf
o) { |
207 GrContext* context = ctxInfo.fGrContext; | 207 GrContext* context = ctxInfo.fGrContext; |
208 SkBitmap bm = create_bm(); | 208 SkBitmap bm = create_bm(); |
209 | 209 |
210 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller
Size); | 210 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller
Size); |
211 | 211 |
212 { | 212 { |
213 // raster | 213 // raster |
214 sk_sp<SkSpecialImage> rasterImage(SkSpecialImage::MakeFromRaster( | 214 sk_sp<SkSpecialImage> rasterImage(SkSpecialImage::MakeFromRaster( |
215 nullptr, | 215 nullptr, |
216 SkIRect:
:MakeWH(kFullSize, | 216 SkIRect:
:MakeWH(kFullSize, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 260 |
261 { | 261 { |
262 sk_sp<SkSpecialImage> subGPUImage(gpuImage->makeSubset(subset)); | 262 sk_sp<SkSpecialImage> subGPUImage(gpuImage->makeSubset(subset)); |
263 | 263 |
264 sk_sp<SkSpecialImage> fromSubGPU(subGPUImage->makeTextureImage(nullp
tr, context)); | 264 sk_sp<SkSpecialImage> fromSubGPU(subGPUImage->makeTextureImage(nullp
tr, context)); |
265 test_texture_backed(reporter, subGPUImage, fromSubGPU); | 265 test_texture_backed(reporter, subGPUImage, fromSubGPU); |
266 } | 266 } |
267 } | 267 } |
268 } | 268 } |
269 | 269 |
270 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) { | 270 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) { |
271 GrContext* context = ctxInfo.fGrContext; | 271 GrContext* context = ctxInfo.fGrContext; |
272 SkBitmap bm = create_bm(); | 272 SkBitmap bm = create_bm(); |
273 | 273 |
274 GrSurfaceDesc desc; | 274 GrSurfaceDesc desc; |
275 desc.fConfig = kSkia8888_GrPixelConfig; | 275 desc.fConfig = kSkia8888_GrPixelConfig; |
276 desc.fFlags = kNone_GrSurfaceFlags; | 276 desc.fFlags = kNone_GrSurfaceFlags; |
277 desc.fWidth = kFullSize; | 277 desc.fWidth = kFullSize; |
278 desc.fHeight = kFullSize; | 278 desc.fHeight = kFullSize; |
279 | 279 |
280 SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(de
sc, | 280 SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(de
sc, |
(...skipping 19 matching lines...) Expand all Loading... |
300 test_image(subSImg1, reporter, false, true, kPad, kFullSize); | 300 test_image(subSImg1, reporter, false, true, kPad, kFullSize); |
301 } | 301 } |
302 | 302 |
303 { | 303 { |
304 sk_sp<SkSpecialImage> subSImg2(fullSImg->makeSubset(subset)); | 304 sk_sp<SkSpecialImage> subSImg2(fullSImg->makeSubset(subset)); |
305 test_image(subSImg2, reporter, false, true, kPad, kFullSize); | 305 test_image(subSImg2, reporter, false, true, kPad, kFullSize); |
306 } | 306 } |
307 } | 307 } |
308 | 308 |
309 #endif | 309 #endif |
OLD | NEW |