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

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

Issue 737943002: Update from https://crrev.com/304715 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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/layers/picture_layer_unittest.cc ('k') | cc/resources/picture.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/resources/gpu_raster_worker_pool.h" 5 #include "cc/resources/gpu_raster_worker_pool.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "cc/output/context_provider.h" 10 #include "cc/output/context_provider.h"
(...skipping 23 matching lines...) Expand all
34 use_distance_field_text_(use_distance_field_text) {} 34 use_distance_field_text_(use_distance_field_text) {}
35 35
36 // Overridden from RasterBuffer: 36 // Overridden from RasterBuffer:
37 void Playback(const RasterSource* raster_source, 37 void Playback(const RasterSource* raster_source,
38 const gfx::Rect& rect, 38 const gfx::Rect& rect,
39 float scale) override { 39 float scale) override {
40 // Turn on distance fields for layers that have ever animated. 40 // Turn on distance fields for layers that have ever animated.
41 bool use_distance_field_text = 41 bool use_distance_field_text =
42 use_distance_field_text_ || 42 use_distance_field_text_ ||
43 raster_source->ShouldAttemptToUseDistanceFieldText(); 43 raster_source->ShouldAttemptToUseDistanceFieldText();
44 SkSurface* sk_surface = lock_.GetSkSurface(use_distance_field_text); 44 SkSurface* sk_surface = lock_.GetSkSurface(use_distance_field_text,
45 raster_source->CanUseLCDText());
45 46
46 if (!sk_surface) 47 if (!sk_surface)
47 return; 48 return;
48 49
49 SkPictureRecorder recorder; 50 SkPictureRecorder recorder;
50 gfx::Size size = resource_->size(); 51 gfx::Size size = resource_->size();
52 const int flags = SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag;
51 skia::RefPtr<SkCanvas> canvas = 53 skia::RefPtr<SkCanvas> canvas =
52 skia::SharePtr(recorder.beginRecording(size.width(), size.height())); 54 skia::SharePtr(recorder.beginRecording(size.width(), size.height(),
55 NULL, flags));
56
53 57
54 canvas->save(); 58 canvas->save();
55 raster_source->PlaybackToCanvas(canvas.get(), rect, scale); 59 raster_source->PlaybackToCanvas(canvas.get(), rect, scale);
56 canvas->restore(); 60 canvas->restore();
57 61
58 // Add the canvas and recorded picture to |multi_picture_draw_|. 62 // Add the canvas and recorded picture to |multi_picture_draw_|.
59 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); 63 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording());
60 multi_picture_draw_->add(sk_surface->getCanvas(), picture.get()); 64 multi_picture_draw_->add(sk_surface->getCanvas(), picture.get());
61 } 65 }
62 66
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 247
244 ScopedGpuRaster gpu_raster(context_provider_); 248 ScopedGpuRaster gpu_raster(context_provider_);
245 task_graph_runner_->RunUntilIdle(); 249 task_graph_runner_->RunUntilIdle();
246 250
247 // Draw each all of the pictures that were collected. This will also clear 251 // Draw each all of the pictures that were collected. This will also clear
248 // the pictures and canvases added to |multi_picture_draw_| 252 // the pictures and canvases added to |multi_picture_draw_|
249 multi_picture_draw_.draw(); 253 multi_picture_draw_.draw();
250 } 254 }
251 255
252 } // namespace cc 256 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_unittest.cc ('k') | cc/resources/picture.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698