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