 Chromium Code Reviews
 Chromium Code Reviews Issue 1774633002:
  SkPDF Create working move constructor for inner classes  (Closed) 
  Base URL: https://skia.googlesource.com/skia.git@master
    
  
    Issue 1774633002:
  SkPDF Create working move constructor for inner classes  (Closed) 
  Base URL: https://skia.googlesource.com/skia.git@master| OLD | NEW | 
|---|---|
| 1 /* | 1 /* | 
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #ifndef SkPDFDevice_DEFINED | 8 #ifndef SkPDFDevice_DEFINED | 
| 9 #define SkPDFDevice_DEFINED | 9 #define SkPDFDevice_DEFINED | 
| 10 | 10 | 
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 return fLegacyBitmap; | 195 return fLegacyBitmap; | 
| 196 } | 196 } | 
| 197 | 197 | 
| 198 SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) override; | 198 SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) override; | 
| 199 | 199 | 
| 200 void drawAnnotation(const SkDraw&, const SkRect&, const char key[], SkData* value) override; | 200 void drawAnnotation(const SkDraw&, const SkRect&, const char key[], SkData* value) override; | 
| 201 | 201 | 
| 202 private: | 202 private: | 
| 203 struct RectWithData { | 203 struct RectWithData { | 
| 204 SkRect rect; | 204 SkRect rect; | 
| 205 SkData* data; | 205 sk_sp<SkData> data; | 
| 206 RectWithData(const SkRect& rect, SkData* data) | 206 RectWithData(const SkRect& rect, SkData* data) | 
| 207 : rect(rect), data(SkRef(data)) {} | 207 : rect(rect), data(SkRef(data)) {} | 
| 208 ~RectWithData() { data->unref(); } | 208 RectWithData(RectWithData&& other) | 
| 
reed1
2016/03/07 20:47:42
Seems like these are explicitly written (as oppose
 | |
| 209 : rect(other.rect), data(std::move(other.data)) {} | |
| 210 RectWithData& operator=(RectWithData&& other) { | |
| 211 rect = other.rect; | |
| 212 data = std::move(other.data); | |
| 213 return *this; | |
| 214 } | |
| 209 }; | 215 }; | 
| 210 | 216 | 
| 211 struct NamedDestination { | 217 struct NamedDestination { | 
| 212 SkData* nameData; | 218 sk_sp<SkData> nameData; | 
| 213 SkPoint point; | 219 SkPoint point; | 
| 214 NamedDestination(SkData* nameData, const SkPoint& point) | 220 NamedDestination(SkData* nameData, const SkPoint& point) | 
| 215 : nameData(SkRef(nameData)), point(point) {} | 221 : nameData(SkRef(nameData)), point(point) {} | 
| 216 ~NamedDestination() { nameData->unref(); } | 222 NamedDestination(NamedDestination&& other) | 
| 223 : nameData(std::move(other.nameData)), point(other.point) {} | |
| 224 NamedDestination& operator=(NamedDestination&& other) { | |
| 225 nameData = std::move(other.nameData); | |
| 226 point = other.point; | |
| 227 return *this; | |
| 228 } | |
| 217 }; | 229 }; | 
| 218 | 230 | 
| 219 // TODO(vandebo): push most of SkPDFDevice's state into a core object in | 231 // TODO(vandebo): push most of SkPDFDevice's state into a core object in | 
| 220 // order to get the right access levels without using friend. | 232 // order to get the right access levels without using friend. | 
| 221 friend class ScopedContentEntry; | 233 friend class ScopedContentEntry; | 
| 222 | 234 | 
| 223 SkISize fPageSize; | 235 SkISize fPageSize; | 
| 224 SkISize fContentSize; | 236 SkISize fContentSize; | 
| 225 SkMatrix fInitialTransform; | 237 SkMatrix fInitialTransform; | 
| 226 SkClipStack fExistingClipStack; | 238 SkClipStack fExistingClipStack; | 
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 325 | 337 | 
| 326 typedef SkBaseDevice INHERITED; | 338 typedef SkBaseDevice INHERITED; | 
| 327 | 339 | 
| 328 // TODO(edisonn): Only SkDocument_PDF and SkPDFImageShader should be able to create | 340 // TODO(edisonn): Only SkDocument_PDF and SkPDFImageShader should be able to create | 
| 329 // an SkPDFDevice | 341 // an SkPDFDevice | 
| 330 //friend class SkDocument_PDF; | 342 //friend class SkDocument_PDF; | 
| 331 //friend class SkPDFImageShader; | 343 //friend class SkPDFImageShader; | 
| 332 }; | 344 }; | 
| 333 | 345 | 
| 334 #endif | 346 #endif | 
| OLD | NEW |