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

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

Issue 1138923005: Remove SK_LEGACY_DRAWPICTURECALLBACK (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: analysis_canvas_unittest fix Created 5 years, 7 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/compositing_display_item.h ('k') | cc/playback/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 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 "cc/playback/compositing_display_item.h" 5 #include "cc/playback/compositing_display_item.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/trace_event/trace_event_argument.h" 8 #include "base/trace_event/trace_event_argument.h"
9 #include "third_party/skia/include/core/SkCanvas.h" 9 #include "third_party/skia/include/core/SkCanvas.h"
10 #include "third_party/skia/include/core/SkPaint.h" 10 #include "third_party/skia/include/core/SkPaint.h"
(...skipping 20 matching lines...) Expand all
31 color_filter_ = cf; 31 color_filter_ = cf;
32 32
33 // TODO(pdr): Include color_filter's memory here. 33 // TODO(pdr): Include color_filter's memory here.
34 size_t memory_usage = 34 size_t memory_usage =
35 sizeof(float) + sizeof(bool) + sizeof(SkRect) + sizeof(SkXfermode::Mode); 35 sizeof(float) + sizeof(bool) + sizeof(SkRect) + sizeof(SkXfermode::Mode);
36 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 1 /* op_count */, 36 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 1 /* op_count */,
37 memory_usage); 37 memory_usage);
38 } 38 }
39 39
40 void CompositingDisplayItem::Raster(SkCanvas* canvas, 40 void CompositingDisplayItem::Raster(SkCanvas* canvas,
41 SkDrawPictureCallback* callback) const { 41 SkPicture::AbortCallback* callback) const {
42 SkPaint paint; 42 SkPaint paint;
43 paint.setXfermodeMode(xfermode_); 43 paint.setXfermodeMode(xfermode_);
44 paint.setAlpha(alpha_); 44 paint.setAlpha(alpha_);
45 paint.setColorFilter(color_filter_.get()); 45 paint.setColorFilter(color_filter_.get());
46 canvas->saveLayer(has_bounds_ ? &bounds_ : nullptr, &paint); 46 canvas->saveLayer(has_bounds_ ? &bounds_ : nullptr, &paint);
47 } 47 }
48 48
49 void CompositingDisplayItem::AsValueInto( 49 void CompositingDisplayItem::AsValueInto(
50 base::trace_event::TracedValue* array) const { 50 base::trace_event::TracedValue* array) const {
51 array->AppendString(base::StringPrintf( 51 array->AppendString(base::StringPrintf(
52 "CompositingDisplayItem alpha: %d, xfermode: %d", alpha_, xfermode_)); 52 "CompositingDisplayItem alpha: %d, xfermode: %d", alpha_, xfermode_));
53 if (has_bounds_) 53 if (has_bounds_)
54 array->AppendString(base::StringPrintf( 54 array->AppendString(base::StringPrintf(
55 ", bounds: [%f, %f, %f, %f]", static_cast<float>(bounds_.x()), 55 ", bounds: [%f, %f, %f, %f]", static_cast<float>(bounds_.x()),
56 static_cast<float>(bounds_.y()), static_cast<float>(bounds_.width()), 56 static_cast<float>(bounds_.y()), static_cast<float>(bounds_.width()),
57 static_cast<float>(bounds_.height()))); 57 static_cast<float>(bounds_.height())));
58 } 58 }
59 59
60 EndCompositingDisplayItem::EndCompositingDisplayItem() { 60 EndCompositingDisplayItem::EndCompositingDisplayItem() {
61 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 0 /* op_count */, 61 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 0 /* op_count */,
62 0 /* memory_usage */); 62 0 /* memory_usage */);
63 } 63 }
64 64
65 EndCompositingDisplayItem::~EndCompositingDisplayItem() { 65 EndCompositingDisplayItem::~EndCompositingDisplayItem() {
66 } 66 }
67 67
68 void EndCompositingDisplayItem::Raster(SkCanvas* canvas, 68 void EndCompositingDisplayItem::Raster(
69 SkDrawPictureCallback* callback) const { 69 SkCanvas* canvas,
70 SkPicture::AbortCallback* callback) const {
70 canvas->restore(); 71 canvas->restore();
71 } 72 }
72 73
73 void EndCompositingDisplayItem::AsValueInto( 74 void EndCompositingDisplayItem::AsValueInto(
74 base::trace_event::TracedValue* array) const { 75 base::trace_event::TracedValue* array) const {
75 array->AppendString("EndCompositingDisplayItem"); 76 array->AppendString("EndCompositingDisplayItem");
76 } 77 }
77 78
78 } // namespace cc 79 } // namespace cc
OLDNEW
« no previous file with comments | « cc/playback/compositing_display_item.h ('k') | cc/playback/display_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698