Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Side by Side Diff: cc/playback/draw_image.h

Issue 1418573002: cc: Add image decode control in the compositor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "third_party/skia/include/core/SkFilterQuality.h" 8 #include "third_party/skia/include/core/SkFilterQuality.h"
9 #include "third_party/skia/include/core/SkImage.h" 9 #include "third_party/skia/include/core/SkImage.h"
10 #include "third_party/skia/include/core/SkMatrix.h" 10 #include "third_party/skia/include/core/SkMatrix.h"
11 11
12 namespace cc { 12 namespace cc {
13 13
14 class DrawImage { 14 class DrawImage {
15 public: 15 public:
16 DrawImage() : image_(nullptr), filter_quality_(kNone_SkFilterQuality) {} 16 DrawImage() : image_(nullptr), filter_quality_(kNone_SkFilterQuality) {}
17 DrawImage(const SkImage* image, 17 DrawImage(const SkImage* image,
18 const SkSize& scale, 18 const SkSize& scale,
19 SkFilterQuality filter_quality) 19 SkFilterQuality filter_quality,
20 : image_(image), scale_(scale), filter_quality_(filter_quality) {} 20 bool matrix_has_perspective,
21 bool matrix_is_decomposable)
22 : image_(image),
23 scale_(scale),
24 filter_quality_(filter_quality),
25 matrix_has_perspective_(matrix_has_perspective),
26 matrix_is_decomposable_(matrix_is_decomposable) {}
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_; }
24 SkFilterQuality filter_quality() const { return filter_quality_; } 30 SkFilterQuality filter_quality() const { return filter_quality_; }
31 bool matrix_has_perspective() const { return matrix_has_perspective_; }
32 bool matrix_is_decomposable() const { return matrix_is_decomposable_; }
25 33
26 DrawImage ApplyScale(float scale) const { 34 DrawImage ApplyScale(float scale) const {
27 return DrawImage( 35 return DrawImage(
28 image_, SkSize::Make(scale_.width() * scale, scale_.height() * scale), 36 image_, SkSize::Make(scale_.width() * scale, scale_.height() * scale),
29 filter_quality_); 37 filter_quality_, matrix_has_perspective_, matrix_is_decomposable_);
30 } 38 }
31 39
32 private: 40 private:
33 const SkImage* image_; 41 const SkImage* image_;
34 SkSize scale_; 42 SkSize scale_;
35 SkFilterQuality filter_quality_; 43 SkFilterQuality filter_quality_;
44 bool matrix_has_perspective_;
45 bool matrix_is_decomposable_;
46 };
47
48 class DecodedDrawImage {
enne (OOO) 2015/12/02 23:33:25 Different classes, different files?
vmpstr 2015/12/03 21:20:23 Done.
49 public:
50 DecodedDrawImage(const SkImage* image,
51 const SkSize& scale_adjustment,
52 SkFilterQuality filter_quality)
53 : image_(image),
54 scale_adjustment_(scale_adjustment),
55 filter_quality_(filter_quality),
56 at_raster_decode_(false) {}
57
58 const SkImage* image() const { return image_; }
59 const SkSize& scale_adjustment() const { return scale_adjustment_; }
60 SkFilterQuality filter_quality() const { return filter_quality_; }
61 bool is_scale_adjustment_identity() const {
62 return std::abs(scale_adjustment_.width() - 1.f) < FLT_EPSILON &&
63 std::abs(scale_adjustment_.height() - 1.f) < FLT_EPSILON;
64 }
65
66 void set_at_raster_decode(bool at_raster_decode) {
67 at_raster_decode_ = at_raster_decode;
68 }
69 bool is_at_raster_decode() const { return at_raster_decode_; }
70
71 private:
72 const SkImage* image_;
73 SkSize scale_adjustment_;
74 SkFilterQuality filter_quality_;
75 bool at_raster_decode_;
36 }; 76 };
37 77
38 } // namespace cc 78 } // namespace cc
39 79
40 #endif // CC_PLAYBACK_DRAW_IMAGE_H_ 80 #endif // CC_PLAYBACK_DRAW_IMAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698