OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_PLAYBACK_IMAGE_HIJACK_CANVAS_H_ | 5 #ifndef CC_PLAYBACK_IMAGE_HIJACK_CANVAS_H_ |
6 #define CC_PLAYBACK_IMAGE_HIJACK_CANVAS_H_ | 6 #define CC_PLAYBACK_IMAGE_HIJACK_CANVAS_H_ |
7 | 7 |
| 8 #include <unordered_set> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "cc/base/cc_export.h" | 11 #include "cc/base/cc_export.h" |
| 12 #include "cc/playback/image_id.h" |
10 #include "third_party/skia/include/utils/SkNWayCanvas.h" | 13 #include "third_party/skia/include/utils/SkNWayCanvas.h" |
11 | 14 |
12 namespace cc { | 15 namespace cc { |
13 | 16 |
14 class ImageDecodeCache; | 17 class ImageDecodeCache; |
15 | 18 |
16 class CC_EXPORT ImageHijackCanvas : public SkNWayCanvas { | 19 class CC_EXPORT ImageHijackCanvas : public SkNWayCanvas { |
17 public: | 20 public: |
18 ImageHijackCanvas(int width, | 21 ImageHijackCanvas(int width, |
19 int height, | 22 int height, |
20 ImageDecodeCache* image_decode_cache); | 23 ImageDecodeCache* image_decode_cache, |
| 24 const ImageIdFlatSet* images_to_skip); |
21 | 25 |
22 private: | 26 private: |
23 // Ensure that pictures are unpacked by this canvas, instead of being | 27 // Ensure that pictures are unpacked by this canvas, instead of being |
24 // forwarded to the raster canvas. | 28 // forwarded to the raster canvas. |
25 void onDrawPicture(const SkPicture* picture, | 29 void onDrawPicture(const SkPicture* picture, |
26 const SkMatrix* matrix, | 30 const SkMatrix* matrix, |
27 const SkPaint* paint) override; | 31 const SkPaint* paint) override; |
28 void onDrawImage(const SkImage* image, | 32 void onDrawImage(const SkImage* image, |
29 SkScalar x, | 33 SkScalar x, |
30 SkScalar y, | 34 SkScalar y, |
(...skipping 10 matching lines...) Expand all Loading... |
41 SkScalar start_angle, | 45 SkScalar start_angle, |
42 SkScalar sweep_angle, | 46 SkScalar sweep_angle, |
43 bool use_center, | 47 bool use_center, |
44 const SkPaint& paint) override; | 48 const SkPaint& paint) override; |
45 void onDrawRRect(const SkRRect& rr, const SkPaint& paint) override; | 49 void onDrawRRect(const SkRRect& rr, const SkPaint& paint) override; |
46 void onDrawImageNine(const SkImage* image, | 50 void onDrawImageNine(const SkImage* image, |
47 const SkIRect& center, | 51 const SkIRect& center, |
48 const SkRect& dst, | 52 const SkRect& dst, |
49 const SkPaint* paint) override; | 53 const SkPaint* paint) override; |
50 | 54 |
| 55 bool ShouldSkipImage(const SkImage* image) const; |
| 56 bool ShouldSkipImageInPaint(const SkPaint& paint) const; |
| 57 |
51 ImageDecodeCache* image_decode_cache_; | 58 ImageDecodeCache* image_decode_cache_; |
| 59 const ImageIdFlatSet* images_to_skip_; |
52 | 60 |
53 DISALLOW_COPY_AND_ASSIGN(ImageHijackCanvas); | 61 DISALLOW_COPY_AND_ASSIGN(ImageHijackCanvas); |
54 }; | 62 }; |
55 | 63 |
56 } // namespace cc | 64 } // namespace cc |
57 | 65 |
58 #endif // CC_PLAYBACK_IMAGE_HIJACK_CANVAS_H_ | 66 #endif // CC_PLAYBACK_IMAGE_HIJACK_CANVAS_H_ |
OLD | NEW |