OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "DMSrcSink.h" | 8 #include "DMSrcSink.h" |
9 #include "SkAndroidCodec.h" | 9 #include "SkAndroidCodec.h" |
10 #include "SkCodec.h" | 10 #include "SkCodec.h" |
(...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 buffer.reset(); | 1404 buffer.reset(); |
1405 SkASSERT(mojoPicture.get() && mojoPicture->data); | 1405 SkASSERT(mojoPicture.get() && mojoPicture->data); |
1406 | 1406 |
1407 size_t flatSize = mojoPicture->GetSerializedSize(); | 1407 size_t flatSize = mojoPicture->GetSerializedSize(); |
1408 SkAutoMalloc storage(flatSize); | 1408 SkAutoMalloc storage(flatSize); |
1409 if (!mojoPicture->Serialize(storage.get(), flatSize)) { | 1409 if (!mojoPicture->Serialize(storage.get(), flatSize)) { |
1410 return "SkMojo::FlattenedPicture::Serialize failed"; | 1410 return "SkMojo::FlattenedPicture::Serialize failed"; |
1411 } | 1411 } |
1412 mojoPicture = SkMojo::FlattenedPicture::New(); | 1412 mojoPicture = SkMojo::FlattenedPicture::New(); |
1413 mojoPicture->Deserialize(storage.get()); | 1413 mojoPicture->Deserialize(storage.get()); |
1414 storage.free(); | 1414 storage.reset(); |
1415 if (!mojoPicture) { | 1415 if (!mojoPicture) { |
1416 return "SkMojo::FlattenedPicture::Deserialize failed"; | 1416 return "SkMojo::FlattenedPicture::Deserialize failed"; |
1417 } | 1417 } |
1418 SkMemoryStream tmpStream(mojoPicture->data.data(), | 1418 SkMemoryStream tmpStream(mojoPicture->data.data(), |
1419 mojoPicture->data.size()); | 1419 mojoPicture->data.size()); |
1420 skPicture.reset(SkPicture::CreateFromStream(&tmpStream)); | 1420 skPicture.reset(SkPicture::CreateFromStream(&tmpStream)); |
1421 mojoPicture.reset(); | 1421 mojoPicture.reset(); |
1422 auto fn = [&](SkCanvas* canvas) -> Error { | 1422 auto fn = [&](SkCanvas* canvas) -> Error { |
1423 canvas->drawPicture(skPicture.get()); | 1423 canvas->drawPicture(skPicture.get()); |
1424 return check_against_reference(bitmap, src, fSink); | 1424 return check_against_reference(bitmap, src, fSink); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1495 skr.visit<void>(i, drawsAsSingletonPictures); | 1495 skr.visit<void>(i, drawsAsSingletonPictures); |
1496 } | 1496 } |
1497 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); | 1497 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); |
1498 | 1498 |
1499 canvas->drawPicture(macroPic); | 1499 canvas->drawPicture(macroPic); |
1500 return check_against_reference(bitmap, src, fSink); | 1500 return check_against_reference(bitmap, src, fSink); |
1501 }); | 1501 }); |
1502 } | 1502 } |
1503 | 1503 |
1504 } // namespace DM | 1504 } // namespace DM |
OLD | NEW |