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

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

Issue 860813002: Remove the default format from ResourcePool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile error in perftest. Created 5 years, 11 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
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/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/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 53
54 PrepareTilesMode GpuRasterizer::GetPrepareTilesMode() { 54 PrepareTilesMode GpuRasterizer::GetPrepareTilesMode() {
55 return tile_prepare_enabled_ ? PrepareTilesMode::PREPARE_PRIORITIZED_TILES 55 return tile_prepare_enabled_ ? PrepareTilesMode::PREPARE_PRIORITIZED_TILES
56 : PrepareTilesMode::PREPARE_NONE; 56 : PrepareTilesMode::PREPARE_NONE;
57 } 57 }
58 58
59 void GpuRasterizer::RasterizeTiles( 59 void GpuRasterizer::RasterizeTiles(
60 const TileVector& tiles, 60 const TileVector& tiles,
61 ResourcePool* resource_pool, 61 ResourcePool* resource_pool,
62 ResourceFormat resource_format,
62 const UpdateTileDrawInfoCallback& update_tile_draw_info) { 63 const UpdateTileDrawInfoCallback& update_tile_draw_info) {
63 ScopedGpuRaster gpu_raster(context_provider_); 64 ScopedGpuRaster gpu_raster(context_provider_);
64 65
65 ScopedResourceWriteLocks locks; 66 ScopedResourceWriteLocks locks;
66 67
67 for (Tile* tile : tiles) { 68 for (Tile* tile : tiles) {
68 // TODO(hendrikw): Don't create resources for solid color tiles. 69 // TODO(hendrikw): Don't create resources for solid color tiles.
69 // See crbug.com/445919 70 // See crbug.com/445919
70 scoped_ptr<ScopedResource> resource = 71 scoped_ptr<ScopedResource> resource =
71 resource_pool->AcquireResource(tile->desired_texture_size(), 72 resource_pool->AcquireResource(tile->desired_texture_size(),
72 resource_pool->default_format()); 73 resource_format);
73 const ScopedResource* const_resource = resource.get(); 74 const ScopedResource* const_resource = resource.get();
74 75
75 RasterSource::SolidColorAnalysis analysis; 76 RasterSource::SolidColorAnalysis analysis;
76 77
77 if (tile->use_picture_analysis()) 78 if (tile->use_picture_analysis())
78 PerformSolidColorAnalysis(tile, &analysis); 79 PerformSolidColorAnalysis(tile, &analysis);
79 80
80 if (!analysis.is_solid_color) 81 if (!analysis.is_solid_color)
81 AddToMultiPictureDraw(tile, const_resource, &locks); 82 AddToMultiPictureDraw(tile, const_resource, &locks);
82 83
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 tile->raster_source()->PlaybackToCanvas(canvas.get(), tile->content_rect(), 141 tile->raster_source()->PlaybackToCanvas(canvas.get(), tile->content_rect(),
141 tile->contents_scale()); 142 tile->contents_scale());
142 canvas->restore(); 143 canvas->restore();
143 144
144 // Add the canvas and recorded picture to |multi_picture_draw_|. 145 // Add the canvas and recorded picture to |multi_picture_draw_|.
145 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); 146 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording());
146 multi_picture_draw_.add(sk_surface->getCanvas(), picture.get()); 147 multi_picture_draw_.add(sk_surface->getCanvas(), picture.get());
147 } 148 }
148 149
149 } // namespace cc 150 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698