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

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

Issue 14158015: Allow supporting older PICTURE_VERSIONs. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2007 The Android Open Source Project 3 * Copyright 2007 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9 #include "SkErrorInternals.h"
10 #include "SkPictureFlat.h" 10 #include "SkPictureFlat.h"
11 #include "SkPicturePlayback.h" 11 #include "SkPicturePlayback.h"
12 #include "SkPictureRecord.h" 12 #include "SkPictureRecord.h"
13 13
14 #include "SkCanvas.h" 14 #include "SkCanvas.h"
15 #include "SkChunkAlloc.h" 15 #include "SkChunkAlloc.h"
16 #include "SkDevice.h" 16 #include "SkDevice.h"
17 #include "SkPicture.h" 17 #include "SkPicture.h"
18 #include "SkRegion.h" 18 #include "SkRegion.h"
19 #include "SkStream.h" 19 #include "SkStream.h"
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 if (success) { 276 if (success) {
277 *success = false; 277 *success = false;
278 } 278 }
279 fRecord = NULL; 279 fRecord = NULL;
280 fPlayback = NULL; 280 fPlayback = NULL;
281 fWidth = fHeight = 0; 281 fWidth = fHeight = 0;
282 282
283 SkPictInfo info; 283 SkPictInfo info;
284 284
285 if (!stream->read(&info, sizeof(info))) { 285 if (!stream->read(&info, sizeof(info))) {
286 return; 286 SkErrorInternals::SetError(kParseError_SkError, "Failed to parse skp inf o.");
287 }
288 if (PICTURE_VERSION != info.fVersion) {
289 return; 287 return;
290 } 288 }
291 289
290 if (info.fVersion < 10 || info.fVersion > PICTURE_VERSION) {
scroggo 2013/04/29 19:00:40 This needs to be duplicated in QT/SkDebuggerGUI.cp
291 SkErrorInternals::SetError(kParseError_SkError, "skp version %d not supp orted.",
292 info.fVersion);
293 return;
294 }
295
292 if (stream->readBool()) { 296 if (stream->readBool()) {
293 fPlayback = SkNEW_ARGS(SkPicturePlayback, (stream, info, proc)); 297 fPlayback = SkNEW_ARGS(SkPicturePlayback, (stream, info, proc));
294 } 298 }
295 299
296 // do this at the end, so that they will be zero if we hit an error. 300 // do this at the end, so that they will be zero if we hit an error.
297 fWidth = info.fWidth; 301 fWidth = info.fWidth;
298 fHeight = info.fHeight; 302 fHeight = info.fHeight;
299 if (success) { 303 if (success) {
300 *success = true; 304 *success = true;
301 } 305 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 } 339 }
336 340
337 #ifdef SK_BUILD_FOR_ANDROID 341 #ifdef SK_BUILD_FOR_ANDROID
338 void SkPicture::abortPlayback() { 342 void SkPicture::abortPlayback() {
339 if (NULL == fPlayback) { 343 if (NULL == fPlayback) {
340 return; 344 return;
341 } 345 }
342 fPlayback->abort(); 346 fPlayback->abort();
343 } 347 }
344 #endif 348 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698