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

Side by Side Diff: cc/raster/raster_source.cc

Issue 2849953004: SV Test
Patch Set: Created 3 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/raster/raster_source.h ('k') | cc/tiles/tile_manager.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 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/raster/raster_source.h" 5 #include "cc/raster/raster_source.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 !raster_bounds.intersect(gfx::RectToSkIRect(canvas_playback_rect))) 73 !raster_bounds.intersect(gfx::RectToSkIRect(canvas_playback_rect)))
74 return; 74 return;
75 // Treat all subnormal values as zero for performance. 75 // Treat all subnormal values as zero for performance.
76 ScopedSubnormalFloatDisabler disabler; 76 ScopedSubnormalFloatDisabler disabler;
77 77
78 raster_canvas->save(); 78 raster_canvas->save();
79 raster_canvas->translate(-canvas_bitmap_rect.x(), -canvas_bitmap_rect.y()); 79 raster_canvas->translate(-canvas_bitmap_rect.x(), -canvas_bitmap_rect.y());
80 raster_canvas->clipRect(SkRect::MakeFromIRect(raster_bounds)); 80 raster_canvas->clipRect(SkRect::MakeFromIRect(raster_bounds));
81 raster_canvas->translate(raster_transform.translation().x(), 81 raster_canvas->translate(raster_transform.translation().x(),
82 raster_transform.translation().y()); 82 raster_transform.translation().y());
83 raster_canvas->scale(raster_transform.scale(), raster_transform.scale()); 83 // raster_canvas->scale(raster_transform.scale(), raster_transform.scale());
84 PlaybackToCanvas(raster_canvas, target_color_space, settings); 84 PlaybackToCanvas(raster_canvas, target_color_space, settings);
85 raster_canvas->restore(); 85 raster_canvas->restore();
86 } 86 }
87 87
88 void RasterSource::PlaybackToCanvas(SkCanvas* input_canvas, 88 void RasterSource::PlaybackToCanvas(SkCanvas* input_canvas,
89 const gfx::ColorSpace& target_color_space, 89 const gfx::ColorSpace& target_color_space,
90 const PlaybackSettings& settings) const { 90 const PlaybackSettings& settings) const {
91 SkCanvas* raster_canvas = input_canvas; 91 SkCanvas* raster_canvas = input_canvas;
92 std::unique_ptr<SkCanvas> color_transform_canvas; 92 std::unique_ptr<SkCanvas> color_transform_canvas;
93 if (target_color_space.IsValid()) { 93 if (target_color_space.IsValid()) {
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 return recorder.finishRecordingAsPicture(); 231 return recorder.finishRecordingAsPicture();
232 } 232 }
233 233
234 size_t RasterSource::GetMemoryUsage() const { 234 size_t RasterSource::GetMemoryUsage() const {
235 if (!display_list_) 235 if (!display_list_)
236 return 0; 236 return 0;
237 return display_list_->ApproximateMemoryUsage() + 237 return display_list_->ApproximateMemoryUsage() +
238 painter_reported_memory_usage_; 238 painter_reported_memory_usage_;
239 } 239 }
240 240
241 bool RasterSource::PerformSolidColorAnalysis(const gfx::Rect& content_rect, 241 bool RasterSource::PerformSolidColorAnalysis(gfx::Rect content_rect,
242 float contents_scale, 242 float contents_scale,
243 SkColor* color) const { 243 SkColor* color) const {
244 TRACE_EVENT0("cc", "RasterSource::PerformSolidColorAnalysis"); 244 TRACE_EVENT0("cc", "RasterSource::PerformSolidColorAnalysis");
245 245
246 gfx::Rect layer_rect = 246 content_rect.Intersect(
247 gfx::ScaleToEnclosingRect(content_rect, 1.f / contents_scale); 247 gfx::ScaleToEnclosingRect(gfx::Rect(size_), contents_scale));
248 248 skia::AnalysisCanvas canvas(content_rect.width(), content_rect.height());
249 layer_rect.Intersect(gfx::Rect(size_)); 249 canvas.translate(-content_rect.x(), -content_rect.y());
250 skia::AnalysisCanvas canvas(layer_rect.width(), layer_rect.height());
251 canvas.translate(-layer_rect.x(), -layer_rect.y());
252 // Note that because no color conversion is applied to solid color analysis, 250 // Note that because no color conversion is applied to solid color analysis,
253 // the resulting solid color will be known to be sRGB. 251 // the resulting solid color will be known to be sRGB.
254 RasterCommon(&canvas, &canvas); 252 RasterCommon(&canvas, &canvas);
255 return canvas.GetColorIfSolid(color); 253 return canvas.GetColorIfSolid(color);
256 } 254 }
257 255
258 void RasterSource::GetDiscardableImagesInRect( 256 void RasterSource::GetDiscardableImagesInRect(
259 const gfx::Rect& layer_rect, 257 const gfx::Rect& layer_rect,
260 float contents_scale, 258 float contents_scale,
261 const gfx::ColorSpace& target_color_space, 259 const gfx::ColorSpace& target_color_space,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 use_image_hijack_canvas(true) {} 323 use_image_hijack_canvas(true) {}
326 324
327 RasterSource::PlaybackSettings::PlaybackSettings(const PlaybackSettings&) = 325 RasterSource::PlaybackSettings::PlaybackSettings(const PlaybackSettings&) =
328 default; 326 default;
329 327
330 RasterSource::PlaybackSettings::PlaybackSettings(PlaybackSettings&&) = default; 328 RasterSource::PlaybackSettings::PlaybackSettings(PlaybackSettings&&) = default;
331 329
332 RasterSource::PlaybackSettings::~PlaybackSettings() = default; 330 RasterSource::PlaybackSettings::~PlaybackSettings() = default;
333 331
334 } // namespace cc 332 } // namespace cc
OLDNEW
« no previous file with comments | « cc/raster/raster_source.h ('k') | cc/tiles/tile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698