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

Unified Diff: ui/compositor/clip_recorder.cc

Issue 2230513005: Move visual rect unioning between paired items to cc::DisplayItemList. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review feedback. Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/compositor/clip_recorder.h ('k') | ui/compositor/compositing_recorder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/clip_recorder.cc
diff --git a/ui/compositor/clip_recorder.cc b/ui/compositor/clip_recorder.cc
index d2078f5f863eed5c209370ca1cf7adc3e21b523c..1c0eb55da2bb123ba232502963a0dd93e3348855 100644
--- a/ui/compositor/clip_recorder.cc
+++ b/ui/compositor/clip_recorder.cc
@@ -17,59 +17,47 @@
namespace ui {
ClipRecorder::ClipRecorder(const PaintContext& context)
- : context_(context), num_closers_(0) {}
+ : context_(context), num_closers_(0) {
+ }
ClipRecorder::~ClipRecorder() {
for (int i = num_closers_ - 1; i >= 0; --i) {
- const gfx::Rect& bounds_in_layer = bounds_in_layer_[i];
switch (closers_[i]) {
case CLIP_RECT:
- context_.list_->CreateAndAppendItem<cc::EndClipDisplayItem>(
- bounds_in_layer);
+ context_.list_->CreateAndAppendPairedEndItem<cc::EndClipDisplayItem>();
break;
case CLIP_PATH:
- context_.list_->CreateAndAppendItem<cc::EndClipPathDisplayItem>(
- bounds_in_layer);
+ context_.list_
+ ->CreateAndAppendPairedEndItem<cc::EndClipPathDisplayItem>();
break;
}
}
}
-void ClipRecorder::RecordCloser(const gfx::Rect& bounds_in_layer,
- Closer closer) {
+void ClipRecorder::RecordCloser(Closer closer) {
DCHECK_LT(num_closers_, kMaxOpCount);
- closers_[num_closers_] = closer;
- bounds_in_layer_[num_closers_++] = bounds_in_layer;
-}
-
-static gfx::Rect PathToEnclosingRect(const gfx::Path& path) {
- return gfx::ToEnclosingRect(gfx::SkRectToRectF(path.getBounds()));
+ closers_[num_closers_++] = closer;
}
void ClipRecorder::ClipRect(const gfx::Rect& clip_rect) {
bool antialias = false;
- gfx::Rect clip_in_layer_space = context_.ToLayerSpaceRect(clip_rect);
- context_.list_->CreateAndAppendItem<cc::ClipDisplayItem>(
- clip_in_layer_space, clip_rect, std::vector<SkRRect>(), antialias);
- RecordCloser(clip_in_layer_space, CLIP_RECT);
+ context_.list_->CreateAndAppendPairedBeginItem<cc::ClipDisplayItem>(
+ clip_rect, std::vector<SkRRect>(), antialias);
+ RecordCloser(CLIP_RECT);
}
void ClipRecorder::ClipPath(const gfx::Path& clip_path) {
bool antialias = false;
- gfx::Rect clip_in_layer_space =
- context_.ToLayerSpaceRect(PathToEnclosingRect(clip_path));
- context_.list_->CreateAndAppendItem<cc::ClipPathDisplayItem>(
- clip_in_layer_space, clip_path, SkRegion::kIntersect_Op, antialias);
- RecordCloser(clip_in_layer_space, CLIP_PATH);
+ context_.list_->CreateAndAppendPairedBeginItem<cc::ClipPathDisplayItem>(
+ clip_path, SkRegion::kIntersect_Op, antialias);
+ RecordCloser(CLIP_PATH);
}
void ClipRecorder::ClipPathWithAntiAliasing(const gfx::Path& clip_path) {
bool antialias = true;
- gfx::Rect clip_in_layer_space =
- context_.ToLayerSpaceRect(PathToEnclosingRect(clip_path));
- context_.list_->CreateAndAppendItem<cc::ClipPathDisplayItem>(
- clip_in_layer_space, clip_path, SkRegion::kIntersect_Op, antialias);
- RecordCloser(clip_in_layer_space, CLIP_PATH);
+ context_.list_->CreateAndAppendPairedBeginItem<cc::ClipPathDisplayItem>(
+ clip_path, SkRegion::kIntersect_Op, antialias);
+ RecordCloser(CLIP_PATH);
}
} // namespace ui
« no previous file with comments | « ui/compositor/clip_recorder.h ('k') | ui/compositor/compositing_recorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698