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

Side by Side Diff: cc/resources/clip_display_item.cc

Issue 771563003: use SkClipOps where we can, legacyClip where we need to rework Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « cc/output/software_renderer.cc ('k') | cc/resources/content_layer_updater.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "cc/resources/clip_display_item.h" 5 #include "cc/resources/clip_display_item.h"
6 6
7 #include "third_party/skia/include/core/SkCanvas.h" 7 #include "third_party/skia/include/core/SkCanvas.h"
8 8
9 namespace cc { 9 namespace cc {
10 10
11 ClipDisplayItem::ClipDisplayItem(gfx::Rect clip_rect, 11 ClipDisplayItem::ClipDisplayItem(gfx::Rect clip_rect,
12 const std::vector<SkRRect>& rounded_clip_rects) 12 const std::vector<SkRRect>& rounded_clip_rects)
13 : clip_rect_(clip_rect), rounded_clip_rects_(rounded_clip_rects) { 13 : clip_rect_(clip_rect), rounded_clip_rects_(rounded_clip_rects) {
14 } 14 }
15 15
16 ClipDisplayItem::~ClipDisplayItem() { 16 ClipDisplayItem::~ClipDisplayItem() {
17 } 17 }
18 18
19 void ClipDisplayItem::Raster(SkCanvas* canvas, 19 void ClipDisplayItem::Raster(SkCanvas* canvas,
20 SkDrawPictureCallback* callback) const { 20 SkDrawPictureCallback* callback) const {
21 canvas->save(); 21 canvas->save();
22 canvas->clipRect(SkRect::MakeXYWH(clip_rect_.x(), clip_rect_.y(), 22 canvas->clipRect(SkRect::MakeXYWH(clip_rect_.x(), clip_rect_.y(),
23 clip_rect_.width(), clip_rect_.height())); 23 clip_rect_.width(), clip_rect_.height()));
24 for (size_t i = 0; i < rounded_clip_rects_.size(); ++i) { 24 for (size_t i = 0; i < rounded_clip_rects_.size(); ++i) {
25 if (rounded_clip_rects_[i].isRect()) { 25 if (rounded_clip_rects_[i].isRect()) {
26 canvas->clipRect(rounded_clip_rects_[i].rect()); 26 canvas->clipRect(rounded_clip_rects_[i].rect());
27 } else { 27 } else {
28 bool antialiased = true; 28 bool antialiased = true;
29 canvas->clipRRect(rounded_clip_rects_[i], SkRegion::kIntersect_Op, 29 canvas->clipRRect(rounded_clip_rects_[i], kIntersect_SkClipOp,
30 antialiased); 30 antialiased);
31 } 31 }
32 } 32 }
33 } 33 }
34 34
35 bool ClipDisplayItem::IsSuitableForGpuRasterization() const { 35 bool ClipDisplayItem::IsSuitableForGpuRasterization() const {
36 return true; 36 return true;
37 } 37 }
38 38
39 int ClipDisplayItem::ApproximateOpCount() const { 39 int ClipDisplayItem::ApproximateOpCount() const {
(...skipping 25 matching lines...) Expand all
65 65
66 int EndClipDisplayItem::ApproximateOpCount() const { 66 int EndClipDisplayItem::ApproximateOpCount() const {
67 return 0; 67 return 0;
68 } 68 }
69 69
70 size_t EndClipDisplayItem::PictureMemoryUsage() const { 70 size_t EndClipDisplayItem::PictureMemoryUsage() const {
71 return 0; 71 return 0;
72 } 72 }
73 73
74 } // namespace cc 74 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/software_renderer.cc ('k') | cc/resources/content_layer_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698