Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkReadPixelsRec.h
Go to the documentation of this file.
1/*
2 * Copyright 2014 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 SkReadPixelsRec_DEFINED
9#define SkReadPixelsRec_DEFINED
10
13
14#include <cstddef>
15
16/**
17 * Helper class to package and trim the parameters passed to readPixels()
18 */
20 SkReadPixelsRec(const SkImageInfo& info, 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 SkReadPixelsRec(const SkPixmap& pm, int x, int y)
29 : fPixels(pm.writable_addr())
30 , fRowBytes(pm.rowBytes())
31 , fInfo(pm.info())
32 , fX(x)
33 , fY(y)
34 {}
35
36 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 src width/height.
45 *
46 * On false, leaves self unchanged, but indicates that it does not overlap src, or
47 * is not valid (e.g. bad fInfo) for readPixels().
48 */
49 bool trim(int srcWidth, int srcHeight);
50};
51
52#endif
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
double y
double x
SkImageInfo fInfo
SkReadPixelsRec(const SkImageInfo &info, void *pixels, size_t rowBytes, int x, int y)
SkReadPixelsRec(const SkPixmap &pm, int x, int y)
bool trim(int srcWidth, int srcHeight)