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

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

Issue 1854513002: cc: Add RasterSource::PlaybackSettings for finer control of raster. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/gpu_rasterizer.h ('k') | cc/raster/gpu_tile_task_worker_pool.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 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/raster/gpu_rasterizer.h" 5 #include "cc/raster/gpu_rasterizer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 25 matching lines...) Expand all
36 } 36 }
37 37
38 GpuRasterizer::~GpuRasterizer() { 38 GpuRasterizer::~GpuRasterizer() {
39 } 39 }
40 40
41 void GpuRasterizer::RasterizeSource( 41 void GpuRasterizer::RasterizeSource(
42 ResourceProvider::ScopedWriteLockGr* write_lock, 42 ResourceProvider::ScopedWriteLockGr* write_lock,
43 const RasterSource* raster_source, 43 const RasterSource* raster_source,
44 const gfx::Rect& raster_full_rect, 44 const gfx::Rect& raster_full_rect,
45 const gfx::Rect& playback_rect, 45 const gfx::Rect& playback_rect,
46 float scale) { 46 float scale,
47 const RasterSource::PlaybackSettings& playback_settings) {
47 // Play back raster_source into temp SkPicture. 48 // Play back raster_source into temp SkPicture.
48 SkPictureRecorder recorder; 49 SkPictureRecorder recorder;
49 const gfx::Size size = write_lock->GetResourceSize(); 50 const gfx::Size size = write_lock->GetResourceSize();
50 const int flags = SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag; 51 const int flags = SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag;
51 skia::RefPtr<SkCanvas> canvas = skia::SharePtr( 52 skia::RefPtr<SkCanvas> canvas = skia::SharePtr(
52 recorder.beginRecording(size.width(), size.height(), NULL, flags)); 53 recorder.beginRecording(size.width(), size.height(), NULL, flags));
53 canvas->save(); 54 canvas->save();
54 const bool include_images = true;
55 raster_source->PlaybackToCanvas(canvas.get(), raster_full_rect, playback_rect, 55 raster_source->PlaybackToCanvas(canvas.get(), raster_full_rect, playback_rect,
56 scale, include_images); 56 scale, playback_settings);
57 canvas->restore(); 57 canvas->restore();
58 sk_sp<SkPicture> picture = recorder.finishRecordingAsPicture(); 58 sk_sp<SkPicture> picture = recorder.finishRecordingAsPicture();
59 59
60 // Turn on distance fields for layers that have ever animated. 60 // Turn on distance fields for layers that have ever animated.
61 bool use_distance_field_text = 61 bool use_distance_field_text =
62 use_distance_field_text_ || 62 use_distance_field_text_ ||
63 raster_source->ShouldAttemptToUseDistanceFieldText(); 63 raster_source->ShouldAttemptToUseDistanceFieldText();
64 64
65 // Playback picture into resource. 65 // Playback picture into resource.
66 { 66 {
(...skipping 11 matching lines...) Expand all
78 return; 78 return;
79 79
80 SkMultiPictureDraw multi_picture_draw; 80 SkMultiPictureDraw multi_picture_draw;
81 multi_picture_draw.add(sk_surface->getCanvas(), picture.get()); 81 multi_picture_draw.add(sk_surface->getCanvas(), picture.get());
82 multi_picture_draw.draw(false); 82 multi_picture_draw.draw(false);
83 write_lock->ReleaseSkSurface(); 83 write_lock->ReleaseSkSurface();
84 } 84 }
85 } 85 }
86 86
87 } // namespace cc 87 } // namespace cc
OLDNEW
« no previous file with comments | « cc/raster/gpu_rasterizer.h ('k') | cc/raster/gpu_tile_task_worker_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698