| 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 "third_party/skia/include/core/SkFilterQuality.h" | 9 #include "third_party/skia/include/core/SkFilterQuality.h" |
| 9 #include "third_party/skia/include/core/SkImage.h" | 10 #include "third_party/skia/include/core/SkImage.h" |
| 10 #include "third_party/skia/include/core/SkMatrix.h" | 11 #include "third_party/skia/include/core/SkMatrix.h" |
| 11 | 12 |
| 12 namespace cc { | 13 namespace cc { |
| 13 | 14 |
| 14 class DrawImage { | 15 // TODO(vmpstr): This should probably be DISALLOW_COPY_AND_ASSIGN and transport |
| 16 // it around using a pointer, since it became kind of large. Profile. |
| 17 class CC_EXPORT DrawImage { |
| 15 public: | 18 public: |
| 16 DrawImage() : image_(nullptr), filter_quality_(kNone_SkFilterQuality) {} | 19 DrawImage(); |
| 17 DrawImage(const SkImage* image, | 20 DrawImage(const SkImage* image, |
| 21 const SkIRect& src_rect, |
| 18 const SkSize& scale, | 22 const SkSize& scale, |
| 19 SkFilterQuality filter_quality) | 23 SkFilterQuality filter_quality, |
| 20 : image_(image), scale_(scale), filter_quality_(filter_quality) {} | 24 bool matrix_has_perspective, |
| 25 bool matrix_is_decomposable); |
| 26 DrawImage(const DrawImage& other); |
| 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_; } |
| 30 const SkIRect src_rect() const { return src_rect_; } |
| 24 SkFilterQuality filter_quality() const { return filter_quality_; } | 31 SkFilterQuality filter_quality() const { return filter_quality_; } |
| 32 bool matrix_has_perspective() const { return matrix_has_perspective_; } |
| 33 bool matrix_is_decomposable() const { return matrix_is_decomposable_; } |
| 25 | 34 |
| 26 DrawImage ApplyScale(float scale) const { | 35 DrawImage ApplyScale(float scale) const { |
| 27 return DrawImage( | 36 return DrawImage( |
| 28 image_, SkSize::Make(scale_.width() * scale, scale_.height() * scale), | 37 image_, src_rect_, |
| 29 filter_quality_); | 38 SkSize::Make(scale_.width() * scale, scale_.height() * scale), |
| 39 filter_quality_, matrix_has_perspective_, matrix_is_decomposable_); |
| 30 } | 40 } |
| 31 | 41 |
| 32 private: | 42 private: |
| 33 const SkImage* image_; | 43 const SkImage* image_; |
| 44 SkIRect src_rect_; |
| 34 SkSize scale_; | 45 SkSize scale_; |
| 35 SkFilterQuality filter_quality_; | 46 SkFilterQuality filter_quality_; |
| 47 bool matrix_has_perspective_; |
| 48 bool matrix_is_decomposable_; |
| 36 }; | 49 }; |
| 37 | 50 |
| 38 } // namespace cc | 51 } // namespace cc |
| 39 | 52 |
| 40 #endif // CC_PLAYBACK_DRAW_IMAGE_H_ | 53 #endif // CC_PLAYBACK_DRAW_IMAGE_H_ |
| OLD | NEW |