Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 29 matching lines...) Expand all Loading... | |
| 40 DCHECK_LT(num_closers_, kMaxOpCount); | 40 DCHECK_LT(num_closers_, kMaxOpCount); |
| 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 bool anti_alias = false; | |
|
danakj
2016/06/22 22:49:57
nit: antialias
Bret
2016/06/22 23:39:41
Changed everywhere in the file.
| |
| 50 gfx::Rect clip_in_layer_space = context_.ToLayerSpaceRect(clip_rect); | 51 gfx::Rect clip_in_layer_space = context_.ToLayerSpaceRect(clip_rect); |
| 51 context_.list_->CreateAndAppendItem<cc::ClipDisplayItem>( | 52 context_.list_->CreateAndAppendItem<cc::ClipDisplayItem>( |
| 52 clip_in_layer_space, clip_rect, std::vector<SkRRect>()); | 53 clip_in_layer_space, clip_rect, std::vector<SkRRect>(), anti_alias); |
| 53 RecordCloser(clip_in_layer_space, CLIP_RECT); | 54 RecordCloser(clip_in_layer_space, CLIP_RECT); |
| 54 } | 55 } |
| 55 | 56 |
| 56 void ClipRecorder::ClipPath(const gfx::Path& clip_path) { | 57 void ClipRecorder::ClipPath(const gfx::Path& clip_path) { |
| 57 bool anti_alias = false; | 58 bool anti_alias = false; |
| 58 gfx::Rect clip_in_layer_space = | 59 gfx::Rect clip_in_layer_space = |
| 59 context_.ToLayerSpaceRect(PathToEnclosingRect(clip_path)); | 60 context_.ToLayerSpaceRect(PathToEnclosingRect(clip_path)); |
| 60 context_.list_->CreateAndAppendItem<cc::ClipPathDisplayItem>( | 61 context_.list_->CreateAndAppendItem<cc::ClipPathDisplayItem>( |
| 61 clip_in_layer_space, clip_path, SkRegion::kIntersect_Op, anti_alias); | 62 clip_in_layer_space, clip_path, SkRegion::kIntersect_Op, anti_alias); |
| 62 RecordCloser(clip_in_layer_space, CLIP_PATH); | 63 RecordCloser(clip_in_layer_space, CLIP_PATH); |
| 63 } | 64 } |
| 64 | 65 |
| 65 void ClipRecorder::ClipPathWithAntiAliasing(const gfx::Path& clip_path) { | 66 void ClipRecorder::ClipPathWithAntiAliasing(const gfx::Path& clip_path) { |
| 66 bool anti_alias = true; | 67 bool anti_alias = true; |
| 67 gfx::Rect clip_in_layer_space = | 68 gfx::Rect clip_in_layer_space = |
| 68 context_.ToLayerSpaceRect(PathToEnclosingRect(clip_path)); | 69 context_.ToLayerSpaceRect(PathToEnclosingRect(clip_path)); |
| 69 context_.list_->CreateAndAppendItem<cc::ClipPathDisplayItem>( | 70 context_.list_->CreateAndAppendItem<cc::ClipPathDisplayItem>( |
| 70 clip_in_layer_space, clip_path, SkRegion::kIntersect_Op, anti_alias); | 71 clip_in_layer_space, clip_path, SkRegion::kIntersect_Op, anti_alias); |
| 71 RecordCloser(clip_in_layer_space, CLIP_PATH); | 72 RecordCloser(clip_in_layer_space, CLIP_PATH); |
| 72 } | 73 } |
| 73 | 74 |
| 74 } // namespace ui | 75 } // namespace ui |
| OLD | NEW |