Line data Source code
1 : /*
2 : * Copyright 2011 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 : #ifndef SkConvertPixels_DEFINED
9 : #define SkConvertPixels_DEFINED
10 :
11 : #include "SkImageInfo.h"
12 : #include "SkTemplates.h"
13 :
14 : class SkColorTable;
15 :
16 : void SkConvertPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
17 : const SkImageInfo& srcInfo, const void* srcPixels, size_t srcRowBytes,
18 : SkColorTable* srcCTable, SkTransferFunctionBehavior behavior);
19 :
20 0 : static inline void SkRectMemcpy(void* dst, size_t dstRB, const void* src, size_t srcRB,
21 : size_t bytesPerRow, int rowCount) {
22 0 : SkASSERT(bytesPerRow <= dstRB);
23 0 : SkASSERT(bytesPerRow <= srcRB);
24 0 : if (bytesPerRow == dstRB && bytesPerRow == srcRB) {
25 0 : memcpy(dst, src, bytesPerRow * rowCount);
26 0 : return;
27 : }
28 :
29 0 : for (int i = 0; i < rowCount; ++i) {
30 0 : memcpy(dst, src, bytesPerRow);
31 0 : dst = SkTAddOffset<void>(dst, dstRB);
32 0 : src = SkTAddOffset<const void>(src, srcRB);
33 : }
34 : }
35 :
36 : #endif
|