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 | 15 |
15 namespace cc { | 16 namespace cc { |
16 | 17 |
17 class ImageDecodeCache; | 18 class ImageDecodeCache; |
18 | 19 |
19 class CC_EXPORT ImageHijackCanvas : public SkNWayCanvas { | 20 class CC_EXPORT ImageHijackCanvas : public SkNWayCanvas { |
20 public: | 21 public: |
21 ImageHijackCanvas(int width, | 22 ImageHijackCanvas(int width, |
22 int height, | 23 int height, |
23 ImageDecodeCache* image_decode_cache, | 24 ImageDecodeCache* image_decode_cache, |
24 const ImageIdFlatSet* images_to_skip); | 25 const ImageIdFlatSet* images_to_skip, |
| 26 const gfx::ColorSpace& target_color_space); |
25 | 27 |
26 private: | 28 private: |
27 // Ensure that pictures are unpacked by this canvas, instead of being | 29 // Ensure that pictures are unpacked by this canvas, instead of being |
28 // forwarded to the raster canvas. | 30 // forwarded to the raster canvas. |
29 void onDrawPicture(const SkPicture* picture, | 31 void onDrawPicture(const SkPicture* picture, |
30 const SkMatrix* matrix, | 32 const SkMatrix* matrix, |
31 const SkPaint* paint) override; | 33 const SkPaint* paint) override; |
32 void onDrawImage(const SkImage* image, | 34 void onDrawImage(const SkImage* image, |
33 SkScalar x, | 35 SkScalar x, |
34 SkScalar y, | 36 SkScalar y, |
(...skipping 15 matching lines...) Expand all Loading... |
50 void onDrawImageNine(const SkImage* image, | 52 void onDrawImageNine(const SkImage* image, |
51 const SkIRect& center, | 53 const SkIRect& center, |
52 const SkRect& dst, | 54 const SkRect& dst, |
53 const SkPaint* paint) override; | 55 const SkPaint* paint) override; |
54 | 56 |
55 bool ShouldSkipImage(const SkImage* image) const; | 57 bool ShouldSkipImage(const SkImage* image) const; |
56 bool ShouldSkipImageInPaint(const SkPaint& paint) const; | 58 bool ShouldSkipImageInPaint(const SkPaint& paint) const; |
57 | 59 |
58 ImageDecodeCache* image_decode_cache_; | 60 ImageDecodeCache* image_decode_cache_; |
59 const ImageIdFlatSet* images_to_skip_; | 61 const ImageIdFlatSet* images_to_skip_; |
| 62 const gfx::ColorSpace target_color_space_; |
60 | 63 |
61 DISALLOW_COPY_AND_ASSIGN(ImageHijackCanvas); | 64 DISALLOW_COPY_AND_ASSIGN(ImageHijackCanvas); |
62 }; | 65 }; |
63 | 66 |
64 } // namespace cc | 67 } // namespace cc |
65 | 68 |
66 #endif // CC_RASTER_IMAGE_HIJACK_CANVAS_H_ | 69 #endif // CC_RASTER_IMAGE_HIJACK_CANVAS_H_ |
OLD | NEW |