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

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: Fix some compilation issues in ui 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
« no previous file with comments | « cc/trees/layer_tree_host_pixeltest_tiles.cc ('k') | ui/compositor/compositing_recorder.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 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 30 matching lines...) Expand all
41 closers_[num_closers_] = closer; 41 closers_[num_closers_] = closer;
42 bounds_in_layer_[num_closers_++] = bounds_in_layer; 42 bounds_in_layer_[num_closers_++] = bounds_in_layer;
43 } 43 }
44 44
45 static gfx::Rect PathToEnclosingRect(const gfx::Path& path) { 45 static gfx::Rect PathToEnclosingRect(const gfx::Path& path) {
46 return gfx::ToEnclosingRect(gfx::SkRectToRectF(path.getBounds())); 46 return gfx::ToEnclosingRect(gfx::SkRectToRectF(path.getBounds()));
47 } 47 }
48 48
49 void ClipRecorder::ClipRect(const gfx::Rect& clip_rect) { 49 void ClipRecorder::ClipRect(const gfx::Rect& clip_rect) {
50 gfx::Rect clip_in_layer_space = context_.ToLayerSpaceRect(clip_rect); 50 gfx::Rect clip_in_layer_space = context_.ToLayerSpaceRect(clip_rect);
51 auto* item = context_.list_->CreateAndAppendItem<cc::ClipDisplayItem>( 51 context_.list_->CreateAndAppendItem<cc::ClipDisplayItem>(
52 clip_in_layer_space); 52 clip_in_layer_space, clip_rect, std::vector<SkRRect>());
53 item->SetNew(clip_rect, std::vector<SkRRect>());
54 RecordCloser(clip_in_layer_space, CLIP_RECT); 53 RecordCloser(clip_in_layer_space, CLIP_RECT);
55 } 54 }
56 55
57 void ClipRecorder::ClipPath(const gfx::Path& clip_path) { 56 void ClipRecorder::ClipPath(const gfx::Path& clip_path) {
58 bool anti_alias = false; 57 bool anti_alias = false;
59 gfx::Rect clip_in_layer_space = 58 gfx::Rect clip_in_layer_space =
60 context_.ToLayerSpaceRect(PathToEnclosingRect(clip_path)); 59 context_.ToLayerSpaceRect(PathToEnclosingRect(clip_path));
61 auto* item = context_.list_->CreateAndAppendItem<cc::ClipPathDisplayItem>( 60 context_.list_->CreateAndAppendItem<cc::ClipPathDisplayItem>(
62 clip_in_layer_space); 61 clip_in_layer_space, clip_path, SkRegion::kIntersect_Op, anti_alias);
63 item->SetNew(clip_path, SkRegion::kIntersect_Op, anti_alias);
64 RecordCloser(clip_in_layer_space, CLIP_PATH); 62 RecordCloser(clip_in_layer_space, CLIP_PATH);
65 } 63 }
66 64
67 void ClipRecorder::ClipPathWithAntiAliasing(const gfx::Path& clip_path) { 65 void ClipRecorder::ClipPathWithAntiAliasing(const gfx::Path& clip_path) {
68 bool anti_alias = true; 66 bool anti_alias = true;
69 gfx::Rect clip_in_layer_space = 67 gfx::Rect clip_in_layer_space =
70 context_.ToLayerSpaceRect(PathToEnclosingRect(clip_path)); 68 context_.ToLayerSpaceRect(PathToEnclosingRect(clip_path));
71 auto* item = context_.list_->CreateAndAppendItem<cc::ClipPathDisplayItem>( 69 context_.list_->CreateAndAppendItem<cc::ClipPathDisplayItem>(
72 clip_in_layer_space); 70 clip_in_layer_space, clip_path, SkRegion::kIntersect_Op, anti_alias);
73 item->SetNew(clip_path, SkRegion::kIntersect_Op, anti_alias);
74 RecordCloser(clip_in_layer_space, CLIP_PATH); 71 RecordCloser(clip_in_layer_space, CLIP_PATH);
75 } 72 }
76 73
77 } // namespace ui 74 } // namespace ui
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_pixeltest_tiles.cc ('k') | ui/compositor/compositing_recorder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698