| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2007 The Android Open Source Project | 2 * Copyright 2007 The Android Open Source Project |
| 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 | 8 |
| 9 #include "SkPictureFlat.h" | 9 #include "SkPictureFlat.h" |
| 10 #include "SkPictureData.h" | 10 #include "SkPictureData.h" |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 // Mimics the old behavior of always accepting the encoded data, and encoding | 458 // Mimics the old behavior of always accepting the encoded data, and encoding |
| 459 // using EncodeBitmap if there was no encoded data. | 459 // using EncodeBitmap if there was no encoded data. |
| 460 class EncodeBitmapSerializer : public SkPixelSerializer { | 460 class EncodeBitmapSerializer : public SkPixelSerializer { |
| 461 public: | 461 public: |
| 462 explicit EncodeBitmapSerializer(SkPicture::EncodeBitmap encoder) | 462 explicit EncodeBitmapSerializer(SkPicture::EncodeBitmap encoder) |
| 463 : fEncoder(encoder) | 463 : fEncoder(encoder) |
| 464 { | 464 { |
| 465 SkASSERT(fEncoder); | 465 SkASSERT(fEncoder); |
| 466 } | 466 } |
| 467 | 467 |
| 468 virtual bool onUseEncodedData(const void*, size_t) SK_OVERRIDE { return true
; } | 468 bool onUseEncodedData(const void*, size_t) SK_OVERRIDE { return true; } |
| 469 | 469 |
| 470 virtual SkData* onEncodePixels(const SkImageInfo& info, void* pixels, | 470 SkData* onEncodePixels(const SkImageInfo& info, const void* pixels, |
| 471 size_t rowBytes) SK_OVERRIDE { | 471 size_t rowBytes) SK_OVERRIDE { |
| 472 // Required by signature of EncodeBitmap. | 472 // Required by signature of EncodeBitmap. |
| 473 size_t unused; | 473 size_t unused; |
| 474 SkBitmap bm; | 474 SkBitmap bm; |
| 475 bm.installPixels(info, pixels, rowBytes); | 475 bm.installPixels(info, pixels, rowBytes); |
| 476 return fEncoder(&unused, bm); | 476 return fEncoder(&unused, bm); |
| 477 } | 477 } |
| 478 | 478 |
| 479 private: | 479 private: |
| 480 SkPicture::EncodeBitmap fEncoder; | 480 SkPicture::EncodeBitmap fEncoder; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 | 532 |
| 533 SkPicture::SkPicture(const SkRect& cullRect, SkRecord* record, SnapshotArray* dr
awablePicts, | 533 SkPicture::SkPicture(const SkRect& cullRect, SkRecord* record, SnapshotArray* dr
awablePicts, |
| 534 SkBBoxHierarchy* bbh) | 534 SkBBoxHierarchy* bbh) |
| 535 : fUniqueID(next_picture_generation_id()) | 535 : fUniqueID(next_picture_generation_id()) |
| 536 , fCullRect(cullRect) | 536 , fCullRect(cullRect) |
| 537 , fRecord(SkRef(record)) | 537 , fRecord(SkRef(record)) |
| 538 , fBBH(SkSafeRef(bbh)) | 538 , fBBH(SkSafeRef(bbh)) |
| 539 , fDrawablePicts(drawablePicts) // take ownership | 539 , fDrawablePicts(drawablePicts) // take ownership |
| 540 , fAnalysis(*fRecord) | 540 , fAnalysis(*fRecord) |
| 541 {} | 541 {} |
| OLD | NEW |