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

Side by Side Diff: cc/test/picture_cache_model.cc

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 4 years 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/test/picture_cache_model.h ('k') | cc/test/skia_common.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/test/picture_cache_model.h" 5 #include "cc/test/picture_cache_model.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "third_party/skia/include/core/SkData.h" 8 #include "third_party/skia/include/core/SkData.h"
9 #include "third_party/skia/include/core/SkPicture.h" 9 #include "skia/ext/cdl_picture.h"
10 #include "third_party/skia/include/core/SkRefCnt.h" 10 #include "third_party/skia/include/core/SkRefCnt.h"
11 11
12 class SkPixelSerializer; 12 class SkPixelSerializer;
13 13
14 namespace cc { 14 namespace cc {
15 namespace { 15 namespace {
16 16
17 /*
17 sk_sp<SkPicture> CopySkPicture(const SkPicture* picture) { 18 sk_sp<SkPicture> CopySkPicture(const SkPicture* picture) {
18 sk_sp<SkData> data = picture->serialize(); 19 sk_sp<SkData> data = picture->serialize();
19 DCHECK_GT(data->size(), 0u); 20 DCHECK_GT(data->size(), 0u);
20 return SkPicture::MakeFromData(data.get()); 21 return SkPicture::MakeFromData(data.get());
21 } 22 }
23 */
22 24
23 } // namespace 25 } // namespace
24 26
25 PictureCacheModel::PictureCacheModel() = default; 27 PictureCacheModel::PictureCacheModel() = default;
26 28
27 PictureCacheModel::~PictureCacheModel() = default; 29 PictureCacheModel::~PictureCacheModel() = default;
28 30
29 void PictureCacheModel::AddPicture(const SkPicture* picture) { 31 void PictureCacheModel::AddPicture(const CdlPicture* picture) {
30 sk_sp<SkPicture> picture_copy = CopySkPicture(picture); 32 // sk_sp<CdlPicture> picture_copy = CopySkPicture(picture);
31 pictures_.insert(std::make_pair(picture->uniqueID(), picture_copy)); 33 // TODO(cdl): CopyCdlPicture
34 sk_sp<const CdlPicture> picture_copy = sk_ref_sp(picture);
35 pictures_.insert(std::make_pair(picture_copy->uniqueID(), picture_copy));
32 } 36 }
33 37
34 sk_sp<const SkPicture> PictureCacheModel::GetPicture(uint32_t unique_id) { 38 sk_sp<const CdlPicture> PictureCacheModel::GetPicture(uint32_t unique_id) {
35 if (pictures_.find(unique_id) == pictures_.end()) 39 if (pictures_.find(unique_id) == pictures_.end())
36 return nullptr; 40 return nullptr;
37 41
38 return pictures_.find(unique_id)->second; 42 return pictures_.find(unique_id)->second;
39 } 43 }
40 44
41 } // namespace cc 45 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/picture_cache_model.h ('k') | cc/test/skia_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698