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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
55 // FIXME: If the image has been clipped or scaled, do not return the origina
l | 55 return m_frameGenerator->refEncodedData(); |
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 } | 56 } |
65 | 57 |
66 bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels,
size_t rowBytes, SkPMColor table[], int* tableCount) | 58 bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels,
size_t rowBytes, SkPMColor table[], int* tableCount) |
67 { | 59 { |
68 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)); |
69 | 61 |
70 // 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. |
71 if (info.width() != getInfo().width() || info.height() != getInfo().height()
) | 63 if (info.width() != getInfo().width() || info.height() != getInfo().height()
) |
72 return false; | 64 return false; |
73 | 65 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 const SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.heigh
t()); | 116 const SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.heigh
t()); |
125 | 117 |
126 RefPtr<ImageFrameGenerator> frame = ImageFrameGenerator::create(SkISize::Mak
e(size.width(), size.height()), buffer, true, false); | 118 RefPtr<ImageFrameGenerator> frame = ImageFrameGenerator::create(SkISize::Mak
e(size.width(), size.height()), buffer, true, false); |
127 if (!frame) | 119 if (!frame) |
128 return 0; | 120 return 0; |
129 | 121 |
130 return new DecodingImageGenerator(frame, info, 0); | 122 return new DecodingImageGenerator(frame, info, 0); |
131 } | 123 } |
132 | 124 |
133 } // namespace blink | 125 } // namespace blink |
OLD | NEW |