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

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

Issue 2857923004: cc: Keep PaintImage in DrawImage. (Closed)
Patch Set: .. Created 3 years, 7 months 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
« no previous file with comments | « cc/paint/display_item_list.cc ('k') | cc/paint/draw_image.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_PAINT_DRAW_IMAGE_H_ 5 #ifndef CC_PAINT_DRAW_IMAGE_H_
6 #define CC_PAINT_DRAW_IMAGE_H_ 6 #define CC_PAINT_DRAW_IMAGE_H_
7 7
8 #include "cc/paint/paint_export.h" 8 #include "cc/paint/paint_export.h"
9 #include "cc/paint/paint_image.h"
9 #include "third_party/skia/include/core/SkFilterQuality.h" 10 #include "third_party/skia/include/core/SkFilterQuality.h"
10 #include "third_party/skia/include/core/SkImage.h" 11 #include "third_party/skia/include/core/SkImage.h"
11 #include "third_party/skia/include/core/SkMatrix.h" 12 #include "third_party/skia/include/core/SkMatrix.h"
12 #include "third_party/skia/include/core/SkRect.h" 13 #include "third_party/skia/include/core/SkRect.h"
13 #include "third_party/skia/include/core/SkRefCnt.h" 14 #include "third_party/skia/include/core/SkRefCnt.h"
14 #include "ui/gfx/color_space.h" 15 #include "ui/gfx/color_space.h"
15 #include "ui/gfx/geometry/size_f.h" 16 #include "ui/gfx/geometry/size_f.h"
16 17
17 namespace cc { 18 namespace cc {
18 19
19 // TODO(vmpstr): This should probably be DISALLOW_COPY_AND_ASSIGN and transport 20 // TODO(vmpstr): This should probably be DISALLOW_COPY_AND_ASSIGN and transport
20 // it around using a pointer, since it became kind of large. Profile. 21 // it around using a pointer, since it became kind of large. Profile.
21 class CC_PAINT_EXPORT DrawImage { 22 class CC_PAINT_EXPORT DrawImage {
22 public: 23 public:
23 DrawImage(); 24 DrawImage();
24 DrawImage(sk_sp<const SkImage> image, 25 DrawImage(PaintImage image,
25 const SkIRect& src_rect, 26 const SkIRect& src_rect,
26 SkFilterQuality filter_quality, 27 SkFilterQuality filter_quality,
27 const SkMatrix& matrix, 28 const SkMatrix& matrix,
28 const gfx::ColorSpace& target_color_space); 29 const gfx::ColorSpace& target_color_space);
29 DrawImage(const DrawImage& other); 30 DrawImage(const DrawImage& other);
30 ~DrawImage(); 31 ~DrawImage();
31 32
32 const sk_sp<const SkImage>& image() const { return image_; } 33 const PaintImage& paint_image() const { return paint_image_; }
34 const sk_sp<SkImage>& image() const { return paint_image_.sk_image(); }
33 const SkSize& scale() const { return scale_; } 35 const SkSize& scale() const { return scale_; }
34 const SkIRect& src_rect() const { return src_rect_; } 36 const SkIRect& src_rect() const { return src_rect_; }
35 SkFilterQuality filter_quality() const { return filter_quality_; } 37 SkFilterQuality filter_quality() const { return filter_quality_; }
36 bool matrix_is_decomposable() const { return matrix_is_decomposable_; } 38 bool matrix_is_decomposable() const { return matrix_is_decomposable_; }
37 const SkMatrix& matrix() const { return matrix_; } 39 const SkMatrix& matrix() const { return matrix_; }
38 const gfx::ColorSpace& target_color_space() const { 40 const gfx::ColorSpace& target_color_space() const {
39 return target_color_space_; 41 return target_color_space_;
40 } 42 }
41 43
42 DrawImage ApplyScale(float scale) const { 44 DrawImage ApplyScale(float scale) const {
43 SkMatrix scaled_matrix = matrix_; 45 SkMatrix scaled_matrix = matrix_;
44 scaled_matrix.preScale(scale, scale); 46 scaled_matrix.preScale(scale, scale);
45 return DrawImage(image_, src_rect_, filter_quality_, scaled_matrix, 47 return DrawImage(paint_image_, src_rect_, filter_quality_, scaled_matrix,
46 target_color_space_); 48 target_color_space_);
47 } 49 }
48 DrawImage ApplyTargetColorSpace(const gfx::ColorSpace& target_color_space) { 50 DrawImage ApplyTargetColorSpace(const gfx::ColorSpace& target_color_space) {
49 return DrawImage(image_, src_rect_, filter_quality_, matrix_, 51 return DrawImage(paint_image_, src_rect_, filter_quality_, matrix_,
50 target_color_space); 52 target_color_space);
51 } 53 }
52 54
53 private: 55 private:
54 sk_sp<const SkImage> image_; 56 PaintImage paint_image_;
55 SkIRect src_rect_; 57 SkIRect src_rect_;
56 SkFilterQuality filter_quality_; 58 SkFilterQuality filter_quality_;
57 SkMatrix matrix_; 59 SkMatrix matrix_;
58 SkSize scale_; 60 SkSize scale_;
59 bool matrix_is_decomposable_; 61 bool matrix_is_decomposable_;
60 gfx::ColorSpace target_color_space_; 62 gfx::ColorSpace target_color_space_;
61 }; 63 };
62 64
63 } // namespace cc 65 } // namespace cc
64 66
65 #endif // CC_PAINT_DRAW_IMAGE_H_ 67 #endif // CC_PAINT_DRAW_IMAGE_H_
OLDNEW
« no previous file with comments | « cc/paint/display_item_list.cc ('k') | cc/paint/draw_image.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698