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

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

Issue 2751833007: cc: Move DisplayItem::Raster up to DisplayItemList (Closed)
Patch Set: virtualraster: . Created 3 years, 9 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/playback/clip_display_item.h ('k') | cc/playback/clip_path_display_item.h » ('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/playback/clip_display_item.h" 5 #include "cc/playback/clip_display_item.h"
6 6
7 #include <stddef.h>
8
9 #include <string>
10
11 #include "base/logging.h"
12 #include "base/strings/stringprintf.h"
13 #include "base/trace_event/trace_event_argument.h"
14 #include "third_party/skia/include/core/SkCanvas.h"
15 #include "ui/gfx/skia_util.h"
16
17 namespace cc { 7 namespace cc {
18 class ImageSerializationProcessor;
19 8
20 ClipDisplayItem::ClipDisplayItem(const gfx::Rect& clip_rect, 9 ClipDisplayItem::ClipDisplayItem(const gfx::Rect& clip_rect,
21 const std::vector<SkRRect>& rounded_clip_rects, 10 std::vector<SkRRect> rounded_clip_rects,
22 bool antialias) 11 bool antialias)
23 : DisplayItem(CLIP) { 12 : DisplayItem(CLIP),
24 SetNew(clip_rect, rounded_clip_rects, antialias); 13 clip_rect(clip_rect),
25 } 14 rounded_clip_rects(std::move(rounded_clip_rects)),
15 antialias(antialias) {}
26 16
27 void ClipDisplayItem::SetNew(const gfx::Rect& clip_rect, 17 ClipDisplayItem::~ClipDisplayItem() = default;
28 const std::vector<SkRRect>& rounded_clip_rects,
29 bool antialias) {
30 clip_rect_ = clip_rect;
31 rounded_clip_rects_ = rounded_clip_rects;
32 antialias_ = antialias;
33 }
34
35 ClipDisplayItem::~ClipDisplayItem() {}
36
37 void ClipDisplayItem::Raster(SkCanvas* canvas,
38 SkPicture::AbortCallback* callback) const {
39 canvas->save();
40 canvas->clipRect(gfx::RectToSkRect(clip_rect_), antialias_);
41 for (size_t i = 0; i < rounded_clip_rects_.size(); ++i) {
42 if (rounded_clip_rects_[i].isRect()) {
43 canvas->clipRect(rounded_clip_rects_[i].rect(), antialias_);
44 } else {
45 canvas->clipRRect(rounded_clip_rects_[i], antialias_);
46 }
47 }
48 }
49 18
50 EndClipDisplayItem::EndClipDisplayItem() : DisplayItem(END_CLIP) {} 19 EndClipDisplayItem::EndClipDisplayItem() : DisplayItem(END_CLIP) {}
51 20
52 EndClipDisplayItem::~EndClipDisplayItem() { 21 EndClipDisplayItem::~EndClipDisplayItem() = default;
53 }
54
55 void EndClipDisplayItem::Raster(SkCanvas* canvas,
56 SkPicture::AbortCallback* callback) const {
57 canvas->restore();
58 }
59 22
60 } // namespace cc 23 } // namespace cc
OLDNEW
« no previous file with comments | « cc/playback/clip_display_item.h ('k') | cc/playback/clip_path_display_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698