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

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

Issue 2889653002: Remove cullRect() from PaintOpBuffer. (Closed)
Patch Set: movecullrect2 rebase-once-and-for-all 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/drawing_display_item.cc ('k') | cc/paint/paint_op_buffer.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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_PAINT_OP_BUFFER_H_ 5 #ifndef CC_PAINT_PAINT_OP_BUFFER_H_
6 #define CC_PAINT_PAINT_OP_BUFFER_H_ 6 #define CC_PAINT_PAINT_OP_BUFFER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 using LargestPaintOp = DrawDRRectOp; 765 using LargestPaintOp = DrawDRRectOp;
766 766
767 class CC_PAINT_EXPORT PaintOpBuffer : public SkRefCnt { 767 class CC_PAINT_EXPORT PaintOpBuffer : public SkRefCnt {
768 public: 768 public:
769 enum { kInitialBufferSize = 4096 }; 769 enum { kInitialBufferSize = 4096 };
770 // It's not necessarily the case that the op with the maximum alignment 770 // It's not necessarily the case that the op with the maximum alignment
771 // requirements is also the biggest op, but for now that's true. 771 // requirements is also the biggest op, but for now that's true.
772 static constexpr size_t PaintOpAlign = ALIGNOF(DrawDRRectOp); 772 static constexpr size_t PaintOpAlign = ALIGNOF(DrawDRRectOp);
773 773
774 PaintOpBuffer(); 774 PaintOpBuffer();
775 explicit PaintOpBuffer(const SkRect& cull_rect);
776 ~PaintOpBuffer() override; 775 ~PaintOpBuffer() override;
777 776
778 void Reset(); 777 void Reset();
779 778
780 void playback(SkCanvas* canvas) const; 779 void playback(SkCanvas* canvas) const;
781 void playback(SkCanvas* canvas, SkPicture::AbortCallback* callback) const; 780 void playback(SkCanvas* canvas, SkPicture::AbortCallback* callback) const;
782 781
783 // Returns the size of the paint op buffer. That is, the number of ops 782 // Returns the size of the paint op buffer. That is, the number of ops
784 // contained in it. 783 // contained in it.
785 size_t size() const { return op_count_; } 784 size_t size() const { return op_count_; }
786 // Returns the number of bytes used by the paint op buffer. 785 // Returns the number of bytes used by the paint op buffer.
787 size_t bytes_used() const { 786 size_t bytes_used() const {
788 return sizeof(*this) + reserved_ + subrecord_bytes_used_; 787 return sizeof(*this) + reserved_ + subrecord_bytes_used_;
789 } 788 }
790 int numSlowPaths() const { return num_slow_paths_; } 789 int numSlowPaths() const { return num_slow_paths_; }
791 bool HasDiscardableImages() const { return has_discardable_images_; } 790 bool HasDiscardableImages() const { return has_discardable_images_; }
792 791
793 // Resize the PaintOpBuffer to exactly fit the current amount of used space. 792 // Resize the PaintOpBuffer to exactly fit the current amount of used space.
794 void ShrinkToFit(); 793 void ShrinkToFit();
795 794
796 const SkRect& cullRect() const { return cull_rect_; }
797
798 PaintOp* GetFirstOp() const { 795 PaintOp* GetFirstOp() const {
799 return const_cast<PaintOp*>(first_op_.data_as<PaintOp>()); 796 return const_cast<PaintOp*>(first_op_.data_as<PaintOp>());
800 } 797 }
801 798
802 template <typename T, typename... Args> 799 template <typename T, typename... Args>
803 void push(Args&&... args) { 800 void push(Args&&... args) {
804 static_assert(std::is_convertible<T, PaintOp>::value, "T not a PaintOp."); 801 static_assert(std::is_convertible<T, PaintOp>::value, "T not a PaintOp.");
805 static_assert(!std::is_convertible<T, PaintOpWithData>::value, 802 static_assert(!std::is_convertible<T, PaintOpWithData>::value,
806 "Type needs to use push_with_data"); 803 "Type needs to use push_with_data");
807 push_internal<T>(0, std::forward<Args>(args)...); 804 push_internal<T>(0, std::forward<Args>(args)...);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 std::unique_ptr<char, base::AlignedFreeDeleter> data_; 939 std::unique_ptr<char, base::AlignedFreeDeleter> data_;
943 size_t used_ = 0; 940 size_t used_ = 0;
944 size_t reserved_ = 0; 941 size_t reserved_ = 0;
945 size_t op_count_ = 0; 942 size_t op_count_ = 0;
946 943
947 // Record paths for veto-to-msaa for gpu raster. 944 // Record paths for veto-to-msaa for gpu raster.
948 int num_slow_paths_ = 0; 945 int num_slow_paths_ = 0;
949 // Record additional bytes used by referenced sub-records and display lists. 946 // Record additional bytes used by referenced sub-records and display lists.
950 size_t subrecord_bytes_used_ = 0; 947 size_t subrecord_bytes_used_ = 0;
951 bool has_discardable_images_ = false; 948 bool has_discardable_images_ = false;
952 SkRect cull_rect_;
953 949
954 DISALLOW_COPY_AND_ASSIGN(PaintOpBuffer); 950 DISALLOW_COPY_AND_ASSIGN(PaintOpBuffer);
955 }; 951 };
956 952
957 } // namespace cc 953 } // namespace cc
958 954
959 #endif // CC_PAINT_PAINT_OP_BUFFER_H_ 955 #endif // CC_PAINT_PAINT_OP_BUFFER_H_
OLDNEW
« no previous file with comments | « cc/paint/drawing_display_item.cc ('k') | cc/paint/paint_op_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698