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

Unified Diff: ui/compositor/clip_recorder.cc

Issue 1423653005: Further plumb visual rect into cc:DisplayItemList. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix clip recorder params in omnibox. Created 5 years, 1 month 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 e4668032d68a35aaa3c0ab403d626accd15071fb..0a3bc15ea981b7f3bd44119f774c3883767380a5 100644
--- a/ui/compositor/clip_recorder.cc
+++ b/ui/compositor/clip_recorder.cc
@@ -9,29 +9,36 @@
#include "cc/playback/display_item_list.h"
#include "ui/compositor/paint_context.h"
#include "ui/gfx/canvas.h"
+#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/path.h"
namespace ui {
-ClipRecorder::ClipRecorder(const PaintContext& context)
- : context_(context), num_closers_(0) {
-}
+ClipRecorder::ClipRecorder(const PaintContext& context,
+ const gfx::Size& size_in_layer)
+ : context_(context),
+ bounds_in_layer_(context.ToLayerSpaceBounds(size_in_layer)),
+ num_closers_(0) {}
ClipRecorder::~ClipRecorder() {
for (size_t i = num_closers_; i > 0; --i) {
switch (closers_[i - 1]) {
case CLIP_RECT:
- context_.list_->CreateAndAppendItem<cc::EndClipDisplayItem>();
+ context_.list_->CreateAndAppendItem<cc::EndClipDisplayItem>(
+ bounds_in_layer_);
break;
case CLIP_PATH:
- context_.list_->CreateAndAppendItem<cc::EndClipPathDisplayItem>();
+ context_.list_->CreateAndAppendItem<cc::EndClipPathDisplayItem>(
+ bounds_in_layer_);
break;
}
}
}
void ClipRecorder::ClipRect(const gfx::Rect& clip_rect) {
- auto* item = context_.list_->CreateAndAppendItem<cc::ClipDisplayItem>();
+ gfx::Rect clip_in_layer_space = context_.ToLayerSpaceRect(clip_rect);
+ auto* item = context_.list_->CreateAndAppendItem<cc::ClipDisplayItem>(
+ clip_in_layer_space);
item->SetNew(clip_rect, std::vector<SkRRect>());
DCHECK_LT(num_closers_, arraysize(closers_));
closers_[num_closers_++] = CLIP_RECT;
@@ -39,7 +46,9 @@ void ClipRecorder::ClipRect(const gfx::Rect& clip_rect) {
void ClipRecorder::ClipPath(const gfx::Path& clip_path) {
bool anti_alias = false;
- auto* item = context_.list_->CreateAndAppendItem<cc::ClipPathDisplayItem>();
+ // As a further optimization, consider passing a more granular visual rect.
+ auto* item = context_.list_->CreateAndAppendItem<cc::ClipPathDisplayItem>(
+ bounds_in_layer_);
item->SetNew(clip_path, SkRegion::kIntersect_Op, anti_alias);
DCHECK_LT(num_closers_, arraysize(closers_));
closers_[num_closers_++] = CLIP_PATH;
@@ -48,7 +57,9 @@ void ClipRecorder::ClipPath(const gfx::Path& clip_path) {
void ClipRecorder::ClipPathWithAntiAliasing(
const gfx::Path& clip_path) {
bool anti_alias = true;
- auto* item = context_.list_->CreateAndAppendItem<cc::ClipPathDisplayItem>();
+ // As a further optimization, consider passing a more granular visual rect.
+ auto* item = context_.list_->CreateAndAppendItem<cc::ClipPathDisplayItem>(
+ bounds_in_layer_);
item->SetNew(clip_path, SkRegion::kIntersect_Op, anti_alias);
DCHECK_LT(num_closers_, arraysize(closers_));
closers_[num_closers_++] = CLIP_PATH;
« 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