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, context)
{ | 206 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, ctxInfo)
{ |
| 207 GrContext* context = ctxInfo.fGrContext; |
207 SkBitmap bm = create_bm(); | 208 SkBitmap bm = create_bm(); |
208 | 209 |
209 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller
Size); | 210 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller
Size); |
210 | 211 |
211 { | 212 { |
212 // raster | 213 // raster |
213 sk_sp<SkSpecialImage> rasterImage(SkSpecialImage::MakeFromRaster( | 214 sk_sp<SkSpecialImage> rasterImage(SkSpecialImage::MakeFromRaster( |
214 nullptr, | 215 nullptr, |
215 SkIRect:
:MakeWH(kFullSize, | 216 SkIRect:
:MakeWH(kFullSize, |
216
kFullSize), | 217
kFullSize), |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 260 |
260 { | 261 { |
261 sk_sp<SkSpecialImage> subGPUImage(gpuImage->makeSubset(subset)); | 262 sk_sp<SkSpecialImage> subGPUImage(gpuImage->makeSubset(subset)); |
262 | 263 |
263 sk_sp<SkSpecialImage> fromSubGPU(subGPUImage->makeTextureImage(nullp
tr, context)); | 264 sk_sp<SkSpecialImage> fromSubGPU(subGPUImage->makeTextureImage(nullp
tr, context)); |
264 test_texture_backed(reporter, subGPUImage, fromSubGPU); | 265 test_texture_backed(reporter, subGPUImage, fromSubGPU); |
265 } | 266 } |
266 } | 267 } |
267 } | 268 } |
268 | 269 |
269 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, context) { | 270 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) { |
| 271 GrContext* context = ctxInfo.fGrContext; |
270 SkBitmap bm = create_bm(); | 272 SkBitmap bm = create_bm(); |
271 | 273 |
272 GrSurfaceDesc desc; | 274 GrSurfaceDesc desc; |
273 desc.fConfig = kSkia8888_GrPixelConfig; | 275 desc.fConfig = kSkia8888_GrPixelConfig; |
274 desc.fFlags = kNone_GrSurfaceFlags; | 276 desc.fFlags = kNone_GrSurfaceFlags; |
275 desc.fWidth = kFullSize; | 277 desc.fWidth = kFullSize; |
276 desc.fHeight = kFullSize; | 278 desc.fHeight = kFullSize; |
277 | 279 |
278 SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(de
sc, | 280 SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(de
sc, |
279 Sk
Budgeted::kNo, | 281 Sk
Budgeted::kNo, |
(...skipping 18 matching lines...) Expand all Loading... |
298 test_image(subSImg1, reporter, false, true, kPad, kFullSize); | 300 test_image(subSImg1, reporter, false, true, kPad, kFullSize); |
299 } | 301 } |
300 | 302 |
301 { | 303 { |
302 sk_sp<SkSpecialImage> subSImg2(fullSImg->makeSubset(subset)); | 304 sk_sp<SkSpecialImage> subSImg2(fullSImg->makeSubset(subset)); |
303 test_image(subSImg2, reporter, false, true, kPad, kFullSize); | 305 test_image(subSImg2, reporter, false, true, kPad, kFullSize); |
304 } | 306 } |
305 } | 307 } |
306 | 308 |
307 #endif | 309 #endif |
OLD | NEW |