Flutter Engine
The Flutter Engine
SkWritePixelsRec.h
Go to the documentation of this file.
1/*
2 * Copyright 2017 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 SkWritePixelsRec_DEFINED
9#define SkWritePixelsRec_DEFINED
10
13
14#include <cstddef>
15
16/**
17 * Helper class to package and trim the parameters passed to writePixels()
18 */
20 SkWritePixelsRec(const SkImageInfo& info, const void* pixels, size_t rowBytes, int x, int y)
21 : fPixels(pixels)
22 , fRowBytes(rowBytes)
23 , fInfo(info)
24 , fX(x)
25 , fY(y)
26 {}
27
28 SkWritePixelsRec(const SkPixmap& pm, int x, int y)
29 : fPixels(pm.addr())
30 , fRowBytes(pm.rowBytes())
31 , fInfo(pm.info())
32 , fX(x)
33 , fY(y)
34 {}
35
36 const void* fPixels;
37 size_t fRowBytes;
39 int fX;
40 int fY;
41
42 /*
43 * On true, may have modified its fields (except fRowBytes) to make it a legal subset
44 * of the specified dst width/height.
45 *
46 * On false, leaves self unchanged, but indicates that it does not overlap dst, or
47 * is not valid (e.g. bad fInfo) for writePixels().
48 */
49 bool trim(int dstWidth, int dstHeight);
50};
51
52#endif
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
double y
double x
SkWritePixelsRec(const SkImageInfo &info, const void *pixels, size_t rowBytes, int x, int y)
SkWritePixelsRec(const SkPixmap &pm, int x, int y)
bool trim(int dstWidth, int dstHeight)
const void * fPixels