OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 { | 44 { |
45 } | 45 } |
46 | 46 |
47 DecodingImageGenerator::~DecodingImageGenerator() | 47 DecodingImageGenerator::~DecodingImageGenerator() |
48 { | 48 { |
49 } | 49 } |
50 | 50 |
51 SkData* DecodingImageGenerator::onRefEncodedData() | 51 SkData* DecodingImageGenerator::onRefEncodedData() |
52 { | 52 { |
53 TRACE_EVENT0("blink", "DecodingImageGenerator::refEncodedData"); | 53 TRACE_EVENT0("blink", "DecodingImageGenerator::refEncodedData"); |
54 | 54 return m_frameGenerator->refEncodedData(); |
Noel Gordon
2015/12/08 15:41:58
Space before this line, as done elsewhere in this
aleksandar.stojiljkovic
2015/12/08 20:28:13
Done.
| |
55 // FIXME: If the image has been clipped or scaled, do not return the origina l | |
56 // encoded data, since on playback it will not be known how the clipping/sca ling | |
57 // was done. | |
58 RefPtr<SharedBuffer> buffer = nullptr; | |
59 bool allDataReceived = false; | |
60 m_frameGenerator->copyData(&buffer, &allDataReceived); | |
61 if (buffer && allDataReceived) | |
62 return SkData::NewWithCopy(buffer->data(), buffer->size()); | |
63 return 0; | |
64 } | 55 } |
65 | 56 |
66 bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, | 57 bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, |
67 SkPMColor ctable[], int* ctableCount) | 58 SkPMColor ctable[], int* ctableCount) |
68 { | 59 { |
69 TRACE_EVENT1("blink", "DecodingImageGenerator::getPixels", "frame index", st atic_cast<int>(m_frameIndex)); | 60 TRACE_EVENT1("blink", "DecodingImageGenerator::getPixels", "frame index", st atic_cast<int>(m_frameIndex)); |
70 | 61 |
71 // Implementation doesn't support scaling yet so make sure we're not given a different size. | 62 // Implementation doesn't support scaling yet so make sure we're not given a different size. |
72 if (info.width() != getInfo().width() || info.height() != getInfo().height() ) | 63 if (info.width() != getInfo().width() || info.height() != getInfo().height() ) |
73 return false; | 64 return false; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 const SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.heigh t()); | 115 const SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.heigh t()); |
125 | 116 |
126 RefPtr<ImageFrameGenerator> frame = ImageFrameGenerator::create(SkISize::Mak e(size.width(), size.height()), buffer, true, false); | 117 RefPtr<ImageFrameGenerator> frame = ImageFrameGenerator::create(SkISize::Mak e(size.width(), size.height()), buffer, true, false); |
127 if (!frame) | 118 if (!frame) |
128 return 0; | 119 return 0; |
129 | 120 |
130 return new DecodingImageGenerator(frame, info, 0); | 121 return new DecodingImageGenerator(frame, info, 0); |
131 } | 122 } |
132 | 123 |
133 } // namespace blink | 124 } // namespace blink |
OLD | NEW |