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

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

Issue 952893003: Update from https://crrev.com/317530 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix gn for nacl Created 5 years, 10 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/resources/display_list_raster_source.h ('k') | cc/resources/display_list_recording_source.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/resources/display_list_raster_source.h" 5 #include "cc/resources/display_list_raster_source.h"
6 6
7 #include "base/trace_event/trace_event.h" 7 #include "base/trace_event/trace_event.h"
8 #include "cc/base/region.h" 8 #include "cc/base/region.h"
9 #include "cc/debug/debug_colors.h" 9 #include "cc/debug/debug_colors.h"
10 #include "cc/resources/display_item_list.h" 10 #include "cc/resources/display_item_list.h"
11 #include "cc/resources/raster_source_helper.h" 11 #include "cc/resources/raster_source_helper.h"
12 #include "skia/ext/analysis_canvas.h" 12 #include "skia/ext/analysis_canvas.h"
13 #include "third_party/skia/include/core/SkCanvas.h" 13 #include "third_party/skia/include/core/SkCanvas.h"
14 #include "third_party/skia/include/core/SkPictureRecorder.h" 14 #include "third_party/skia/include/core/SkPictureRecorder.h"
15 #include "ui/gfx/geometry/rect_conversions.h" 15 #include "ui/gfx/geometry/rect_conversions.h"
16 16
17 namespace { 17 namespace {
18 18
19 #ifdef NDEBUG 19 #ifdef NDEBUG
20 const bool kDefaultClearCanvasSetting = false; 20 const bool kDefaultClearCanvasSetting = false;
21 #else 21 #else
22 const bool kDefaultClearCanvasSetting = true; 22 const bool kDefaultClearCanvasSetting = true;
23 #endif 23 #endif
24 24
25 } // namespace 25 } // namespace
26 26
27 namespace cc { 27 namespace cc {
28 28
29 scoped_refptr<DisplayListRasterSource> DisplayListRasterSource::Create() {
30 return make_scoped_refptr(new DisplayListRasterSource);
31 }
32
33 scoped_refptr<DisplayListRasterSource> 29 scoped_refptr<DisplayListRasterSource>
34 DisplayListRasterSource::CreateFromDisplayListRecordingSource( 30 DisplayListRasterSource::CreateFromDisplayListRecordingSource(
35 const DisplayListRecordingSource* other) { 31 const DisplayListRecordingSource* other,
36 return make_scoped_refptr(new DisplayListRasterSource(other)); 32 bool can_use_lcd_text) {
33 return make_scoped_refptr(
34 new DisplayListRasterSource(other, can_use_lcd_text));
37 } 35 }
38 36
39 DisplayListRasterSource::DisplayListRasterSource() 37 DisplayListRasterSource::DisplayListRasterSource()
40 : background_color_(SK_ColorTRANSPARENT), 38 : background_color_(SK_ColorTRANSPARENT),
41 requires_clear_(true), 39 requires_clear_(true),
42 can_use_lcd_text_(true), 40 can_use_lcd_text_(true),
43 is_solid_color_(false), 41 is_solid_color_(false),
44 solid_color_(SK_ColorTRANSPARENT), 42 solid_color_(SK_ColorTRANSPARENT),
45 clear_canvas_with_debug_color_(kDefaultClearCanvasSetting), 43 clear_canvas_with_debug_color_(kDefaultClearCanvasSetting),
46 slow_down_raster_scale_factor_for_debug_(0), 44 slow_down_raster_scale_factor_for_debug_(0),
47 should_attempt_to_use_distance_field_text_(false) { 45 should_attempt_to_use_distance_field_text_(false) {
48 } 46 }
49 47
50 DisplayListRasterSource::DisplayListRasterSource( 48 DisplayListRasterSource::DisplayListRasterSource(
51 const DisplayListRecordingSource* other) 49 const DisplayListRecordingSource* other,
50 bool can_use_lcd_text)
52 : display_list_(other->display_list_), 51 : display_list_(other->display_list_),
53 background_color_(other->background_color_), 52 background_color_(other->background_color_),
54 requires_clear_(other->requires_clear_), 53 requires_clear_(other->requires_clear_),
55 can_use_lcd_text_(other->can_use_lcd_text_), 54 can_use_lcd_text_(can_use_lcd_text),
56 is_solid_color_(other->is_solid_color_), 55 is_solid_color_(other->is_solid_color_),
57 solid_color_(other->solid_color_), 56 solid_color_(other->solid_color_),
58 recorded_viewport_(other->recorded_viewport_), 57 recorded_viewport_(other->recorded_viewport_),
59 size_(other->size_), 58 size_(other->size_),
60 clear_canvas_with_debug_color_(kDefaultClearCanvasSetting), 59 clear_canvas_with_debug_color_(kDefaultClearCanvasSetting),
61 slow_down_raster_scale_factor_for_debug_( 60 slow_down_raster_scale_factor_for_debug_(
62 other->slow_down_raster_scale_factor_for_debug_), 61 other->slow_down_raster_scale_factor_for_debug_),
63 should_attempt_to_use_distance_field_text_(false) { 62 should_attempt_to_use_distance_field_text_(false) {
64 } 63 }
65 64
65 DisplayListRasterSource::DisplayListRasterSource(
66 const DisplayListRasterSource* other,
67 bool can_use_lcd_text)
68 : display_list_(other->display_list_),
69 background_color_(other->background_color_),
70 requires_clear_(other->requires_clear_),
71 can_use_lcd_text_(can_use_lcd_text),
72 is_solid_color_(other->is_solid_color_),
73 solid_color_(other->solid_color_),
74 recorded_viewport_(other->recorded_viewport_),
75 size_(other->size_),
76 clear_canvas_with_debug_color_(kDefaultClearCanvasSetting),
77 slow_down_raster_scale_factor_for_debug_(
78 other->slow_down_raster_scale_factor_for_debug_),
79 should_attempt_to_use_distance_field_text_(
80 other->should_attempt_to_use_distance_field_text_) {
81 }
82
66 DisplayListRasterSource::~DisplayListRasterSource() { 83 DisplayListRasterSource::~DisplayListRasterSource() {
67 } 84 }
68 85
69 void DisplayListRasterSource::PlaybackToSharedCanvas( 86 void DisplayListRasterSource::PlaybackToSharedCanvas(
70 SkCanvas* canvas, 87 SkCanvas* canvas,
71 const gfx::Rect& canvas_rect, 88 const gfx::Rect& canvas_rect,
72 float contents_scale) const { 89 float contents_scale) const {
73 RasterCommon(canvas, NULL, canvas_rect, contents_scale, false); 90 RasterCommon(canvas, NULL, canvas_rect, contents_scale, false);
74 } 91 }
75 92
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 207
191 void DisplayListRasterSource::DidBeginTracing() { 208 void DisplayListRasterSource::DidBeginTracing() {
192 if (display_list_.get()) 209 if (display_list_.get())
193 display_list_->EmitTraceSnapshot(); 210 display_list_->EmitTraceSnapshot();
194 } 211 }
195 212
196 bool DisplayListRasterSource::CanUseLCDText() const { 213 bool DisplayListRasterSource::CanUseLCDText() const {
197 return can_use_lcd_text_; 214 return can_use_lcd_text_;
198 } 215 }
199 216
217 scoped_refptr<RasterSource> DisplayListRasterSource::CreateCloneWithoutLCDText()
218 const {
219 bool can_use_lcd_text = false;
220 return scoped_refptr<RasterSource>(
221 new DisplayListRasterSource(this, can_use_lcd_text));
222 }
223
200 } // namespace cc 224 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/display_list_raster_source.h ('k') | cc/resources/display_list_recording_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698