| 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_DECODED_DRAW_IMAGE_H_ | |
| 6 #define CC_PLAYBACK_DECODED_DRAW_IMAGE_H_ | |
| 7 | |
| 8 #include <cfloat> | |
| 9 #include <cmath> | |
| 10 | |
| 11 #include "cc/base/cc_export.h" | |
| 12 #include "third_party/skia/include/core/SkFilterQuality.h" | |
| 13 #include "third_party/skia/include/core/SkImage.h" | |
| 14 #include "third_party/skia/include/core/SkRefCnt.h" | |
| 15 #include "third_party/skia/include/core/SkSize.h" | |
| 16 | |
| 17 namespace cc { | |
| 18 | |
| 19 class CC_EXPORT DecodedDrawImage { | |
| 20 public: | |
| 21 DecodedDrawImage(sk_sp<const SkImage> image, | |
| 22 const SkSize& src_rect_offset, | |
| 23 const SkSize& scale_adjustment, | |
| 24 SkFilterQuality filter_quality); | |
| 25 DecodedDrawImage(sk_sp<const SkImage> image, SkFilterQuality filter_quality); | |
| 26 DecodedDrawImage(const DecodedDrawImage& other); | |
| 27 ~DecodedDrawImage(); | |
| 28 | |
| 29 const sk_sp<const SkImage>& image() const { return image_; } | |
| 30 const SkSize& src_rect_offset() const { return src_rect_offset_; } | |
| 31 const SkSize& scale_adjustment() const { return scale_adjustment_; } | |
| 32 SkFilterQuality filter_quality() const { return filter_quality_; } | |
| 33 bool is_scale_adjustment_identity() const { | |
| 34 return std::abs(scale_adjustment_.width() - 1.f) < FLT_EPSILON && | |
| 35 std::abs(scale_adjustment_.height() - 1.f) < FLT_EPSILON; | |
| 36 } | |
| 37 | |
| 38 void set_at_raster_decode(bool at_raster_decode) { | |
| 39 at_raster_decode_ = at_raster_decode; | |
| 40 } | |
| 41 bool is_at_raster_decode() const { return at_raster_decode_; } | |
| 42 | |
| 43 private: | |
| 44 sk_sp<const SkImage> image_; | |
| 45 const SkSize src_rect_offset_; | |
| 46 const SkSize scale_adjustment_; | |
| 47 const SkFilterQuality filter_quality_; | |
| 48 bool at_raster_decode_; | |
| 49 }; | |
| 50 | |
| 51 } // namespace cc | |
| 52 | |
| 53 #endif // CC_PLAYBACK_DECODED_DRAW_IMAGE_H_ | |
| OLD | NEW |