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

Side by Side Diff: ui/compositor/clip_recorder.cc

Issue 1494223003: cc: Shrink size of display item (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make ui compile too oops Created 5 years 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
OLDNEW
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 #include "ui/compositor/clip_recorder.h" 5 #include "ui/compositor/clip_recorder.h"
6 6
7 #include "cc/playback/clip_display_item.h" 7 #include "cc/playback/clip_display_item.h"
8 #include "cc/playback/clip_path_display_item.h" 8 #include "cc/playback/clip_path_display_item.h"
9 #include "cc/playback/display_item_list.h" 9 #include "cc/playback/display_item_list.h"
10 #include "ui/compositor/paint_context.h" 10 #include "ui/compositor/paint_context.h"
(...skipping 19 matching lines...) Expand all
30 case CLIP_PATH: 30 case CLIP_PATH:
31 context_.list_->CreateAndAppendItem<cc::EndClipPathDisplayItem>( 31 context_.list_->CreateAndAppendItem<cc::EndClipPathDisplayItem>(
32 bounds_in_layer_); 32 bounds_in_layer_);
33 break; 33 break;
34 } 34 }
35 } 35 }
36 } 36 }
37 37
38 void ClipRecorder::ClipRect(const gfx::Rect& clip_rect) { 38 void ClipRecorder::ClipRect(const gfx::Rect& clip_rect) {
39 gfx::Rect clip_in_layer_space = context_.ToLayerSpaceRect(clip_rect); 39 gfx::Rect clip_in_layer_space = context_.ToLayerSpaceRect(clip_rect);
40 auto* item = context_.list_->CreateAndAppendItem<cc::ClipDisplayItem>( 40 context_.list_->CreateAndAppendItem<cc::ClipDisplayItem>(
41 clip_in_layer_space); 41 clip_in_layer_space, clip_rect, std::vector<SkRRect>());
42 item->SetNew(clip_rect, std::vector<SkRRect>());
43 DCHECK_LT(num_closers_, arraysize(closers_)); 42 DCHECK_LT(num_closers_, arraysize(closers_));
44 closers_[num_closers_++] = CLIP_RECT; 43 closers_[num_closers_++] = CLIP_RECT;
45 } 44 }
46 45
47 void ClipRecorder::ClipPath(const gfx::Path& clip_path) { 46 void ClipRecorder::ClipPath(const gfx::Path& clip_path) {
48 bool anti_alias = false; 47 bool anti_alias = false;
49 // As a further optimization, consider passing a more granular visual rect. 48 // As a further optimization, consider passing a more granular visual rect.
50 auto* item = context_.list_->CreateAndAppendItem<cc::ClipPathDisplayItem>( 49 context_.list_->CreateAndAppendItem<cc::ClipPathDisplayItem>(
51 bounds_in_layer_); 50 bounds_in_layer_, clip_path, SkRegion::kIntersect_Op, anti_alias);
52 item->SetNew(clip_path, SkRegion::kIntersect_Op, anti_alias);
53 DCHECK_LT(num_closers_, arraysize(closers_)); 51 DCHECK_LT(num_closers_, arraysize(closers_));
54 closers_[num_closers_++] = CLIP_PATH; 52 closers_[num_closers_++] = CLIP_PATH;
55 } 53 }
56 54
57 void ClipRecorder::ClipPathWithAntiAliasing( 55 void ClipRecorder::ClipPathWithAntiAliasing(
58 const gfx::Path& clip_path) { 56 const gfx::Path& clip_path) {
59 bool anti_alias = true; 57 bool anti_alias = true;
60 // As a further optimization, consider passing a more granular visual rect. 58 // As a further optimization, consider passing a more granular visual rect.
61 auto* item = context_.list_->CreateAndAppendItem<cc::ClipPathDisplayItem>( 59 context_.list_->CreateAndAppendItem<cc::ClipPathDisplayItem>(
62 bounds_in_layer_); 60 bounds_in_layer_, clip_path, SkRegion::kIntersect_Op, anti_alias);
63 item->SetNew(clip_path, SkRegion::kIntersect_Op, anti_alias);
64 DCHECK_LT(num_closers_, arraysize(closers_)); 61 DCHECK_LT(num_closers_, arraysize(closers_));
65 closers_[num_closers_++] = CLIP_PATH; 62 closers_[num_closers_++] = CLIP_PATH;
66 } 63 }
67 64
68 } // namespace ui 65 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698