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

Side by Side Diff: cc/playback/decoded_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: rebase Created 4 years, 11 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/layers/picture_layer_impl.cc ('k') | cc/playback/discardable_image_map.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/playback/discardable_image_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698