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

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

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 4 years 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/discardable_image_map.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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "base/trace_event/trace_event_argument.h" 11 #include "base/trace_event/trace_event_argument.h"
12 #include "cc/proto/display_item.pb.h" 12 #include "cc/proto/display_item.pb.h"
13 #include "cc/proto/gfx_conversions.h" 13 #include "cc/proto/gfx_conversions.h"
14 #include "cc/proto/skia_conversions.h" 14 #include "cc/proto/skia_conversions.h"
15 #include "skia/ext/cdl_paint.h"
15 #include "third_party/skia/include/core/SkCanvas.h" 16 #include "third_party/skia/include/core/SkCanvas.h"
16 #include "third_party/skia/include/core/SkData.h" 17 #include "third_party/skia/include/core/SkData.h"
17 #include "third_party/skia/include/core/SkFlattenable.h" 18 #include "third_party/skia/include/core/SkFlattenable.h"
18 #include "third_party/skia/include/core/SkFlattenableSerialization.h" 19 #include "third_party/skia/include/core/SkFlattenableSerialization.h"
19 #include "third_party/skia/include/core/SkPaint.h" 20 #include "third_party/skia/include/core/SkPaint.h"
20 21
21 #include "ui/gfx/skia_util.h" 22 #include "ui/gfx/skia_util.h"
22 23
23 namespace cc { 24 namespace cc {
24 25
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 89
89 if (color_filter_) { 90 if (color_filter_) {
90 sk_sp<SkData> data(SkValidatingSerializeFlattenable(color_filter_.get())); 91 sk_sp<SkData> data(SkValidatingSerializeFlattenable(color_filter_.get()));
91 if (data->size() > 0) 92 if (data->size() > 0)
92 details->set_color_filter(data->data(), data->size()); 93 details->set_color_filter(data->data(), data->size());
93 } 94 }
94 95
95 details->set_lcd_text_requires_opaque_layer(lcd_text_requires_opaque_layer_); 96 details->set_lcd_text_requires_opaque_layer(lcd_text_requires_opaque_layer_);
96 } 97 }
97 98
98 void CompositingDisplayItem::Raster( 99 void CompositingDisplayItem::Raster(CdlCanvas* canvas,
99 SkCanvas* canvas, 100 SkPicture::AbortCallback* callback) const {
100 SkPicture::AbortCallback* callback) const { 101 CdlPaint paint;
101 SkPaint paint;
102 paint.setBlendMode(xfermode_); 102 paint.setBlendMode(xfermode_);
103 paint.setAlpha(alpha_); 103 paint.setAlpha(alpha_);
104 paint.setColorFilter(color_filter_); 104 paint.setColorFilter(color_filter_);
105 const SkRect* bounds = has_bounds_ ? &bounds_ : nullptr; 105 const SkRect* bounds = has_bounds_ ? &bounds_ : nullptr;
106 if (lcd_text_requires_opaque_layer_) 106 if (lcd_text_requires_opaque_layer_)
107 canvas->saveLayer(bounds, &paint); 107 canvas->saveLayer(bounds, &paint);
108 else 108 else
109 canvas->saveLayerPreserveLCDTextRequests(bounds, &paint); 109 canvas->saveLayerPreserveLCDTextRequests(bounds, &paint);
110 } 110 }
111 111
(...skipping 25 matching lines...) Expand all
137 } 137 }
138 138
139 EndCompositingDisplayItem::~EndCompositingDisplayItem() { 139 EndCompositingDisplayItem::~EndCompositingDisplayItem() {
140 } 140 }
141 141
142 void EndCompositingDisplayItem::ToProtobuf(proto::DisplayItem* proto) const { 142 void EndCompositingDisplayItem::ToProtobuf(proto::DisplayItem* proto) const {
143 proto->set_type(proto::DisplayItem::Type_EndCompositing); 143 proto->set_type(proto::DisplayItem::Type_EndCompositing);
144 } 144 }
145 145
146 void EndCompositingDisplayItem::Raster( 146 void EndCompositingDisplayItem::Raster(
147 SkCanvas* canvas, 147 CdlCanvas* canvas,
148 SkPicture::AbortCallback* callback) const { 148 SkPicture::AbortCallback* callback) const {
149 canvas->restore(); 149 canvas->restore();
150 } 150 }
151 151
152 void EndCompositingDisplayItem::AsValueInto( 152 void EndCompositingDisplayItem::AsValueInto(
153 const gfx::Rect& visual_rect, 153 const gfx::Rect& visual_rect,
154 base::trace_event::TracedValue* array) const { 154 base::trace_event::TracedValue* array) const {
155 array->AppendString( 155 array->AppendString(
156 base::StringPrintf("EndCompositingDisplayItem visualRect: [%s]", 156 base::StringPrintf("EndCompositingDisplayItem visualRect: [%s]",
157 visual_rect.ToString().c_str())); 157 visual_rect.ToString().c_str()));
158 } 158 }
159 159
160 size_t EndCompositingDisplayItem::ExternalMemoryUsage() const { 160 size_t EndCompositingDisplayItem::ExternalMemoryUsage() const {
161 return 0; 161 return 0;
162 } 162 }
163 163
164 } // namespace cc 164 } // namespace cc
OLDNEW
« no previous file with comments | « cc/playback/compositing_display_item.h ('k') | cc/playback/discardable_image_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698