Flutter Engine
The Flutter Engine
SkRectMemcpy.h
Go to the documentation of this file.
1/*
2 * Copyright 2023 Google LLC
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 SkRectMemcpy_DEFINED
9#define SkRectMemcpy_DEFINED
10
13
14#include <cstring>
15
16static inline void SkRectMemcpy(void* dst, size_t dstRB, const void* src, size_t srcRB,
17 size_t trimRowBytes, int rowCount) {
18 SkASSERT(trimRowBytes <= dstRB);
19 SkASSERT(trimRowBytes <= srcRB);
20 if (trimRowBytes == dstRB && trimRowBytes == srcRB) {
21 memcpy(dst, src, trimRowBytes * rowCount);
22 return;
23 }
24
25 for (int i = 0; i < rowCount; ++i) {
26 memcpy(dst, src, trimRowBytes);
27 dst = SkTAddOffset<void>(dst, dstRB);
28 src = SkTAddOffset<const void>(src, srcRB);
29 }
30}
31
32#endif
#define SkASSERT(cond)
Definition: SkAssert.h:116
static void SkRectMemcpy(void *dst, size_t dstRB, const void *src, size_t srcRB, size_t trimRowBytes, int rowCount)
Definition: SkRectMemcpy.h:16
dst
Definition: cp.py:12