OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_DRAW_IMAGE_H_ | 5 #ifndef CC_PLAYBACK_DRAW_IMAGE_H_ |
6 #define CC_PLAYBACK_DRAW_IMAGE_H_ | 6 #define CC_PLAYBACK_DRAW_IMAGE_H_ |
7 | 7 |
8 #include "third_party/skia/include/core/SkFilterQuality.h" | 8 #include "third_party/skia/include/core/SkFilterQuality.h" |
9 #include "third_party/skia/include/core/SkImage.h" | 9 #include "third_party/skia/include/core/SkImage.h" |
10 #include "third_party/skia/include/core/SkMatrix.h" | 10 #include "third_party/skia/include/core/SkMatrix.h" |
11 | 11 |
12 namespace cc { | 12 namespace cc { |
13 | 13 |
14 class DrawImage { | 14 class DrawImage { |
15 public: | 15 public: |
16 DrawImage() : image_(nullptr), filter_quality_(kNone_SkFilterQuality) {} | 16 DrawImage() : image_(nullptr), filter_quality_(kNone_SkFilterQuality) {} |
17 DrawImage(const SkImage* image, | 17 DrawImage(const SkImage* image, |
18 const SkSize& scale, | 18 const SkSize& scale, |
19 SkFilterQuality filter_quality) | 19 SkFilterQuality filter_quality, |
20 : image_(image), scale_(scale), filter_quality_(filter_quality) {} | 20 bool matrix_has_perspective, |
| 21 bool matrix_is_decomposable) |
| 22 : image_(image), |
| 23 scale_(scale), |
| 24 filter_quality_(filter_quality), |
| 25 matrix_has_perspective_(matrix_has_perspective), |
| 26 matrix_is_decomposable_(matrix_is_decomposable) {} |
21 | 27 |
22 const SkImage* image() const { return image_; } | 28 const SkImage* image() const { return image_; } |
23 const SkSize& scale() const { return scale_; } | 29 const SkSize& scale() const { return scale_; } |
24 SkFilterQuality filter_quality() const { return filter_quality_; } | 30 SkFilterQuality filter_quality() const { return filter_quality_; } |
| 31 bool matrix_has_perspective() const { return matrix_has_perspective_; } |
| 32 bool matrix_is_decomposable() const { return matrix_is_decomposable_; } |
25 | 33 |
26 DrawImage ApplyScale(float scale) const { | 34 DrawImage ApplyScale(float scale) const { |
27 return DrawImage( | 35 return DrawImage( |
28 image_, SkSize::Make(scale_.width() * scale, scale_.height() * scale), | 36 image_, SkSize::Make(scale_.width() * scale, scale_.height() * scale), |
29 filter_quality_); | 37 filter_quality_, matrix_has_perspective_, matrix_is_decomposable_); |
30 } | 38 } |
31 | 39 |
32 private: | 40 private: |
33 const SkImage* image_; | 41 const SkImage* image_; |
34 SkSize scale_; | 42 SkSize scale_; |
35 SkFilterQuality filter_quality_; | 43 SkFilterQuality filter_quality_; |
| 44 bool matrix_has_perspective_; |
| 45 bool matrix_is_decomposable_; |
36 }; | 46 }; |
37 | 47 |
38 } // namespace cc | 48 } // namespace cc |
39 | 49 |
40 #endif // CC_PLAYBACK_DRAW_IMAGE_H_ | 50 #endif // CC_PLAYBACK_DRAW_IMAGE_H_ |
OLD | NEW |