1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 /*
9 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 *
20 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
21 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
28 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33 #include "include/codec/SkCodecAnimation.h"
34 #include "include/core/SkStream.h"
35 #include "include/private/SkColorData.h"
36 #include "src/codec/SkCodecPriv.h"
37 #include "src/codec/SkColorTable.h"
38 #include "src/codec/SkGifCodec.h"
39 #include "src/codec/SkSwizzler.h"
40 #include "src/core/SkMakeUnique.h"
41
42 #include <algorithm>
43
44 #define GIF87_STAMP "GIF87a"
45 #define GIF89_STAMP "GIF89a"
46 #define GIF_STAMP_LEN 6
47
48 /*
49 * Checks the start of the stream to see if the image is a gif
50 */
IsGif(const void * buf,size_t bytesRead)51 bool SkGifCodec::IsGif(const void* buf, size_t bytesRead) {
52 if (bytesRead >= GIF_STAMP_LEN) {
53 if (memcmp(GIF87_STAMP, buf, GIF_STAMP_LEN) == 0 ||
54 memcmp(GIF89_STAMP, buf, GIF_STAMP_LEN) == 0)
55 {
56 return true;
57 }
58 }
59 return false;
60 }
61
62 /*
63 * Error function
64 */
gif_error(const char * msg,SkCodec::Result result=SkCodec::kInvalidInput)65 static SkCodec::Result gif_error(const char* msg, SkCodec::Result result = SkCodec::kInvalidInput) {
66 SkCodecPrintf("Gif Error: %s\n", msg);
67 return result;
68 }
69
MakeFromStream(std::unique_ptr<SkStream> stream,Result * result)70 std::unique_ptr<SkCodec> SkGifCodec::MakeFromStream(std::unique_ptr<SkStream> stream,
71 Result* result) {
72 std::unique_ptr<SkGifImageReader> reader(new SkGifImageReader(std::move(stream)));
73 *result = reader->parse(SkGifImageReader::SkGIFSizeQuery);
74 if (*result != kSuccess) {
75 return nullptr;
76 }
77
78 // If no images are in the data, or the first header is not yet defined, we cannot
79 // create a codec. In either case, the width and height are not yet known.
80 auto* frame = reader->frameContext(0);
81 if (!frame || !frame->isHeaderDefined()) {
82 *result = kInvalidInput;
83 return nullptr;
84 }
85
86 // isHeaderDefined() will not return true if the screen size is empty.
87 SkASSERT(reader->screenHeight() > 0 && reader->screenWidth() > 0);
88
89 const auto alpha = reader->firstFrameHasAlpha() ? SkEncodedInfo::kBinary_Alpha
90 : SkEncodedInfo::kOpaque_Alpha;
91 // Use kPalette since Gifs are encoded with a color table.
92 // FIXME: Gifs can actually be encoded with 4-bits per pixel. Using 8 works, but we could skip
93 // expanding to 8 bits and take advantage of the SkSwizzler to work from 4.
94 auto encodedInfo = SkEncodedInfo::Make(reader->screenWidth(), reader->screenHeight(),
95 SkEncodedInfo::kPalette_Color, alpha, 8);
96 return std::unique_ptr<SkCodec>(new SkGifCodec(std::move(encodedInfo), reader.release()));
97 }
98
onRewind()99 bool SkGifCodec::onRewind() {
100 fReader->clearDecodeState();
101 return true;
102 }
103
SkGifCodec(SkEncodedInfo && encodedInfo,SkGifImageReader * reader)104 SkGifCodec::SkGifCodec(SkEncodedInfo&& encodedInfo, SkGifImageReader* reader)
105 : INHERITED(std::move(encodedInfo), skcms_PixelFormat_RGBA_8888, nullptr)
106 , fReader(reader)
107 , fTmpBuffer(nullptr)
108 , fSwizzler(nullptr)
109 , fCurrColorTable(nullptr)
110 , fCurrColorTableIsReal(false)
111 , fFilledBackground(false)
112 , fFirstCallToIncrementalDecode(false)
113 , fDst(nullptr)
114 , fDstRowBytes(0)
115 , fRowsDecoded(0)
116 {
117 reader->setClient(this);
118 }
119
onGetFrameCount()120 int SkGifCodec::onGetFrameCount() {
121 fReader->parse(SkGifImageReader::SkGIFFrameCountQuery);
122 return fReader->imagesCount();
123 }
124
onGetFrameInfo(int i,SkCodec::FrameInfo * frameInfo) const125 bool SkGifCodec::onGetFrameInfo(int i, SkCodec::FrameInfo* frameInfo) const {
126 if (i >= fReader->imagesCount()) {
127 return false;
128 }
129
130 const SkGIFFrameContext* frameContext = fReader->frameContext(i);
131 SkASSERT(frameContext->reachedStartOfData());
132
133 if (frameInfo) {
134 frameInfo->fDuration = frameContext->getDuration();
135 frameInfo->fRequiredFrame = frameContext->getRequiredFrame();
136 frameInfo->fFullyReceived = frameContext->isComplete();
137 frameInfo->fAlphaType = frameContext->hasAlpha() ? kUnpremul_SkAlphaType
138 : kOpaque_SkAlphaType;
139 frameInfo->fDisposalMethod = frameContext->getDisposalMethod();
140 }
141 return true;
142 }
143
onGetRepetitionCount()144 int SkGifCodec::onGetRepetitionCount() {
145 fReader->parse(SkGifImageReader::SkGIFLoopCountQuery);
146 return fReader->loopCount();
147 }
148
149 static constexpr SkColorType kXformSrcColorType = kRGBA_8888_SkColorType;
150
initializeColorTable(const SkImageInfo & dstInfo,int frameIndex)151 void SkGifCodec::initializeColorTable(const SkImageInfo& dstInfo, int frameIndex) {
152 SkColorType colorTableColorType = dstInfo.colorType();
153 if (this->colorXform()) {
154 colorTableColorType = kXformSrcColorType;
155 }
156
157 sk_sp<SkColorTable> currColorTable = fReader->getColorTable(colorTableColorType, frameIndex);
158 fCurrColorTableIsReal = static_cast<bool>(currColorTable);
159 if (!fCurrColorTableIsReal) {
160 // This is possible for an empty frame. Create a dummy with one value (transparent).
161 SkPMColor color = SK_ColorTRANSPARENT;
162 fCurrColorTable.reset(new SkColorTable(&color, 1));
163 } else if (this->colorXform() && !this->xformOnDecode()) {
164 SkPMColor dstColors[256];
165 this->applyColorXform(dstColors, currColorTable->readColors(),
166 currColorTable->count());
167 fCurrColorTable.reset(new SkColorTable(dstColors, currColorTable->count()));
168 } else {
169 fCurrColorTable = std::move(currColorTable);
170 }
171 }
172
173
prepareToDecode(const SkImageInfo & dstInfo,const Options & opts)174 SkCodec::Result SkGifCodec::prepareToDecode(const SkImageInfo& dstInfo, const Options& opts) {
175 if (opts.fSubset) {
176 return gif_error("Subsets not supported.\n", kUnimplemented);
177 }
178
179 const int frameIndex = opts.fFrameIndex;
180 if (frameIndex > 0 && kRGB_565_SkColorType == dstInfo.colorType()) {
181 // FIXME: In theory, we might be able to support this, but it's not clear that it
182 // is necessary (Chromium does not decode to 565, and Android does not decode
183 // frames beyond the first). Disabling it because it is somewhat difficult:
184 // - If there is a transparent pixel, and this frame draws on top of another frame
185 // (if the frame is independent with a transparent pixel, we should not decode to
186 // 565 anyway, since it is not opaque), we need to skip drawing the transparent
187 // pixels (see writeTransparentPixels in haveDecodedRow). We currently do this by
188 // first swizzling into temporary memory, then copying into the destination. (We
189 // let the swizzler handle it first because it may need to sample.) After
190 // swizzling to 565, we do not know which pixels in our temporary memory
191 // correspond to the transparent pixel, so we do not know what to skip. We could
192 // special case the non-sampled case (no need to swizzle), but as this is
193 // currently unused we can just not support it.
194 return gif_error("Cannot decode multiframe gif (except frame 0) as 565.\n",
195 kInvalidConversion);
196 }
197
198 const auto* frame = fReader->frameContext(frameIndex);
199 SkASSERT(frame);
200 if (0 == frameIndex) {
201 // SkCodec does not have a way to just parse through frame 0, so we
202 // have to do so manually, here.
203 fReader->parse((SkGifImageReader::SkGIFParseQuery) 0);
204 if (!frame->reachedStartOfData()) {
205 // We have parsed enough to know that there is a color map, but cannot
206 // parse the map itself yet. Exit now, so we do not build an incorrect
207 // table.
208 return gif_error("color map not available yet\n", kIncompleteInput);
209 }
210 } else {
211 // Parsing happened in SkCodec::getPixels.
212 SkASSERT(frameIndex < fReader->imagesCount());
213 SkASSERT(frame->reachedStartOfData());
214 }
215
216 if (this->xformOnDecode()) {
217 fXformBuffer.reset(new uint32_t[dstInfo.width()]);
218 sk_bzero(fXformBuffer.get(), dstInfo.width() * sizeof(uint32_t));
219 }
220
221 fTmpBuffer.reset(new uint8_t[dstInfo.minRowBytes()]);
222
223 this->initializeColorTable(dstInfo, frameIndex);
224 this->initializeSwizzler(dstInfo, frameIndex);
225
226 SkASSERT(fCurrColorTable);
227 return kSuccess;
228 }
229
initializeSwizzler(const SkImageInfo & dstInfo,int frameIndex)230 void SkGifCodec::initializeSwizzler(const SkImageInfo& dstInfo, int frameIndex) {
231 const SkGIFFrameContext* frame = fReader->frameContext(frameIndex);
232 // This is only called by prepareToDecode, which ensures frameIndex is in range.
233 SkASSERT(frame);
234
235 const int xBegin = frame->xOffset();
236 const int xEnd = std::min(frame->frameRect().right(), fReader->screenWidth());
237
238 // CreateSwizzler only reads left and right of the frame. We cannot use the frame's raw
239 // frameRect, since it might extend beyond the edge of the frame.
240 SkIRect swizzleRect = SkIRect::MakeLTRB(xBegin, 0, xEnd, 0);
241
242 SkImageInfo swizzlerInfo = dstInfo;
243 if (this->colorXform()) {
244 swizzlerInfo = swizzlerInfo.makeColorType(kXformSrcColorType);
245 if (kPremul_SkAlphaType == dstInfo.alphaType()) {
246 swizzlerInfo = swizzlerInfo.makeAlphaType(kUnpremul_SkAlphaType);
247 }
248 }
249
250 // The default Options should be fine:
251 // - we'll ignore if the memory is zero initialized - unless we're the first frame, this won't
252 // matter anyway.
253 // - subsets are not supported for gif
254 // - the swizzler does not need to know about the frame.
255 // We may not be able to use the real Options anyway, since getPixels does not store it (due to
256 // a bug).
257 fSwizzler = SkSwizzler::Make(this->getEncodedInfo(), fCurrColorTable->readColors(),
258 swizzlerInfo, Options(), &swizzleRect);
259 SkASSERT(fSwizzler.get());
260 }
261
262 /*
263 * Initiates the gif decode
264 */
onGetPixels(const SkImageInfo & dstInfo,void * pixels,size_t dstRowBytes,const Options & opts,int * rowsDecoded)265 SkCodec::Result SkGifCodec::onGetPixels(const SkImageInfo& dstInfo,
266 void* pixels, size_t dstRowBytes,
267 const Options& opts,
268 int* rowsDecoded) {
269 Result result = this->prepareToDecode(dstInfo, opts);
270 switch (result) {
271 case kSuccess:
272 break;
273 case kIncompleteInput:
274 // onStartIncrementalDecode treats this as incomplete, since it may
275 // provide more data later, but in this case, no more data will be
276 // provided, and there is nothing to draw. We also cannot return
277 // kIncompleteInput, which will make SkCodec attempt to fill
278 // remaining rows, but that requires an SkSwizzler, which we have
279 // not created.
280 return kInvalidInput;
281 default:
282 return result;
283 }
284
285 if (dstInfo.dimensions() != this->dimensions()) {
286 return gif_error("Scaling not supported.\n", kInvalidScale);
287 }
288
289 fDst = pixels;
290 fDstRowBytes = dstRowBytes;
291
292 return this->decodeFrame(true, opts, rowsDecoded);
293 }
294
onStartIncrementalDecode(const SkImageInfo & dstInfo,void * pixels,size_t dstRowBytes,const SkCodec::Options & opts)295 SkCodec::Result SkGifCodec::onStartIncrementalDecode(const SkImageInfo& dstInfo,
296 void* pixels, size_t dstRowBytes,
297 const SkCodec::Options& opts) {
298 Result result = this->prepareToDecode(dstInfo, opts);
299 if (result != kSuccess) {
300 return result;
301 }
302
303 fDst = pixels;
304 fDstRowBytes = dstRowBytes;
305
306 fFirstCallToIncrementalDecode = true;
307
308 return kSuccess;
309 }
310
onIncrementalDecode(int * rowsDecoded)311 SkCodec::Result SkGifCodec::onIncrementalDecode(int* rowsDecoded) {
312 // It is possible the client has appended more data. Parse, if needed.
313 const auto& options = this->options();
314 const int frameIndex = options.fFrameIndex;
315 fReader->parse((SkGifImageReader::SkGIFParseQuery) frameIndex);
316
317 const bool firstCallToIncrementalDecode = fFirstCallToIncrementalDecode;
318 fFirstCallToIncrementalDecode = false;
319 return this->decodeFrame(firstCallToIncrementalDecode, options, rowsDecoded);
320 }
321
decodeFrame(bool firstAttempt,const Options & opts,int * rowsDecoded)322 SkCodec::Result SkGifCodec::decodeFrame(bool firstAttempt, const Options& opts, int* rowsDecoded) {
323 const SkImageInfo& dstInfo = this->dstInfo();
324 const int scaledHeight = get_scaled_dimension(dstInfo.height(), fSwizzler->sampleY());
325
326 const int frameIndex = opts.fFrameIndex;
327 SkASSERT(frameIndex < fReader->imagesCount());
328 const SkGIFFrameContext* frameContext = fReader->frameContext(frameIndex);
329 if (firstAttempt) {
330 // rowsDecoded reports how many rows have been initialized, so a layer above
331 // can fill the rest. In some cases, we fill the background before decoding
332 // (or it is already filled for us), so we report rowsDecoded to be the full
333 // height.
334 bool filledBackground = false;
335 if (frameContext->getRequiredFrame() == kNoFrame) {
336 // We may need to clear to transparent for one of the following reasons:
337 // - The frameRect does not cover the full bounds. haveDecodedRow will
338 // only draw inside the frameRect, so we need to clear the rest.
339 // - The frame is interlaced. There is no obvious way to fill
340 // afterwards for an incomplete image. (FIXME: Does the first pass
341 // cover all rows? If so, we do not have to fill here.)
342 // - There is no color table for this frame. In that case will not
343 // draw anything, so we need to fill.
344 if (frameContext->frameRect() != this->bounds()
345 || frameContext->interlaced() || !fCurrColorTableIsReal) {
346 auto fillInfo = dstInfo.makeWH(fSwizzler->fillWidth(), scaledHeight);
347 SkSampler::Fill(fillInfo, fDst, fDstRowBytes, opts.fZeroInitialized);
348 filledBackground = true;
349 }
350 } else {
351 // Not independent.
352 // SkCodec ensured that the prior frame has been decoded.
353 filledBackground = true;
354 }
355
356 fFilledBackground = filledBackground;
357 if (filledBackground) {
358 // Report the full (scaled) height, since the client will never need to fill.
359 fRowsDecoded = scaledHeight;
360 } else {
361 // This will be updated by haveDecodedRow.
362 fRowsDecoded = 0;
363 }
364 }
365
366 if (!fCurrColorTableIsReal) {
367 // Nothing to draw this frame.
368 return kSuccess;
369 }
370
371 bool frameDecoded = false;
372 const bool fatalError = !fReader->decode(frameIndex, &frameDecoded);
373 if (fatalError || !frameDecoded || fRowsDecoded != scaledHeight) {
374 if (rowsDecoded) {
375 *rowsDecoded = fRowsDecoded;
376 }
377 if (fatalError) {
378 return kErrorInInput;
379 }
380 return kIncompleteInput;
381 }
382
383 return kSuccess;
384 }
385
applyXformRow(const SkImageInfo & dstInfo,void * dst,const uint8_t * src) const386 void SkGifCodec::applyXformRow(const SkImageInfo& dstInfo, void* dst, const uint8_t* src) const {
387 if (this->xformOnDecode()) {
388 SkASSERT(this->colorXform());
389 fSwizzler->swizzle(fXformBuffer.get(), src);
390
391 const int xformWidth = get_scaled_dimension(dstInfo.width(), fSwizzler->sampleX());
392 this->applyColorXform(dst, fXformBuffer.get(), xformWidth);
393 } else {
394 fSwizzler->swizzle(dst, src);
395 }
396 }
397
398 template <typename T>
blend_line(void * dstAsVoid,const void * srcAsVoid,int width)399 static void blend_line(void* dstAsVoid, const void* srcAsVoid, int width) {
400 T* dst = reinterpret_cast<T*>(dstAsVoid);
401 const T* src = reinterpret_cast<const T*>(srcAsVoid);
402 while (width --> 0) {
403 if (*src != 0) { // GIF pixels are either transparent (== 0) or opaque (!= 0).
404 *dst = *src;
405 }
406 src++;
407 dst++;
408 }
409 }
410
haveDecodedRow(int frameIndex,const unsigned char * rowBegin,int rowNumber,int repeatCount,bool writeTransparentPixels)411 void SkGifCodec::haveDecodedRow(int frameIndex, const unsigned char* rowBegin,
412 int rowNumber, int repeatCount, bool writeTransparentPixels)
413 {
414 const SkGIFFrameContext* frameContext = fReader->frameContext(frameIndex);
415 // The pixel data and coordinates supplied to us are relative to the frame's
416 // origin within the entire image size, i.e.
417 // (frameContext->xOffset, frameContext->yOffset). There is no guarantee
418 // that width == (size().width() - frameContext->xOffset), so
419 // we must ensure we don't run off the end of either the source data or the
420 // row's X-coordinates.
421 const int width = frameContext->width();
422 const int xBegin = frameContext->xOffset();
423 const int yBegin = frameContext->yOffset() + rowNumber;
424 const int xEnd = std::min(xBegin + width, this->dimensions().width());
425 const int yEnd = std::min(yBegin + rowNumber + repeatCount, this->dimensions().height());
426 // FIXME: No need to make the checks on width/xBegin/xEnd for every row. We could instead do
427 // this once in prepareToDecode.
428 if (!width || (xBegin < 0) || (yBegin < 0) || (xEnd <= xBegin) || (yEnd <= yBegin))
429 return;
430
431 // yBegin is the first row in the non-sampled image. dstRow will be the row in the output,
432 // after potentially scaling it.
433 int dstRow = yBegin;
434
435 const int sampleY = fSwizzler->sampleY();
436 if (sampleY > 1) {
437 // Check to see whether this row or one that falls in the repeatCount is needed in the
438 // output.
439 bool foundNecessaryRow = false;
440 for (int i = 0; i < repeatCount; i++) {
441 const int potentialRow = yBegin + i;
442 if (fSwizzler->rowNeeded(potentialRow)) {
443 dstRow = potentialRow / sampleY;
444 const int scaledHeight = get_scaled_dimension(this->dstInfo().height(), sampleY);
445 if (dstRow >= scaledHeight) {
446 return;
447 }
448
449 foundNecessaryRow = true;
450 repeatCount -= i;
451
452 repeatCount = (repeatCount - 1) / sampleY + 1;
453
454 // Make sure the repeatCount does not take us beyond the end of the dst
455 if (dstRow + repeatCount > scaledHeight) {
456 repeatCount = scaledHeight - dstRow;
457 SkASSERT(repeatCount >= 1);
458 }
459 break;
460 }
461 }
462
463 if (!foundNecessaryRow) {
464 return;
465 }
466 } else {
467 // Make sure the repeatCount does not take us beyond the end of the dst
468 SkASSERT(this->dstInfo().height() >= yBegin);
469 repeatCount = SkTMin(repeatCount, this->dstInfo().height() - yBegin);
470 }
471
472 if (!fFilledBackground) {
473 // At this point, we are definitely going to write the row, so count it towards the number
474 // of rows decoded.
475 // We do not consider the repeatCount, which only happens for interlaced, in which case we
476 // have already set fRowsDecoded to the proper value (reflecting that we have filled the
477 // background).
478 fRowsDecoded++;
479 }
480
481 // decodeFrame will early exit if this is false, so this method will not be
482 // called.
483 SkASSERT(fCurrColorTableIsReal);
484
485 // The swizzler takes care of offsetting into the dst width-wise.
486 void* dstLine = SkTAddOffset<void>(fDst, dstRow * fDstRowBytes);
487
488 // We may or may not need to write transparent pixels to the buffer.
489 // If we're compositing against a previous image, it's wrong, but if
490 // we're decoding an interlaced gif and displaying it "Haeberli"-style,
491 // we must write these for passes beyond the first, or the initial passes
492 // will "show through" the later ones.
493 const auto dstInfo = this->dstInfo();
494 if (writeTransparentPixels) {
495 this->applyXformRow(dstInfo, dstLine, rowBegin);
496 } else {
497 this->applyXformRow(dstInfo, fTmpBuffer.get(), rowBegin);
498
499 size_t offsetBytes = fSwizzler->swizzleOffsetBytes();
500 if (dstInfo.colorType() == kRGBA_F16_SkColorType) {
501 // Account for the fact that post-swizzling we converted to F16,
502 // which is twice as wide.
503 offsetBytes *= 2;
504 }
505 const void* src = SkTAddOffset<void>(fTmpBuffer.get(), offsetBytes);
506 void* dst = SkTAddOffset<void>(dstLine, offsetBytes);
507
508 switch (dstInfo.colorType()) {
509 case kBGRA_8888_SkColorType:
510 case kRGBA_8888_SkColorType:
511 blend_line<uint32_t>(dst, src, fSwizzler->swizzleWidth());
512 break;
513 case kRGBA_F16_SkColorType:
514 blend_line<uint64_t>(dst, src, fSwizzler->swizzleWidth());
515 break;
516 default:
517 SkASSERT(false);
518 return;
519 }
520 }
521
522 // Tell the frame to copy the row data if need be.
523 if (repeatCount > 1) {
524 const size_t bytesPerPixel = this->dstInfo().bytesPerPixel();
525 const size_t bytesToCopy = fSwizzler->swizzleWidth() * bytesPerPixel;
526 void* copiedLine = SkTAddOffset<void>(dstLine, fSwizzler->swizzleOffsetBytes());
527 void* dst = copiedLine;
528 for (int i = 1; i < repeatCount; i++) {
529 dst = SkTAddOffset<void>(dst, fDstRowBytes);
530 memcpy(dst, copiedLine, bytesToCopy);
531 }
532 }
533 }
534