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 { | |
41 SkMatrix scaled_matrix = matrix_; | 37 SkMatrix scaled_matrix = matrix_; |
42 scaled_matrix.postScale(scale.width(), scale.height()); | 38 scaled_matrix.postScale(scale, scale); |
43 return DrawImage(image_, src_rect_, filter_quality_, scaled_matrix); | 39 return DrawImage(image_, src_rect_, filter_quality_, scaled_matrix); |
44 } | 40 } |
45 | 41 |
46 private: | 42 private: |
47 sk_sp<const SkImage> image_; | 43 sk_sp<const SkImage> image_; |
48 SkIRect src_rect_; | 44 SkIRect src_rect_; |
49 SkFilterQuality filter_quality_; | 45 SkFilterQuality filter_quality_; |
50 SkMatrix matrix_; | 46 SkMatrix matrix_; |
51 SkSize scale_; | 47 SkSize scale_; |
52 bool matrix_is_decomposable_; | 48 bool matrix_is_decomposable_; |
53 }; | 49 }; |
54 | 50 |
55 } // namespace cc | 51 } // namespace cc |
56 | 52 |
57 #endif // CC_PLAYBACK_DRAW_IMAGE_H_ | 53 #endif // CC_PLAYBACK_DRAW_IMAGE_H_ |
OLD | NEW |