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: | |
robertphillips
2014/06/26 16:17:32
Seems fine to me
kelvinly
2014/06/26 17:18:09
Hmm, it's been so long I can't remember what I tho
| |
338 // ??? This is appropriate behavior? | |
339 result["config"] = "angle"; | |
340 break; | |
341 #endif | |
342 #if SK_MESA | |
343 case kMesa_DeviceType: | |
344 result["config"] = "mesa"; | |
345 break; | |
346 #endif | |
347 default: | |
348 // Assume that no extra info means bitmap. | |
349 break; | |
350 } | |
351 #endif | |
352 // results["dunno"] = fDrawFiltersConfig.c_str(); | |
353 return result; | |
354 } | |
355 | |
299 #if SK_SUPPORT_GPU | 356 #if SK_SUPPORT_GPU |
300 bool isUsingGpuDevice() { | 357 bool isUsingGpuDevice() { |
301 switch (fDeviceType) { | 358 switch (fDeviceType) { |
302 case kGPU_DeviceType: | 359 case kGPU_DeviceType: |
303 case kNVPR_DeviceType: | 360 case kNVPR_DeviceType: |
304 // fall through | 361 // fall through |
305 #if SK_ANGLE | 362 #if SK_ANGLE |
306 case kAngle_DeviceType: | 363 case kAngle_DeviceType: |
307 // fall through | 364 // fall through |
308 #endif | 365 #endif |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
652 | 709 |
653 typedef PictureRenderer INHERITED; | 710 typedef PictureRenderer INHERITED; |
654 }; | 711 }; |
655 | 712 |
656 extern PictureRenderer* CreateGatherPixelRefsRenderer(); | 713 extern PictureRenderer* CreateGatherPixelRefsRenderer(); |
657 extern PictureRenderer* CreatePictureCloneRenderer(); | 714 extern PictureRenderer* CreatePictureCloneRenderer(); |
658 | 715 |
659 } | 716 } |
660 | 717 |
661 #endif // PictureRenderer_DEFINED | 718 #endif // PictureRenderer_DEFINED |
OLD | NEW |