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

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

Issue 951673002: Revert "Pull chromium at 2c3ffb2355a27c32f45e508ef861416b820c823b" (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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/picture_pile_impl.h ('k') | cc/resources/picture_pile_unittest.cc » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 <algorithm> 5 #include <algorithm>
6 #include <limits> 6 #include <limits>
7 #include <set> 7 #include <set>
8 8
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "cc/base/region.h" 10 #include "cc/base/region.h"
11 #include "cc/debug/debug_colors.h" 11 #include "cc/debug/debug_colors.h"
12 #include "cc/resources/picture_pile_impl.h" 12 #include "cc/resources/picture_pile_impl.h"
13 #include "cc/resources/raster_source_helper.h" 13 #include "cc/resources/raster_source_helper.h"
14 #include "skia/ext/analysis_canvas.h" 14 #include "skia/ext/analysis_canvas.h"
15 #include "third_party/skia/include/core/SkCanvas.h" 15 #include "third_party/skia/include/core/SkCanvas.h"
16 #include "third_party/skia/include/core/SkPictureRecorder.h" 16 #include "third_party/skia/include/core/SkPictureRecorder.h"
17 #include "ui/gfx/geometry/rect_conversions.h" 17 #include "ui/gfx/geometry/rect_conversions.h"
18 18
19 namespace cc { 19 namespace cc {
20 20
21 scoped_refptr<PicturePileImpl> PicturePileImpl::CreateFromPicturePile( 21 scoped_refptr<PicturePileImpl> PicturePileImpl::CreateFromPicturePile(
22 const PicturePile* other, 22 const PicturePile* other) {
23 bool can_use_lcd_text) { 23 return make_scoped_refptr(new PicturePileImpl(other));
24 return make_scoped_refptr(new PicturePileImpl(other, can_use_lcd_text));
25 } 24 }
26 25
27 PicturePileImpl::PicturePileImpl() 26 PicturePileImpl::PicturePileImpl()
28 : background_color_(SK_ColorTRANSPARENT), 27 : background_color_(SK_ColorTRANSPARENT),
29 requires_clear_(true), 28 requires_clear_(true),
30 can_use_lcd_text_(true), 29 can_use_lcd_text_(false),
31 is_solid_color_(false), 30 is_solid_color_(false),
32 solid_color_(SK_ColorTRANSPARENT), 31 solid_color_(SK_ColorTRANSPARENT),
33 has_any_recordings_(false), 32 has_any_recordings_(false),
34 clear_canvas_with_debug_color_(false), 33 clear_canvas_with_debug_color_(false),
35 min_contents_scale_(0.f), 34 min_contents_scale_(0.f),
36 slow_down_raster_scale_factor_for_debug_(0), 35 slow_down_raster_scale_factor_for_debug_(0),
37 should_attempt_to_use_distance_field_text_(false) { 36 should_attempt_to_use_distance_field_text_(false) {
38 } 37 }
39 38
40 PicturePileImpl::PicturePileImpl(const PicturePile* other, 39 PicturePileImpl::PicturePileImpl(const PicturePile* other)
41 bool can_use_lcd_text)
42 : picture_map_(other->picture_map_), 40 : picture_map_(other->picture_map_),
43 tiling_(other->tiling_), 41 tiling_(other->tiling_),
44 background_color_(other->background_color_), 42 background_color_(other->background_color_),
45 requires_clear_(other->requires_clear_), 43 requires_clear_(other->requires_clear_),
46 can_use_lcd_text_(can_use_lcd_text), 44 can_use_lcd_text_(other->can_use_lcd_text_),
47 is_solid_color_(other->is_solid_color_), 45 is_solid_color_(other->is_solid_color_),
48 solid_color_(other->solid_color_), 46 solid_color_(other->solid_color_),
49 recorded_viewport_(other->recorded_viewport_), 47 recorded_viewport_(other->recorded_viewport_),
50 has_any_recordings_(other->has_any_recordings_), 48 has_any_recordings_(other->has_any_recordings_),
51 clear_canvas_with_debug_color_(other->clear_canvas_with_debug_color_), 49 clear_canvas_with_debug_color_(other->clear_canvas_with_debug_color_),
52 min_contents_scale_(other->min_contents_scale_), 50 min_contents_scale_(other->min_contents_scale_),
53 slow_down_raster_scale_factor_for_debug_( 51 slow_down_raster_scale_factor_for_debug_(
54 other->slow_down_raster_scale_factor_for_debug_), 52 other->slow_down_raster_scale_factor_for_debug_),
55 should_attempt_to_use_distance_field_text_(false) { 53 should_attempt_to_use_distance_field_text_(false) {
56 } 54 }
57 55
58 PicturePileImpl::PicturePileImpl(const PicturePileImpl* other,
59 bool can_use_lcd_text)
60 : picture_map_(other->picture_map_),
61 tiling_(other->tiling_),
62 background_color_(other->background_color_),
63 requires_clear_(other->requires_clear_),
64 can_use_lcd_text_(can_use_lcd_text),
65 is_solid_color_(other->is_solid_color_),
66 solid_color_(other->solid_color_),
67 recorded_viewport_(other->recorded_viewport_),
68 has_any_recordings_(other->has_any_recordings_),
69 clear_canvas_with_debug_color_(other->clear_canvas_with_debug_color_),
70 min_contents_scale_(other->min_contents_scale_),
71 slow_down_raster_scale_factor_for_debug_(
72 other->slow_down_raster_scale_factor_for_debug_),
73 should_attempt_to_use_distance_field_text_(
74 other->should_attempt_to_use_distance_field_text_) {
75 }
76
77 PicturePileImpl::~PicturePileImpl() { 56 PicturePileImpl::~PicturePileImpl() {
78 } 57 }
79 58
80 void PicturePileImpl::PlaybackToSharedCanvas(SkCanvas* canvas, 59 void PicturePileImpl::PlaybackToSharedCanvas(SkCanvas* canvas,
81 const gfx::Rect& canvas_rect, 60 const gfx::Rect& canvas_rect,
82 float contents_scale) const { 61 float contents_scale) const {
83 RasterCommon(canvas, 62 RasterCommon(canvas,
84 NULL, 63 NULL,
85 canvas_rect, 64 canvas_rect,
86 contents_scale, 65 contents_scale,
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 appended_pictures.insert(picture); 376 appended_pictures.insert(picture);
398 TracedValue::AppendIDRef(picture, pictures); 377 TracedValue::AppendIDRef(picture, pictures);
399 } 378 }
400 } 379 }
401 } 380 }
402 381
403 bool PicturePileImpl::CanUseLCDText() const { 382 bool PicturePileImpl::CanUseLCDText() const {
404 return can_use_lcd_text_; 383 return can_use_lcd_text_;
405 } 384 }
406 385
407 scoped_refptr<RasterSource> PicturePileImpl::CreateCloneWithoutLCDText() const {
408 DCHECK(CanUseLCDText());
409 bool can_use_lcd_text = false;
410 return scoped_refptr<RasterSource>(
411 new PicturePileImpl(this, can_use_lcd_text));
412 }
413
414 PicturePileImpl::PixelRefIterator::PixelRefIterator( 386 PicturePileImpl::PixelRefIterator::PixelRefIterator(
415 const gfx::Rect& content_rect, 387 const gfx::Rect& content_rect,
416 float contents_scale, 388 float contents_scale,
417 const PicturePileImpl* picture_pile) 389 const PicturePileImpl* picture_pile)
418 : picture_pile_(picture_pile), 390 : picture_pile_(picture_pile),
419 layer_rect_( 391 layer_rect_(
420 gfx::ScaleToEnclosingRect(content_rect, 1.f / contents_scale)), 392 gfx::ScaleToEnclosingRect(content_rect, 1.f / contents_scale)),
421 tile_iterator_(&picture_pile_->tiling_, 393 tile_iterator_(&picture_pile_->tiling_,
422 layer_rect_, 394 layer_rect_,
423 false /* include_borders */) { 395 false /* include_borders */) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 for (const auto& map_pair : picture_map_) { 438 for (const auto& map_pair : picture_map_) {
467 const Picture* picture = map_pair.second.GetPicture(); 439 const Picture* picture = map_pair.second.GetPicture();
468 if (picture && (processed_pictures.count(picture) == 0)) { 440 if (picture && (processed_pictures.count(picture) == 0)) {
469 picture->EmitTraceSnapshot(); 441 picture->EmitTraceSnapshot();
470 processed_pictures.insert(picture); 442 processed_pictures.insert(picture);
471 } 443 }
472 } 444 }
473 } 445 }
474 446
475 } // namespace cc 447 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_pile_impl.h ('k') | cc/resources/picture_pile_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698