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 "cc/base/cc_export.h" | 8 #include "cc/base/cc_export.h" |
9 #include "third_party/skia/include/core/SkFilterQuality.h" | 9 #include "third_party/skia/include/core/SkFilterQuality.h" |
10 #include "third_party/skia/include/core/SkImage.h" | 10 #include "third_party/skia/include/core/SkImage.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 ~DrawImage(); | 27 ~DrawImage(); |
28 | 28 |
29 const sk_sp<const SkImage>& image() const { return image_; } | 29 const sk_sp<const SkImage>& image() const { return image_; } |
30 const SkSize& scale() const { return scale_; } | 30 const SkSize& scale() const { return scale_; } |
31 const SkIRect src_rect() const { return src_rect_; } | 31 const SkIRect src_rect() const { return src_rect_; } |
32 SkFilterQuality filter_quality() const { return filter_quality_; } | 32 SkFilterQuality filter_quality() const { return filter_quality_; } |
33 bool matrix_is_decomposable() const { return matrix_is_decomposable_; } | 33 bool matrix_is_decomposable() const { return matrix_is_decomposable_; } |
34 const SkMatrix& matrix() const { return matrix_; } | 34 const SkMatrix& matrix() const { return matrix_; } |
35 | 35 |
36 DrawImage ApplyScale(float scale) const { | 36 DrawImage ApplyScale(float scale) const { |
| 37 return ApplyScale(SkSize::Make(scale, scale)); |
| 38 } |
| 39 |
| 40 DrawImage ApplyScale(const SkSize& scale) const { |
37 SkMatrix scaled_matrix = matrix_; | 41 SkMatrix scaled_matrix = matrix_; |
38 scaled_matrix.postScale(scale, scale); | 42 scaled_matrix.postScale(scale.width(), scale.height()); |
39 return DrawImage(image_, src_rect_, filter_quality_, scaled_matrix); | 43 return DrawImage(image_, src_rect_, filter_quality_, scaled_matrix); |
40 } | 44 } |
41 | 45 |
42 private: | 46 private: |
43 sk_sp<const SkImage> image_; | 47 sk_sp<const SkImage> image_; |
44 SkIRect src_rect_; | 48 SkIRect src_rect_; |
45 SkFilterQuality filter_quality_; | 49 SkFilterQuality filter_quality_; |
46 SkMatrix matrix_; | 50 SkMatrix matrix_; |
47 SkSize scale_; | 51 SkSize scale_; |
48 bool matrix_is_decomposable_; | 52 bool matrix_is_decomposable_; |
49 }; | 53 }; |
50 | 54 |
51 } // namespace cc | 55 } // namespace cc |
52 | 56 |
53 #endif // CC_PLAYBACK_DRAW_IMAGE_H_ | 57 #endif // CC_PLAYBACK_DRAW_IMAGE_H_ |
OLD | NEW |