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

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

Issue 2075873002: Support general raster matrix for RasterSource and DisplayItemList (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix a bug in PrepareForPlaybackToCanvas and fix cc_unittests Created 4 years, 6 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
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/filter_display_item.h" 5 #include "cc/playback/filter_display_item.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/trace_event/trace_event_argument.h" 10 #include "base/trace_event/trace_event_argument.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 ImageSerializationProcessor* image_serialization_processor) const { 51 ImageSerializationProcessor* image_serialization_processor) const {
52 proto->set_type(proto::DisplayItem::Type_Filter); 52 proto->set_type(proto::DisplayItem::Type_Filter);
53 53
54 proto::FilterDisplayItem* details = proto->mutable_filter_item(); 54 proto::FilterDisplayItem* details = proto->mutable_filter_item();
55 RectFToProto(bounds_, details->mutable_bounds()); 55 RectFToProto(bounds_, details->mutable_bounds());
56 56
57 // TODO(dtrainor): Support serializing FilterOperations (crbug.com/541321). 57 // TODO(dtrainor): Support serializing FilterOperations (crbug.com/541321).
58 } 58 }
59 59
60 void FilterDisplayItem::Raster(SkCanvas* canvas, 60 void FilterDisplayItem::Raster(SkCanvas* canvas,
61 const gfx::Rect& canvas_target_playback_rect,
62 SkPicture::AbortCallback* callback) const { 61 SkPicture::AbortCallback* callback) const {
63 canvas->save(); 62 canvas->save();
64 canvas->translate(bounds_.x(), bounds_.y()); 63 canvas->translate(bounds_.x(), bounds_.y());
65 64
66 sk_sp<SkImageFilter> image_filter = RenderSurfaceFilters::BuildImageFilter( 65 sk_sp<SkImageFilter> image_filter = RenderSurfaceFilters::BuildImageFilter(
67 filters_, gfx::SizeF(bounds_.width(), bounds_.height())); 66 filters_, gfx::SizeF(bounds_.width(), bounds_.height()));
68 SkRect boundaries = SkRect::MakeWH(bounds_.width(), bounds_.height()); 67 SkRect boundaries = SkRect::MakeWH(bounds_.width(), bounds_.height());
69 68
70 SkPaint paint; 69 SkPaint paint;
71 paint.setXfermodeMode(SkXfermode::kSrcOver_Mode); 70 paint.setXfermodeMode(SkXfermode::kSrcOver_Mode);
(...skipping 25 matching lines...) Expand all
97 96
98 EndFilterDisplayItem::~EndFilterDisplayItem() {} 97 EndFilterDisplayItem::~EndFilterDisplayItem() {}
99 98
100 void EndFilterDisplayItem::ToProtobuf( 99 void EndFilterDisplayItem::ToProtobuf(
101 proto::DisplayItem* proto, 100 proto::DisplayItem* proto,
102 ImageSerializationProcessor* image_serialization_processor) const { 101 ImageSerializationProcessor* image_serialization_processor) const {
103 proto->set_type(proto::DisplayItem::Type_EndFilter); 102 proto->set_type(proto::DisplayItem::Type_EndFilter);
104 } 103 }
105 104
106 void EndFilterDisplayItem::Raster(SkCanvas* canvas, 105 void EndFilterDisplayItem::Raster(SkCanvas* canvas,
107 const gfx::Rect& canvas_target_playback_rect,
108 SkPicture::AbortCallback* callback) const { 106 SkPicture::AbortCallback* callback) const {
109 canvas->restore(); 107 canvas->restore();
110 canvas->restore(); 108 canvas->restore();
111 } 109 }
112 110
113 void EndFilterDisplayItem::AsValueInto( 111 void EndFilterDisplayItem::AsValueInto(
114 const gfx::Rect& visual_rect, 112 const gfx::Rect& visual_rect,
115 base::trace_event::TracedValue* array) const { 113 base::trace_event::TracedValue* array) const {
116 array->AppendString( 114 array->AppendString(
117 base::StringPrintf("EndFilterDisplayItem visualRect: [%s]", 115 base::StringPrintf("EndFilterDisplayItem visualRect: [%s]",
118 visual_rect.ToString().c_str())); 116 visual_rect.ToString().c_str()));
119 } 117 }
120 118
121 size_t EndFilterDisplayItem::ExternalMemoryUsage() const { 119 size_t EndFilterDisplayItem::ExternalMemoryUsage() const {
122 return 0; 120 return 0;
123 } 121 }
124 122
125 } // namespace cc 123 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698