OLD | NEW |
---|---|
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/resources/gpu_rasterizer.h" | 5 #include "cc/resources/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 13 matching lines...) Expand all Loading... | |
24 #include "third_party/skia/include/core/SkSurface.h" | 24 #include "third_party/skia/include/core/SkSurface.h" |
25 #include "third_party/skia/include/gpu/GrContext.h" | 25 #include "third_party/skia/include/gpu/GrContext.h" |
26 | 26 |
27 namespace cc { | 27 namespace cc { |
28 | 28 |
29 // static | 29 // static |
30 scoped_ptr<GpuRasterizer> GpuRasterizer::Create( | 30 scoped_ptr<GpuRasterizer> GpuRasterizer::Create( |
31 ContextProvider* context_provider, | 31 ContextProvider* context_provider, |
32 ResourceProvider* resource_provider, | 32 ResourceProvider* resource_provider, |
33 bool use_distance_field_text, | 33 bool use_distance_field_text, |
34 bool tile_prepare_enabled, | 34 bool threaded_gpu_rasterization_enabled, |
35 int msaa_sample_count) { | 35 int msaa_sample_count) { |
36 return make_scoped_ptr<GpuRasterizer>(new GpuRasterizer( | 36 return make_scoped_ptr<GpuRasterizer>(new GpuRasterizer( |
37 context_provider, resource_provider, use_distance_field_text, | 37 context_provider, resource_provider, use_distance_field_text, |
38 tile_prepare_enabled, msaa_sample_count)); | 38 threaded_gpu_rasterization_enabled, msaa_sample_count)); |
39 } | 39 } |
40 | 40 |
41 GpuRasterizer::GpuRasterizer(ContextProvider* context_provider, | 41 GpuRasterizer::GpuRasterizer(ContextProvider* context_provider, |
42 ResourceProvider* resource_provider, | 42 ResourceProvider* resource_provider, |
43 bool use_distance_field_text, | 43 bool use_distance_field_text, |
44 bool tile_prepare_enabled, | 44 bool threaded_gpu_rasterization_enabled, |
45 int msaa_sample_count) | 45 int msaa_sample_count) |
46 : context_provider_(context_provider), | 46 : context_provider_(context_provider), |
47 resource_provider_(resource_provider), | 47 resource_provider_(resource_provider), |
48 use_distance_field_text_(use_distance_field_text), | 48 use_distance_field_text_(use_distance_field_text), |
49 tile_prepare_enabled_(tile_prepare_enabled), | 49 threaded_gpu_rasterization_enabled_(threaded_gpu_rasterization_enabled), |
50 msaa_sample_count_(msaa_sample_count) { | 50 msaa_sample_count_(msaa_sample_count) { |
51 DCHECK(context_provider_); | 51 DCHECK(context_provider_); |
52 } | 52 } |
53 | 53 |
54 GpuRasterizer::~GpuRasterizer() { | 54 GpuRasterizer::~GpuRasterizer() { |
55 } | 55 } |
56 | 56 |
57 PrepareTilesMode GpuRasterizer::GetPrepareTilesMode() { | 57 PrepareTilesMode GpuRasterizer::GetPrepareTilesMode() { |
58 return tile_prepare_enabled_ ? PrepareTilesMode::PREPARE_PRIORITIZED_TILES | 58 return PrepareTilesMode::PREPARE_NONE; |
danakj
2015/02/02 22:04:25
So what's the story with PrepareTilesMode::PREPARE
| |
59 : PrepareTilesMode::PREPARE_NONE; | |
60 } | 59 } |
61 | 60 |
62 void GpuRasterizer::RasterizeTiles( | 61 void GpuRasterizer::RasterizeTiles( |
63 const TileVector& tiles, | 62 const TileVector& tiles, |
64 ResourcePool* resource_pool, | 63 ResourcePool* resource_pool, |
65 ResourceFormat resource_format, | 64 ResourceFormat resource_format, |
66 const UpdateTileDrawInfoCallback& update_tile_draw_info) { | 65 const UpdateTileDrawInfoCallback& update_tile_draw_info) { |
67 ScopedGpuRaster gpu_raster(context_provider_); | 66 ScopedGpuRaster gpu_raster(context_provider_); |
68 | 67 |
69 ScopedResourceWriteLocks locks; | 68 ScopedResourceWriteLocks locks; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 tile->raster_source()->PlaybackToCanvas(canvas.get(), tile->content_rect(), | 140 tile->raster_source()->PlaybackToCanvas(canvas.get(), tile->content_rect(), |
142 tile->contents_scale()); | 141 tile->contents_scale()); |
143 canvas->restore(); | 142 canvas->restore(); |
144 | 143 |
145 // Add the canvas and recorded picture to |multi_picture_draw_|. | 144 // Add the canvas and recorded picture to |multi_picture_draw_|. |
146 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); | 145 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); |
147 multi_picture_draw_.add(sk_surface->getCanvas(), picture.get()); | 146 multi_picture_draw_.add(sk_surface->getCanvas(), picture.get()); |
148 } | 147 } |
149 | 148 |
150 } // namespace cc | 149 } // namespace cc |
OLD | NEW |