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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 const sk_sp<SkSpecialImage>& gpuBacked) { | 203 const sk_sp<SkSpecialImage>& gpuBacked) { |
204 REPORTER_ASSERT(reporter, gpuBacked); | 204 REPORTER_ASSERT(reporter, gpuBacked); |
205 REPORTER_ASSERT(reporter, gpuBacked->isTextureBacked()); | 205 REPORTER_ASSERT(reporter, gpuBacked->isTextureBacked()); |
206 REPORTER_ASSERT(reporter, gpuBacked->uniqueID() == orig->uniqueID()); | 206 REPORTER_ASSERT(reporter, gpuBacked->uniqueID() == orig->uniqueID()); |
207 REPORTER_ASSERT(reporter, gpuBacked->subset().width() == orig->subset().widt
h() && | 207 REPORTER_ASSERT(reporter, gpuBacked->subset().width() == orig->subset().widt
h() && |
208 gpuBacked->subset().height() == orig->subset().hei
ght()); | 208 gpuBacked->subset().height() == orig->subset().hei
ght()); |
209 } | 209 } |
210 | 210 |
211 // Test out the SkSpecialImage::makeTextureImage entry point | 211 // Test out the SkSpecialImage::makeTextureImage entry point |
212 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, ctxInfo)
{ | 212 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, ctxInfo)
{ |
213 GrContext* context = ctxInfo.fGrContext; | 213 GrContext* context = ctxInfo.grContext(); |
214 SkBitmap bm = create_bm(); | 214 SkBitmap bm = create_bm(); |
215 | 215 |
216 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller
Size); | 216 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller
Size); |
217 | 217 |
218 { | 218 { |
219 // raster | 219 // raster |
220 sk_sp<SkSpecialImage> rasterImage(SkSpecialImage::MakeFromRaster( | 220 sk_sp<SkSpecialImage> rasterImage(SkSpecialImage::MakeFromRaster( |
221 SkIRect:
:MakeWH(kFullSize, | 221 SkIRect:
:MakeWH(kFullSize, |
222
kFullSize), | 222
kFullSize), |
223 bm)); | 223 bm)); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 { | 265 { |
266 sk_sp<SkSpecialImage> subGPUImage(gpuImage->makeSubset(subset)); | 266 sk_sp<SkSpecialImage> subGPUImage(gpuImage->makeSubset(subset)); |
267 | 267 |
268 sk_sp<SkSpecialImage> fromSubGPU(subGPUImage->makeTextureImage(conte
xt)); | 268 sk_sp<SkSpecialImage> fromSubGPU(subGPUImage->makeTextureImage(conte
xt)); |
269 test_texture_backed(reporter, subGPUImage, fromSubGPU); | 269 test_texture_backed(reporter, subGPUImage, fromSubGPU); |
270 } | 270 } |
271 } | 271 } |
272 } | 272 } |
273 | 273 |
274 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) { | 274 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) { |
275 GrContext* context = ctxInfo.fGrContext; | 275 GrContext* context = ctxInfo.grContext(); |
276 SkBitmap bm = create_bm(); | 276 SkBitmap bm = create_bm(); |
277 | 277 |
278 GrSurfaceDesc desc; | 278 GrSurfaceDesc desc; |
279 desc.fConfig = kSkia8888_GrPixelConfig; | 279 desc.fConfig = kSkia8888_GrPixelConfig; |
280 desc.fFlags = kNone_GrSurfaceFlags; | 280 desc.fFlags = kNone_GrSurfaceFlags; |
281 desc.fWidth = kFullSize; | 281 desc.fWidth = kFullSize; |
282 desc.fHeight = kFullSize; | 282 desc.fHeight = kFullSize; |
283 | 283 |
284 sk_sp<GrTexture> texture(context->textureProvider()->createTexture(desc, | 284 sk_sp<GrTexture> texture(context->textureProvider()->createTexture(desc, |
285 SkBudgete
d::kNo, | 285 SkBudgete
d::kNo, |
(...skipping 17 matching lines...) Expand all Loading... |
303 test_image(subSImg1, reporter, context, true, kPad, kFullSize); | 303 test_image(subSImg1, reporter, context, true, kPad, kFullSize); |
304 } | 304 } |
305 | 305 |
306 { | 306 { |
307 sk_sp<SkSpecialImage> subSImg2(fullSImg->makeSubset(subset)); | 307 sk_sp<SkSpecialImage> subSImg2(fullSImg->makeSubset(subset)); |
308 test_image(subSImg2, reporter, context, true, kPad, kFullSize); | 308 test_image(subSImg2, reporter, context, true, kPad, kFullSize); |
309 } | 309 } |
310 } | 310 } |
311 | 311 |
312 #endif | 312 #endif |
OLD | NEW |