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

Side by Side Diff: src/utils/SkMultiPictureDocument.cpp

Issue 2227673002: std::move(SkTDArray) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-08-08 (Monday) 09:19:06 EDT Created 4 years, 4 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
« no previous file with comments | « src/pdf/SkPDFTypes.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "SkMultiPictureDocument.h" 10 #include "SkMultiPictureDocument.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 bool write(const void*, size_t n) override { 53 bool write(const void*, size_t n) override {
54 fN += n; 54 fN += n;
55 return true; 55 return true;
56 } 56 }
57 size_t bytesWritten() const override { return fN; } 57 size_t bytesWritten() const override { return fN; }
58 size_t fN; 58 size_t fN;
59 }; 59 };
60 60
61 struct Page { 61 struct Page {
62 Page(SkSize s, sk_sp<SkPicture> c) : fSize(s), fContent(std::move(c)) {} 62 Page(SkSize s, sk_sp<SkPicture> c) : fSize(s), fContent(std::move(c)) {}
63 Page(Page&& that) : fSize(that.fSize), fContent(std::move(that.fContent)) {} 63 Page(Page&&) = default;
64 Page(const Page&) = default; 64 Page(const Page&) = default;
65 Page& operator=(const Page&) = default; 65 Page& operator=(const Page&) = default;
66 Page& operator=(Page&& that) { 66 Page& operator=(Page&&) = default;
67 fSize = that.fSize;
68 fContent = std::move(that.fContent);
69 return *this;
70 }
71 SkSize fSize; 67 SkSize fSize;
72 sk_sp<SkPicture> fContent; 68 sk_sp<SkPicture> fContent;
73 }; 69 };
74 70
75 struct MultiPictureDocument final : public SkDocument { 71 struct MultiPictureDocument final : public SkDocument {
76 SkPictureRecorder fPictureRecorder; 72 SkPictureRecorder fPictureRecorder;
77 SkSize fCurrentPageSize; 73 SkSize fCurrentPageSize;
78 std::vector<Page> fPages; 74 std::vector<Page> fPages;
79 MultiPictureDocument(SkWStream* s, void (*d)(SkWStream*, bool)) 75 MultiPictureDocument(SkWStream* s, void (*d)(SkWStream*, bool))
80 : SkDocument(s, d) {} 76 : SkDocument(s, d) {}
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 fPages.clear(); 109 fPages.clear();
114 return good; 110 return good;
115 } 111 }
116 void onAbort() override { fPages.clear(); } 112 void onAbort() override { fPages.clear(); }
117 }; 113 };
118 } 114 }
119 115
120 sk_sp<SkDocument> SkMakeMultiPictureDocument(SkWStream* wStream) { 116 sk_sp<SkDocument> SkMakeMultiPictureDocument(SkWStream* wStream) {
121 return sk_make_sp<MultiPictureDocument>(wStream, nullptr); 117 return sk_make_sp<MultiPictureDocument>(wStream, nullptr);
122 } 118 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFTypes.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698