OLD | NEW |
---|---|
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_DISCARDABLE_IMAGE_MAP_H_ | 5 #ifndef CC_PLAYBACK_DISCARDABLE_IMAGE_MAP_H_ |
6 #define CC_PLAYBACK_DISCARDABLE_IMAGE_MAP_H_ | 6 #define CC_PLAYBACK_DISCARDABLE_IMAGE_MAP_H_ |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
13 #include "cc/base/rtree.h" | 13 #include "cc/base/rtree.h" |
14 #include "cc/playback/draw_image.h" | 14 #include "cc/playback/draw_image.h" |
15 #include "third_party/skia/include/core/SkPicture.h" | 15 #include "third_party/skia/include/core/SkPicture.h" |
16 #include "ui/gfx/geometry/rect.h" | 16 #include "ui/gfx/geometry/rect.h" |
17 #include "ui/gfx/geometry/size.h" | 17 #include "ui/gfx/geometry/size.h" |
18 | 18 |
19 class SkImage; | 19 class SkImage; |
20 | 20 |
21 namespace cc { | 21 namespace cc { |
22 | 22 |
23 // Helper function to apply the matrix to the rect and return the result. | |
24 SkRect MapRect(const SkMatrix& matrix, const SkRect& src); | |
25 | |
26 // Helper funciton to extract a scale from the matrix. Returns true on success | |
27 // and false on failure. | |
28 bool ExtractScale(const SkMatrix& matrix, SkSize* scale); | |
29 | |
30 // Helper function to compute the new rect bounds adjusted for both the current | |
31 // paint and all of the saved paints. Returns true on success and false on | |
32 // failure. | |
33 bool ComputeNewRectFromPaintBounds( | |
ericrk
2015/12/08 21:34:26
nit: name is a bit weird, as we are producing pain
vmpstr
2015/12/09 23:53:41
Renamed.
| |
34 const SkRect& rect, | |
35 const SkPaint* paint, | |
enne (OOO)
2015/12/08 23:27:24
Maybe calling this arg "current_paint" would also
vmpstr
2015/12/09 23:53:41
Done.
| |
36 const std::vector<const SkPaint*>& saved_paints, | |
37 SkRect* paint_bounds); | |
38 | |
23 // This class is used for generating discardable images data (see DrawImage | 39 // This class is used for generating discardable images data (see DrawImage |
24 // for the type of data it stores). It allows the client to query a particular | 40 // for the type of data it stores). It allows the client to query a particular |
25 // rect and get back a list of DrawImages in that rect. | 41 // rect and get back a list of DrawImages in that rect. |
26 class CC_EXPORT DiscardableImageMap { | 42 class CC_EXPORT DiscardableImageMap { |
27 public: | 43 public: |
28 class CC_EXPORT ScopedMetadataGenerator { | 44 class CC_EXPORT ScopedMetadataGenerator { |
29 public: | 45 public: |
30 ScopedMetadataGenerator(DiscardableImageMap* image_map, | 46 ScopedMetadataGenerator(DiscardableImageMap* image_map, |
31 const gfx::Size& bounds); | 47 const gfx::Size& bounds); |
32 ~ScopedMetadataGenerator(); | 48 ~ScopedMetadataGenerator(); |
(...skipping 20 matching lines...) Expand all Loading... | |
53 scoped_ptr<SkCanvas> BeginGeneratingMetadata(const gfx::Size& bounds); | 69 scoped_ptr<SkCanvas> BeginGeneratingMetadata(const gfx::Size& bounds); |
54 void EndGeneratingMetadata(); | 70 void EndGeneratingMetadata(); |
55 | 71 |
56 std::vector<std::pair<DrawImage, gfx::Rect>> all_images_; | 72 std::vector<std::pair<DrawImage, gfx::Rect>> all_images_; |
57 RTree images_rtree_; | 73 RTree images_rtree_; |
58 }; | 74 }; |
59 | 75 |
60 } // namespace cc | 76 } // namespace cc |
61 | 77 |
62 #endif // CC_PLAYBACK_DISCARDABLE_IMAGE_MAP_H_ | 78 #endif // CC_PLAYBACK_DISCARDABLE_IMAGE_MAP_H_ |
OLD | NEW |