OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CC_PLAYBACK_IMAGE_HIJACK_CANVAS_H_ | |
6 #define CC_PLAYBACK_IMAGE_HIJACK_CANVAS_H_ | |
7 | |
8 #include <unordered_set> | |
9 | |
10 #include "base/macros.h" | |
11 #include "cc/base/cc_export.h" | |
12 #include "cc/playback/image_id.h" | |
13 #include "third_party/skia/include/utils/SkNWayCanvas.h" | |
14 | |
15 namespace cc { | |
16 | |
17 class ImageDecodeCache; | |
18 | |
19 class CC_EXPORT ImageHijackCanvas : public SkNWayCanvas { | |
20 public: | |
21 ImageHijackCanvas(int width, | |
22 int height, | |
23 ImageDecodeCache* image_decode_cache, | |
24 const ImageIdFlatSet* images_to_skip); | |
25 | |
26 private: | |
27 // Ensure that pictures are unpacked by this canvas, instead of being | |
28 // forwarded to the raster canvas. | |
29 void onDrawPicture(const SkPicture* picture, | |
30 const SkMatrix* matrix, | |
31 const SkPaint* paint) override; | |
32 void onDrawImage(const SkImage* image, | |
33 SkScalar x, | |
34 SkScalar y, | |
35 const SkPaint* paint) override; | |
36 void onDrawImageRect(const SkImage* image, | |
37 const SkRect* src, | |
38 const SkRect& dst, | |
39 const SkPaint* paint, | |
40 SrcRectConstraint constraint) override; | |
41 void onDrawRect(const SkRect&, const SkPaint&) override; | |
42 void onDrawPath(const SkPath& path, const SkPaint& paint) override; | |
43 void onDrawOval(const SkRect& r, const SkPaint& paint) override; | |
44 void onDrawArc(const SkRect& r, | |
45 SkScalar start_angle, | |
46 SkScalar sweep_angle, | |
47 bool use_center, | |
48 const SkPaint& paint) override; | |
49 void onDrawRRect(const SkRRect& rr, const SkPaint& paint) override; | |
50 void onDrawImageNine(const SkImage* image, | |
51 const SkIRect& center, | |
52 const SkRect& dst, | |
53 const SkPaint* paint) override; | |
54 | |
55 bool ShouldSkipImage(const SkImage* image) const; | |
56 bool ShouldSkipImageInPaint(const SkPaint& paint) const; | |
57 | |
58 ImageDecodeCache* image_decode_cache_; | |
59 const ImageIdFlatSet* images_to_skip_; | |
60 | |
61 DISALLOW_COPY_AND_ASSIGN(ImageHijackCanvas); | |
62 }; | |
63 | |
64 } // namespace cc | |
65 | |
66 #endif // CC_PLAYBACK_IMAGE_HIJACK_CANVAS_H_ | |
OLD | NEW |