| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CC_PLAYBACK_DRAW_IMAGE_H_ | |
| 6 #define CC_PLAYBACK_DRAW_IMAGE_H_ | |
| 7 | |
| 8 #include "cc/base/cc_export.h" | |
| 9 #include "third_party/skia/include/core/SkFilterQuality.h" | |
| 10 #include "third_party/skia/include/core/SkImage.h" | |
| 11 #include "third_party/skia/include/core/SkMatrix.h" | |
| 12 #include "third_party/skia/include/core/SkRect.h" | |
| 13 #include "third_party/skia/include/core/SkRefCnt.h" | |
| 14 #include "ui/gfx/geometry/size_f.h" | |
| 15 | |
| 16 namespace cc { | |
| 17 | |
| 18 // TODO(vmpstr): This should probably be DISALLOW_COPY_AND_ASSIGN and transport | |
| 19 // it around using a pointer, since it became kind of large. Profile. | |
| 20 class CC_EXPORT DrawImage { | |
| 21 public: | |
| 22 DrawImage(); | |
| 23 DrawImage(sk_sp<const SkImage> image, | |
| 24 const SkIRect& src_rect, | |
| 25 SkFilterQuality filter_quality, | |
| 26 const SkMatrix& matrix); | |
| 27 DrawImage(const DrawImage& other); | |
| 28 ~DrawImage(); | |
| 29 | |
| 30 const sk_sp<const SkImage>& image() const { return image_; } | |
| 31 const SkSize& scale() const { return scale_; } | |
| 32 const SkIRect& src_rect() const { return src_rect_; } | |
| 33 SkFilterQuality filter_quality() const { return filter_quality_; } | |
| 34 bool matrix_is_decomposable() const { return matrix_is_decomposable_; } | |
| 35 const SkMatrix& matrix() const { return matrix_; } | |
| 36 | |
| 37 DrawImage ApplyScale(float scale) const { | |
| 38 SkMatrix scaled_matrix = matrix_; | |
| 39 scaled_matrix.preScale(scale, scale); | |
| 40 return DrawImage(image_, src_rect_, filter_quality_, scaled_matrix); | |
| 41 } | |
| 42 | |
| 43 private: | |
| 44 sk_sp<const SkImage> image_; | |
| 45 SkIRect src_rect_; | |
| 46 SkFilterQuality filter_quality_; | |
| 47 SkMatrix matrix_; | |
| 48 SkSize scale_; | |
| 49 bool matrix_is_decomposable_; | |
| 50 }; | |
| 51 | |
| 52 } // namespace cc | |
| 53 | |
| 54 #endif // CC_PLAYBACK_DRAW_IMAGE_H_ | |
| OLD | NEW |