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" |
24 #include "SkTypes.h" | 25 #include "SkTypes.h" |
25 | 26 |
26 #if SK_SUPPORT_GPU | 27 #if SK_SUPPORT_GPU |
27 #include "GrContextFactory.h" | 28 #include "GrContextFactory.h" |
28 #include "GrContext.h" | 29 #include "GrContext.h" |
29 #endif | 30 #endif |
30 | 31 |
31 #include "image_expectations.h" | |
32 | |
33 class SkBitmap; | 32 class SkBitmap; |
34 class SkCanvas; | 33 class SkCanvas; |
35 class SkGLContextHelper; | 34 class SkGLContextHelper; |
36 class SkThread; | 35 class SkThread; |
37 | 36 |
38 namespace sk_tools { | 37 namespace sk_tools { |
39 | 38 |
40 class TiledPictureRenderer; | 39 class TiledPictureRenderer; |
41 | 40 |
| 41 /** |
| 42 * Class for collecting image results (checksums) as we go. |
| 43 */ |
| 44 class ImageResultsSummary { |
| 45 public: |
| 46 /** |
| 47 * Adds this image to the summary of results. |
| 48 * |
| 49 * @param sourceName name of the source file that generated this result |
| 50 * @param fileName relative path to the image output file on local disk |
| 51 * @param hash hash to store |
| 52 * @param tileNumber if not NULL, ptr to tile number |
| 53 */ |
| 54 void add(const char *sourceName, const char *fileName, uint64_t hash, |
| 55 const int *tileNumber=NULL); |
| 56 |
| 57 /** |
| 58 * Adds this image to the summary of results. |
| 59 * |
| 60 * @param sourceName name of the source file that generated this result |
| 61 * @param fileName relative path to the image output file on local disk |
| 62 * @param bitmap bitmap to store the hash of |
| 63 * @param tileNumber if not NULL, ptr to tile number |
| 64 */ |
| 65 void add(const char *sourceName, const char *fileName, const SkBitmap& bitma
p, |
| 66 const int *tileNumber=NULL); |
| 67 |
| 68 /** |
| 69 * Writes the summary (as constructed so far) to a file. |
| 70 * |
| 71 * @param filename path to write the summary to |
| 72 */ |
| 73 void writeToFile(const char *filename); |
| 74 |
| 75 private: |
| 76 Json::Value fActualResults; |
| 77 }; |
| 78 |
42 class PictureRenderer : public SkRefCnt { | 79 class PictureRenderer : public SkRefCnt { |
43 | 80 |
44 public: | 81 public: |
45 enum SkDeviceTypes { | 82 enum SkDeviceTypes { |
46 #if SK_ANGLE | 83 #if SK_ANGLE |
47 kAngle_DeviceType, | 84 kAngle_DeviceType, |
48 #endif | 85 #endif |
49 #if SK_MESA | 86 #if SK_MESA |
50 kMesa_DeviceType, | 87 kMesa_DeviceType, |
51 #endif | 88 #endif |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 | 670 |
634 typedef PictureRenderer INHERITED; | 671 typedef PictureRenderer INHERITED; |
635 }; | 672 }; |
636 | 673 |
637 extern PictureRenderer* CreateGatherPixelRefsRenderer(); | 674 extern PictureRenderer* CreateGatherPixelRefsRenderer(); |
638 extern PictureRenderer* CreatePictureCloneRenderer(); | 675 extern PictureRenderer* CreatePictureCloneRenderer(); |
639 | 676 |
640 } | 677 } |
641 | 678 |
642 #endif // PictureRenderer_DEFINED | 679 #endif // PictureRenderer_DEFINED |
OLD | NEW |