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

Side by Side Diff: cc/playback/discardable_image_map.cc

Issue 2476113002: Change call-sites now that SkCanvas is not ref-counted (Closed)
Patch Set: try fixing win again Created 4 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
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/playback/discardable_image_map.h" 5 #include "cc/playback/discardable_image_map.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
11 11
12 #include "base/containers/adapters.h" 12 #include "base/containers/adapters.h"
13 #include "base/memory/ptr_util.h"
13 #include "cc/base/math_util.h" 14 #include "cc/base/math_util.h"
14 #include "cc/playback/display_item_list.h" 15 #include "cc/playback/display_item_list.h"
15 #include "third_party/skia/include/utils/SkNWayCanvas.h" 16 #include "third_party/skia/include/utils/SkNWayCanvas.h"
16 #include "ui/gfx/geometry/rect_conversions.h" 17 #include "ui/gfx/geometry/rect_conversions.h"
17 #include "ui/gfx/skia_util.h" 18 #include "ui/gfx/skia_util.h"
18 19
19 namespace cc { 20 namespace cc {
20 21
21 SkRect MapRect(const SkMatrix& matrix, const SkRect& src) { 22 SkRect MapRect(const SkMatrix& matrix, const SkRect& src) {
22 SkRect dst; 23 SkRect dst;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 const gfx::Size canvas_size_; 183 const gfx::Size canvas_size_;
183 std::vector<SkPaint> saved_paints_; 184 std::vector<SkPaint> saved_paints_;
184 }; 185 };
185 186
186 } // namespace 187 } // namespace
187 188
188 DiscardableImageMap::DiscardableImageMap() {} 189 DiscardableImageMap::DiscardableImageMap() {}
189 190
190 DiscardableImageMap::~DiscardableImageMap() {} 191 DiscardableImageMap::~DiscardableImageMap() {}
191 192
192 sk_sp<SkCanvas> DiscardableImageMap::BeginGeneratingMetadata( 193 std::unique_ptr<SkCanvas> DiscardableImageMap::BeginGeneratingMetadata(
193 const gfx::Size& bounds) { 194 const gfx::Size& bounds) {
194 DCHECK(all_images_.empty()); 195 DCHECK(all_images_.empty());
195 return sk_make_sp<DiscardableImagesMetadataCanvas>( 196 return base::MakeUnique<DiscardableImagesMetadataCanvas>(
196 bounds.width(), bounds.height(), &all_images_); 197 bounds.width(), bounds.height(), &all_images_);
197 } 198 }
198 199
199 void DiscardableImageMap::EndGeneratingMetadata() { 200 void DiscardableImageMap::EndGeneratingMetadata() {
200 images_rtree_.Build(all_images_, 201 images_rtree_.Build(all_images_,
201 [](const std::pair<DrawImage, gfx::Rect>& image) { 202 [](const std::pair<DrawImage, gfx::Rect>& image) {
202 return image.second; 203 return image.second;
203 }); 204 });
204 } 205 }
205 206
(...skipping 11 matching lines...) Expand all
217 DiscardableImageMap* image_map, 218 DiscardableImageMap* image_map,
218 const gfx::Size& bounds) 219 const gfx::Size& bounds)
219 : image_map_(image_map), 220 : image_map_(image_map),
220 metadata_canvas_(image_map->BeginGeneratingMetadata(bounds)) {} 221 metadata_canvas_(image_map->BeginGeneratingMetadata(bounds)) {}
221 222
222 DiscardableImageMap::ScopedMetadataGenerator::~ScopedMetadataGenerator() { 223 DiscardableImageMap::ScopedMetadataGenerator::~ScopedMetadataGenerator() {
223 image_map_->EndGeneratingMetadata(); 224 image_map_->EndGeneratingMetadata();
224 } 225 }
225 226
226 } // namespace cc 227 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698