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

Side by Side Diff: src/core/SkWriteBuffer.cpp

Issue 2212493002: Convert SkAutoTUnref<SkData> to sk_sp<SkData>. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/core/SkPictureRecord.cpp ('k') | src/gpu/SkGr.cpp » ('j') | 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 2012 Google Inc. 2 * Copyright 2012 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 "SkWriteBuffer.h" 8 #include "SkWriteBuffer.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 } 169 }
170 170
171 this->writeUInt(0); // signal raw pixels 171 this->writeUInt(0); // signal raw pixels
172 SkBitmap::WriteRawPixels(this, bitmap); 172 SkBitmap::WriteRawPixels(this, bitmap);
173 } 173 }
174 174
175 void SkBinaryWriteBuffer::writeImage(const SkImage* image) { 175 void SkBinaryWriteBuffer::writeImage(const SkImage* image) {
176 this->writeInt(image->width()); 176 this->writeInt(image->width());
177 this->writeInt(image->height()); 177 this->writeInt(image->height());
178 178
179 SkAutoTUnref<SkData> encoded(image->encode(this->getPixelSerializer())); 179 sk_sp<SkData> encoded(image->encode(this->getPixelSerializer()));
180 if (encoded && encoded->size() > 0) { 180 if (encoded && encoded->size() > 0) {
181 write_encoded_bitmap(this, encoded, SkIPoint::Make(0, 0)); 181 write_encoded_bitmap(this, encoded.get(), SkIPoint::Make(0, 0));
182 return; 182 return;
183 } 183 }
184 184
185 SkBitmap bm; 185 SkBitmap bm;
186 if (image->asLegacyBitmap(&bm, SkImage::kRO_LegacyBitmapMode)) { 186 if (image->asLegacyBitmap(&bm, SkImage::kRO_LegacyBitmapMode)) {
187 this->writeUInt(1); // signal raw pixels. 187 this->writeUInt(1); // signal raw pixels.
188 SkBitmap::WriteRawPixels(this, bm); 188 SkBitmap::WriteRawPixels(this, bm);
189 return; 189 return;
190 } 190 }
191 191
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 // make room for the size of the flattened object 275 // make room for the size of the flattened object
276 (void)fWriter.reserve(sizeof(uint32_t)); 276 (void)fWriter.reserve(sizeof(uint32_t));
277 // record the current size, so we can subtract after the object writes. 277 // record the current size, so we can subtract after the object writes.
278 size_t offset = fWriter.bytesWritten(); 278 size_t offset = fWriter.bytesWritten();
279 // now flatten the object 279 // now flatten the object
280 flattenable->flatten(*this); 280 flattenable->flatten(*this);
281 size_t objSize = fWriter.bytesWritten() - offset; 281 size_t objSize = fWriter.bytesWritten() - offset;
282 // record the obj's size 282 // record the obj's size
283 fWriter.overwriteTAt(offset - sizeof(uint32_t), SkToU32(objSize)); 283 fWriter.overwriteTAt(offset - sizeof(uint32_t), SkToU32(objSize));
284 } 284 }
OLDNEW
« no previous file with comments | « src/core/SkPictureRecord.cpp ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698