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_RASTER_IMAGE_HIJACK_CANVAS_H_ | 5 #ifndef CC_RASTER_IMAGE_HIJACK_CANVAS_H_ |
6 #define CC_RASTER_IMAGE_HIJACK_CANVAS_H_ | 6 #define CC_RASTER_IMAGE_HIJACK_CANVAS_H_ |
7 | 7 |
8 #include <unordered_set> | 8 #include <unordered_set> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "cc/cc_export.h" | 11 #include "cc/cc_export.h" |
12 #include "cc/paint/image_id.h" | 12 #include "cc/paint/image_id.h" |
13 #include "third_party/skia/include/utils/SkNWayCanvas.h" | 13 #include "third_party/skia/include/utils/SkNWayCanvas.h" |
14 #include "ui/gfx/color_space.h" | 14 #include "ui/gfx/color_space.h" |
15 | 15 |
16 namespace cc { | 16 namespace cc { |
17 | 17 |
18 class ImageDecodeCache; | 18 class ImageDecodeCache; |
19 | 19 |
20 class CC_EXPORT ImageHijackCanvas : public SkNWayCanvas { | 20 class CC_EXPORT ImageHijackCanvas : public SkNWayCanvas { |
21 public: | 21 public: |
22 ImageHijackCanvas(int width, | 22 ImageHijackCanvas(int width, |
23 int height, | 23 int height, |
24 ImageDecodeCache* image_decode_cache, | 24 ImageDecodeCache* image_decode_cache, |
25 const ImageIdFlatSet* images_to_skip, | 25 const SkImageIdFlatSet* images_to_skip, |
26 const gfx::ColorSpace& target_color_space); | 26 const gfx::ColorSpace& target_color_space); |
27 | 27 |
28 private: | 28 private: |
29 // Ensure that pictures are unpacked by this canvas, instead of being | 29 // Ensure that pictures are unpacked by this canvas, instead of being |
30 // forwarded to the raster canvas. | 30 // forwarded to the raster canvas. |
31 void onDrawPicture(const SkPicture* picture, | 31 void onDrawPicture(const SkPicture* picture, |
32 const SkMatrix* matrix, | 32 const SkMatrix* matrix, |
33 const SkPaint* paint) override; | 33 const SkPaint* paint) override; |
34 void onDrawImage(const SkImage* image, | 34 void onDrawImage(const SkImage* image, |
35 SkScalar x, | 35 SkScalar x, |
(...skipping 16 matching lines...) Expand all Loading... |
52 void onDrawImageNine(const SkImage* image, | 52 void onDrawImageNine(const SkImage* image, |
53 const SkIRect& center, | 53 const SkIRect& center, |
54 const SkRect& dst, | 54 const SkRect& dst, |
55 const SkPaint* paint) override; | 55 const SkPaint* paint) override; |
56 | 56 |
57 bool ShouldSkipImage(const SkImage* image) const; | 57 bool ShouldSkipImage(const SkImage* image) const; |
58 bool ShouldSkipImageInPaint(const SkPaint& paint) const; | 58 bool ShouldSkipImageInPaint(const SkPaint& paint) const; |
59 bool QuickRejectDraw(const SkRect& rect, const SkPaint* paint) const; | 59 bool QuickRejectDraw(const SkRect& rect, const SkPaint* paint) const; |
60 | 60 |
61 ImageDecodeCache* image_decode_cache_; | 61 ImageDecodeCache* image_decode_cache_; |
62 const ImageIdFlatSet* images_to_skip_; | 62 const SkImageIdFlatSet* images_to_skip_; |
63 const gfx::ColorSpace target_color_space_; | 63 const gfx::ColorSpace target_color_space_; |
64 | 64 |
65 DISALLOW_COPY_AND_ASSIGN(ImageHijackCanvas); | 65 DISALLOW_COPY_AND_ASSIGN(ImageHijackCanvas); |
66 }; | 66 }; |
67 | 67 |
68 } // namespace cc | 68 } // namespace cc |
69 | 69 |
70 #endif // CC_RASTER_IMAGE_HIJACK_CANVAS_H_ | 70 #endif // CC_RASTER_IMAGE_HIJACK_CANVAS_H_ |
OLD | NEW |