OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #ifndef PictureRenderer_DEFINED | 8 #ifndef PictureRenderer_DEFINED |
9 #define PictureRenderer_DEFINED | 9 #define PictureRenderer_DEFINED |
10 | 10 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 fGrContext->ref(); | 213 fGrContext->ref(); |
214 return true; | 214 return true; |
215 } | 215 } |
216 #endif | 216 #endif |
217 } | 217 } |
218 | 218 |
219 #if SK_SUPPORT_GPU | 219 #if SK_SUPPORT_GPU |
220 void setSampleCount(int sampleCount) { | 220 void setSampleCount(int sampleCount) { |
221 fSampleCount = sampleCount; | 221 fSampleCount = sampleCount; |
222 } | 222 } |
223 | |
224 void setUseDFText(bool useDFText) { | |
225 fUseDFText = useDFText; | |
226 } | |
227 #endif | 223 #endif |
228 | 224 |
229 void setDrawFilters(DrawFilterFlags const * const filters, const SkString& c
onfigName) { | 225 void setDrawFilters(DrawFilterFlags const * const filters, const SkString& c
onfigName) { |
230 memcpy(fDrawFilters, filters, sizeof(fDrawFilters)); | 226 memcpy(fDrawFilters, filters, sizeof(fDrawFilters)); |
231 fDrawFiltersConfig = configName; | 227 fDrawFiltersConfig = configName; |
232 } | 228 } |
233 | 229 |
234 void setBBoxHierarchyType(BBoxHierarchyType bbhType) { | 230 void setBBoxHierarchyType(BBoxHierarchyType bbhType) { |
235 fBBoxHierarchyType = bbhType; | 231 fBBoxHierarchyType = bbhType; |
236 } | 232 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 config.append("_"); | 267 config.append("_"); |
272 config.appendS32(fGridInfo.fTileInterval.width()); | 268 config.appendS32(fGridInfo.fTileInterval.width()); |
273 config.append("x"); | 269 config.append("x"); |
274 config.appendS32(fGridInfo.fTileInterval.height()); | 270 config.appendS32(fGridInfo.fTileInterval.height()); |
275 } | 271 } |
276 #if SK_SUPPORT_GPU | 272 #if SK_SUPPORT_GPU |
277 switch (fDeviceType) { | 273 switch (fDeviceType) { |
278 case kGPU_DeviceType: | 274 case kGPU_DeviceType: |
279 if (fSampleCount) { | 275 if (fSampleCount) { |
280 config.appendf("_msaa%d", fSampleCount); | 276 config.appendf("_msaa%d", fSampleCount); |
281 } else if (fUseDFText) { | |
282 config.append("_gpudft"); | |
283 } else { | 277 } else { |
284 config.append("_gpu"); | 278 config.append("_gpu"); |
285 } | 279 } |
286 break; | 280 break; |
287 case kNVPR_DeviceType: | 281 case kNVPR_DeviceType: |
288 config.appendf("_nvprmsaa%d", fSampleCount); | 282 config.appendf("_nvprmsaa%d", fSampleCount); |
289 break; | 283 break; |
290 #if SK_ANGLE | 284 #if SK_ANGLE |
291 case kAngle_DeviceType: | 285 case kAngle_DeviceType: |
292 config.append("_angle"); | 286 config.append("_angle"); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 result["bbh"] = tmp.c_str(); | 318 result["bbh"] = tmp.c_str(); |
325 } | 319 } |
326 #if SK_SUPPORT_GPU | 320 #if SK_SUPPORT_GPU |
327 SkString tmp; | 321 SkString tmp; |
328 switch (fDeviceType) { | 322 switch (fDeviceType) { |
329 case kGPU_DeviceType: | 323 case kGPU_DeviceType: |
330 if (0 != fSampleCount) { | 324 if (0 != fSampleCount) { |
331 tmp = "msaa"; | 325 tmp = "msaa"; |
332 tmp.appendS32(fSampleCount); | 326 tmp.appendS32(fSampleCount); |
333 result["config"] = tmp.c_str(); | 327 result["config"] = tmp.c_str(); |
334 } else if (fUseDFText) { | |
335 result["config"] = "gpudft"; | |
336 } else { | 328 } else { |
337 result["config"] = "gpu"; | 329 result["config"] = "gpu"; |
338 } | 330 } |
339 break; | 331 break; |
340 case kNVPR_DeviceType: | 332 case kNVPR_DeviceType: |
341 tmp = "nvprmsaa"; | 333 tmp = "nvprmsaa"; |
342 tmp.appendS32(fSampleCount); | 334 tmp.appendS32(fSampleCount); |
343 result["config"] = tmp.c_str(); | 335 result["config"] = tmp.c_str(); |
344 break; | 336 break; |
345 #if SK_ANGLE | 337 #if SK_ANGLE |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 #endif | 421 #endif |
430 : fJsonSummaryPtr(NULL) | 422 : fJsonSummaryPtr(NULL) |
431 , fDeviceType(kBitmap_DeviceType) | 423 , fDeviceType(kBitmap_DeviceType) |
432 , fEnableWrites(false) | 424 , fEnableWrites(false) |
433 , fBBoxHierarchyType(kNone_BBoxHierarchyType) | 425 , fBBoxHierarchyType(kNone_BBoxHierarchyType) |
434 , fScaleFactor(SK_Scalar1) | 426 , fScaleFactor(SK_Scalar1) |
435 #if SK_SUPPORT_GPU | 427 #if SK_SUPPORT_GPU |
436 , fGrContextFactory(opts) | 428 , fGrContextFactory(opts) |
437 , fGrContext(NULL) | 429 , fGrContext(NULL) |
438 , fSampleCount(0) | 430 , fSampleCount(0) |
439 , fUseDFText(false) | |
440 #endif | 431 #endif |
441 { | 432 { |
442 fGridInfo.fMargin.setEmpty(); | 433 fGridInfo.fMargin.setEmpty(); |
443 fGridInfo.fOffset.setZero(); | 434 fGridInfo.fOffset.setZero(); |
444 fGridInfo.fTileInterval.set(1, 1); | 435 fGridInfo.fTileInterval.set(1, 1); |
445 sk_bzero(fDrawFilters, sizeof(fDrawFilters)); | 436 sk_bzero(fDrawFilters, sizeof(fDrawFilters)); |
446 fViewport.set(0, 0); | 437 fViewport.set(0, 0); |
447 } | 438 } |
448 | 439 |
449 #if SK_SUPPORT_GPU | 440 #if SK_SUPPORT_GPU |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 */ | 488 */ |
498 static void CopyString(SkString* dest, const SkString* src); | 489 static void CopyString(SkString* dest, const SkString* src); |
499 | 490 |
500 private: | 491 private: |
501 SkISize fViewport; | 492 SkISize fViewport; |
502 SkScalar fScaleFactor; | 493 SkScalar fScaleFactor; |
503 #if SK_SUPPORT_GPU | 494 #if SK_SUPPORT_GPU |
504 GrContextFactory fGrContextFactory; | 495 GrContextFactory fGrContextFactory; |
505 GrContext* fGrContext; | 496 GrContext* fGrContext; |
506 int fSampleCount; | 497 int fSampleCount; |
507 bool fUseDFText; | |
508 #endif | 498 #endif |
509 | 499 |
510 virtual SkString getConfigNameInternal() = 0; | 500 virtual SkString getConfigNameInternal() = 0; |
511 | 501 |
512 typedef SkRefCnt INHERITED; | 502 typedef SkRefCnt INHERITED; |
513 }; | 503 }; |
514 | 504 |
515 /** | 505 /** |
516 * This class does not do any rendering, but its render function executes record
ing, which we want | 506 * This class does not do any rendering, but its render function executes record
ing, which we want |
517 * to time. | 507 * to time. |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 | 721 |
732 #if SK_SUPPORT_GPU | 722 #if SK_SUPPORT_GPU |
733 extern PictureRenderer* CreateGatherPixelRefsRenderer(const GrContext::Options&
opts); | 723 extern PictureRenderer* CreateGatherPixelRefsRenderer(const GrContext::Options&
opts); |
734 #else | 724 #else |
735 extern PictureRenderer* CreateGatherPixelRefsRenderer(); | 725 extern PictureRenderer* CreateGatherPixelRefsRenderer(); |
736 #endif | 726 #endif |
737 | 727 |
738 } | 728 } |
739 | 729 |
740 #endif // PictureRenderer_DEFINED | 730 #endif // PictureRenderer_DEFINED |
OLD | NEW |