Chromium Code Reviews| 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 |
| 11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
| 12 #include "SkCountdown.h" | 12 #include "SkCountdown.h" |
| 13 #include "SkDrawFilter.h" | 13 #include "SkDrawFilter.h" |
| 14 #include "SkJSONCPP.h" | |
| 14 #include "SkMath.h" | 15 #include "SkMath.h" |
| 15 #include "SkPaint.h" | 16 #include "SkPaint.h" |
| 16 #include "SkPicture.h" | 17 #include "SkPicture.h" |
| 17 #include "SkPictureRecorder.h" | 18 #include "SkPictureRecorder.h" |
| 18 #include "SkRect.h" | 19 #include "SkRect.h" |
| 19 #include "SkRefCnt.h" | 20 #include "SkRefCnt.h" |
| 20 #include "SkRunnable.h" | 21 #include "SkRunnable.h" |
| 21 #include "SkString.h" | 22 #include "SkString.h" |
| 22 #include "SkTDArray.h" | 23 #include "SkTDArray.h" |
| 23 #include "SkThreadPool.h" | 24 #include "SkThreadPool.h" |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 289 #endif | 290 #endif |
| 290 default: | 291 default: |
| 291 // Assume that no extra info means bitmap. | 292 // Assume that no extra info means bitmap. |
| 292 break; | 293 break; |
| 293 } | 294 } |
| 294 #endif | 295 #endif |
| 295 config.append(fDrawFiltersConfig.c_str()); | 296 config.append(fDrawFiltersConfig.c_str()); |
| 296 return config; | 297 return config; |
| 297 } | 298 } |
| 298 | 299 |
| 300 Json::Value getJSONConfig() { | |
| 301 Json::Value result; | |
| 302 | |
| 303 result["mode"] = this->getConfigNameInternal().c_str(); | |
| 304 result["scale"] = 1.0f; | |
| 305 if (SK_Scalar1 != fScaleFactor) { | |
| 306 result["scale"] = SkScalarToFloat(fScaleFactor); | |
| 307 } | |
| 308 if (kRTree_BBoxHierarchyType == fBBoxHierarchyType) { | |
| 309 result["bbh"] = "rtree"; | |
| 310 } else if (kQuadTree_BBoxHierarchyType == fBBoxHierarchyType) { | |
| 311 result["bbh"] = "quadtree"; | |
| 312 } else if (kTileGrid_BBoxHierarchyType == fBBoxHierarchyType) { | |
| 313 SkString tmp("grid_"); | |
| 314 tmp.appendS32(fGridInfo.fTileInterval.width()); | |
| 315 tmp.append("x"); | |
| 316 tmp.appendS32(fGridInfo.fTileInterval.height()); | |
| 317 result["bbh"] = tmp.c_str(); | |
| 318 } | |
| 319 #if SK_SUPPORT_GPU | |
| 320 SkString tmp; | |
| 321 switch (fDeviceType) { | |
| 322 case kGPU_DeviceType: | |
| 323 if (0 != fSampleCount) { | |
| 324 tmp = "msaa"; | |
| 325 tmp.appendS32(fSampleCount); | |
| 326 result["config"] = tmp.c_str(); | |
| 327 } else { | |
| 328 result["config"] = "gpu"; | |
| 329 } | |
| 330 break; | |
| 331 case kNVPR_DeviceType: | |
| 332 tmp = "nvprmsaa"; | |
| 333 tmp.appendS32(fSampleCount); | |
| 334 result["config"] = tmp.c_str(); | |
| 335 break; | |
| 336 #if SK_ANGLE | |
| 337 case kAngle_DeviceType: | |
| 338 result["config"] = "angle"; | |
| 339 break; | |
| 340 #endif | |
| 341 #if SK_MESA | |
| 342 case kMesa_DeviceType: | |
| 343 result["config"] = "mesa"; | |
| 344 break; | |
| 345 #endif | |
| 346 default: | |
| 347 // Assume that no extra info means bitmap. | |
| 348 break; | |
| 349 } | |
| 350 #endif | |
| 351 // results["dunno"] = fDrawFiltersConfig.c_str(); | |
|
benchen
2014/06/26 17:39:51
This needs to be removed?
kelvinly
2014/06/26 17:58:48
Done.
| |
| 352 return result; | |
| 353 } | |
| 354 | |
| 299 #if SK_SUPPORT_GPU | 355 #if SK_SUPPORT_GPU |
| 300 bool isUsingGpuDevice() { | 356 bool isUsingGpuDevice() { |
| 301 switch (fDeviceType) { | 357 switch (fDeviceType) { |
| 302 case kGPU_DeviceType: | 358 case kGPU_DeviceType: |
| 303 case kNVPR_DeviceType: | 359 case kNVPR_DeviceType: |
| 304 // fall through | 360 // fall through |
| 305 #if SK_ANGLE | 361 #if SK_ANGLE |
| 306 case kAngle_DeviceType: | 362 case kAngle_DeviceType: |
| 307 // fall through | 363 // fall through |
| 308 #endif | 364 #endif |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 652 | 708 |
| 653 typedef PictureRenderer INHERITED; | 709 typedef PictureRenderer INHERITED; |
| 654 }; | 710 }; |
| 655 | 711 |
| 656 extern PictureRenderer* CreateGatherPixelRefsRenderer(); | 712 extern PictureRenderer* CreateGatherPixelRefsRenderer(); |
| 657 extern PictureRenderer* CreatePictureCloneRenderer(); | 713 extern PictureRenderer* CreatePictureCloneRenderer(); |
| 658 | 714 |
| 659 } | 715 } |
| 660 | 716 |
| 661 #endif // PictureRenderer_DEFINED | 717 #endif // PictureRenderer_DEFINED |
| OLD | NEW |