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

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

Issue 2894843002: Revert of Remove cullRect() from PaintOpBuffer. (Closed)
Patch Set: rebase TestExpectations 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);
775 ~PaintOpBuffer() override; 776 ~PaintOpBuffer() override;
776 777
777 void Reset(); 778 void Reset();
778 779
779 void playback(SkCanvas* canvas) const; 780 void playback(SkCanvas* canvas) const;
780 void playback(SkCanvas* canvas, SkPicture::AbortCallback* callback) const; 781 void playback(SkCanvas* canvas, SkPicture::AbortCallback* callback) const;
781 782
782 // Returns the size of the paint op buffer. That is, the number of ops 783 // Returns the size of the paint op buffer. That is, the number of ops
783 // contained in it. 784 // contained in it.
784 size_t size() const { return op_count_; } 785 size_t size() const { return op_count_; }
785 // Returns the number of bytes used by the paint op buffer. 786 // Returns the number of bytes used by the paint op buffer.
786 size_t bytes_used() const { 787 size_t bytes_used() const {
787 return sizeof(*this) + reserved_ + subrecord_bytes_used_; 788 return sizeof(*this) + reserved_ + subrecord_bytes_used_;
788 } 789 }
789 int numSlowPaths() const { return num_slow_paths_; } 790 int numSlowPaths() const { return num_slow_paths_; }
790 bool HasDiscardableImages() const { return has_discardable_images_; } 791 bool HasDiscardableImages() const { return has_discardable_images_; }
791 792
792 // Resize the PaintOpBuffer to exactly fit the current amount of used space. 793 // Resize the PaintOpBuffer to exactly fit the current amount of used space.
793 void ShrinkToFit(); 794 void ShrinkToFit();
794 795
796 const SkRect& cullRect() const { return cull_rect_; }
797
795 PaintOp* GetFirstOp() const { 798 PaintOp* GetFirstOp() const {
796 return const_cast<PaintOp*>(first_op_.data_as<PaintOp>()); 799 return const_cast<PaintOp*>(first_op_.data_as<PaintOp>());
797 } 800 }
798 801
799 template <typename T, typename... Args> 802 template <typename T, typename... Args>
800 void push(Args&&... args) { 803 void push(Args&&... args) {
801 static_assert(std::is_convertible<T, PaintOp>::value, "T not a PaintOp."); 804 static_assert(std::is_convertible<T, PaintOp>::value, "T not a PaintOp.");
802 static_assert(!std::is_convertible<T, PaintOpWithData>::value, 805 static_assert(!std::is_convertible<T, PaintOpWithData>::value,
803 "Type needs to use push_with_data"); 806 "Type needs to use push_with_data");
804 push_internal<T>(0, std::forward<Args>(args)...); 807 push_internal<T>(0, std::forward<Args>(args)...);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 std::unique_ptr<char, base::AlignedFreeDeleter> data_; 942 std::unique_ptr<char, base::AlignedFreeDeleter> data_;
940 size_t used_ = 0; 943 size_t used_ = 0;
941 size_t reserved_ = 0; 944 size_t reserved_ = 0;
942 size_t op_count_ = 0; 945 size_t op_count_ = 0;
943 946
944 // Record paths for veto-to-msaa for gpu raster. 947 // Record paths for veto-to-msaa for gpu raster.
945 int num_slow_paths_ = 0; 948 int num_slow_paths_ = 0;
946 // Record additional bytes used by referenced sub-records and display lists. 949 // Record additional bytes used by referenced sub-records and display lists.
947 size_t subrecord_bytes_used_ = 0; 950 size_t subrecord_bytes_used_ = 0;
948 bool has_discardable_images_ = false; 951 bool has_discardable_images_ = false;
952 SkRect cull_rect_;
949 953
950 DISALLOW_COPY_AND_ASSIGN(PaintOpBuffer); 954 DISALLOW_COPY_AND_ASSIGN(PaintOpBuffer);
951 }; 955 };
952 956
953 } // namespace cc 957 } // namespace cc
954 958
955 #endif // CC_PAINT_PAINT_OP_BUFFER_H_ 959 #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