OLD | NEW |
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 |
10 #include "SkPictureFlat.h" | 10 #include "SkPictureFlat.h" |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 } | 294 } |
295 | 295 |
296 // do this at the end, so that they will be zero if we hit an error. | 296 // do this at the end, so that they will be zero if we hit an error. |
297 fWidth = info.fWidth; | 297 fWidth = info.fWidth; |
298 fHeight = info.fHeight; | 298 fHeight = info.fHeight; |
299 if (success) { | 299 if (success) { |
300 *success = true; | 300 *success = true; |
301 } | 301 } |
302 } | 302 } |
303 | 303 |
| 304 #define PREVENT_CHROME_BREAKAGE |
| 305 #ifdef PREVENT_CHROME_BREAKAGE |
| 306 // This block of code is to allow chromium to build until https://codereview.chr
omium.org/15496006/ |
| 307 // is submitted. Then it will be reverted. |
| 308 #include "SkThread.h" |
| 309 |
| 310 static SkPicture::OldEncodeBitmap gOldEncodeBitmapFunction; |
| 311 |
| 312 SK_DECLARE_STATIC_MUTEX(gEncodeFunctionMutex); |
| 313 |
| 314 static SkData* encode_from_old_encoder(size_t* pixelRefOffset, const SkBitmap& b
m) { |
| 315 SkASSERT(gOldEncodeBitmapFunction != NULL); |
| 316 SkDynamicMemoryWStream stream; |
| 317 if (!gOldEncodeBitmapFunction(&stream, bm)) { |
| 318 return NULL; |
| 319 } |
| 320 return stream.copyToData(); |
| 321 } |
| 322 |
| 323 void SkPicture::serialize(SkWStream* stream, OldEncodeBitmap oldEncoder) const { |
| 324 SkAutoMutexAcquire ac(gEncodeFunctionMutex); |
| 325 gOldEncodeBitmapFunction = oldEncoder; |
| 326 this->serialize(stream, &encode_from_old_encoder); |
| 327 gOldEncodeBitmapFunction = NULL; |
| 328 } |
| 329 |
| 330 #endif // PREVENT_CHROME_BREAKAGE |
| 331 |
304 void SkPicture::serialize(SkWStream* stream, EncodeBitmap encoder) const { | 332 void SkPicture::serialize(SkWStream* stream, EncodeBitmap encoder) const { |
305 SkPicturePlayback* playback = fPlayback; | 333 SkPicturePlayback* playback = fPlayback; |
306 | 334 |
307 if (NULL == playback && fRecord) { | 335 if (NULL == playback && fRecord) { |
308 playback = SkNEW_ARGS(SkPicturePlayback, (*fRecord)); | 336 playback = SkNEW_ARGS(SkPicturePlayback, (*fRecord)); |
309 } | 337 } |
310 | 338 |
311 SkPictInfo info; | 339 SkPictInfo info; |
312 | 340 |
313 info.fVersion = PICTURE_VERSION; | 341 info.fVersion = PICTURE_VERSION; |
(...skipping 21 matching lines...) Expand all Loading... |
335 } | 363 } |
336 | 364 |
337 #ifdef SK_BUILD_FOR_ANDROID | 365 #ifdef SK_BUILD_FOR_ANDROID |
338 void SkPicture::abortPlayback() { | 366 void SkPicture::abortPlayback() { |
339 if (NULL == fPlayback) { | 367 if (NULL == fPlayback) { |
340 return; | 368 return; |
341 } | 369 } |
342 fPlayback->abort(); | 370 fPlayback->abort(); |
343 } | 371 } |
344 #endif | 372 #endif |
OLD | NEW |