2 * Copyright 2017 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef SkWritePixelsRec_DEFINED
9 #define SkWritePixelsRec_DEFINED
11 #include "include/core/SkImageInfo.h"
12 #include "include/core/SkPixmap.h"
15 * Helper class to package and trim the parameters passed to writePixels()
17 struct SkWritePixelsRec {
18 SkWritePixelsRec(const SkImageInfo& info, const void* pixels, size_t rowBytes, int x, int y)
26 SkWritePixelsRec(const SkPixmap& pm, int x, int y)
28 , fRowBytes(pm.rowBytes())
41 * On true, may have modified its fields (except fRowBytes) to make it a legal subset
42 * of the specified dst width/height.
44 * On false, leaves self unchanged, but indicates that it does not overlap dst, or
45 * is not valid (e.g. bad fInfo) for writePixels().
47 bool trim(int dstWidth, int dstHeight);