Flutter Engine
The Flutter Engine
|
#include "include/core/SkColor.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkTypes.h"
#include "include/gpu/GpuTypes.h"
#include "include/gpu/GrTypes.h"
#include "src/gpu/SkBackingFit.h"
#include "src/gpu/ganesh/GrImageInfo.h"
#include "src/gpu/ganesh/GrPixmap.h"
#include <cstdint>
#include <functional>
#include <memory>
Go to the source code of this file.
Namespaces | |
namespace | skiatest |
namespace | skgpu |
namespace | skgpu::ganesh |
Typedefs | |
typedef uint32_t | GrColor |
using | ComparePixmapsErrorReporter = void(int x, int y, const float diffs[4]) |
using ComparePixmapsErrorReporter = void(int x, int y, const float diffs[4]) |
Used by compare_pixels.
Definition at line 61 of file TestUtils.h.
typedef uint32_t GrColor |
Definition at line 33 of file TestUtils.h.
void CheckSingleThreadedProxyRefs | ( | skiatest::Reporter * | reporter, |
GrSurfaceProxy * | proxy, | ||
int32_t | expectedProxyRefs, | ||
int32_t | expectedBackingRefs | ||
) |
Checks the ref cnt on a proxy and its backing store. This is only valid if the proxy and the resource are both used on a single thread.
Definition at line 231 of file TestUtils.cpp.
bool CheckSolidPixels | ( | const SkColor4f & | col, |
const SkPixmap & | pixmap, | ||
const float | tolRGBA[4], | ||
std::function< ComparePixmapsErrorReporter > & | error | ||
) |
Convenience version that checks that 'pixmap' is a solid field of 'col'
Definition at line 191 of file TestUtils.cpp.
bool ComparePixels | ( | const GrCPixmap & | a, |
const GrCPixmap & | b, | ||
const float | tolRGBA[4], | ||
std::function< ComparePixmapsErrorReporter > & | error | ||
) |
Compares pixels pointed to by 'a' to pixels pointed to by 'b'.
If the pixmaps have different dimensions error is called with negative coordinate values and zero diffs and no comparisons are made.
Before comparison pixels are converted to a common color type, alpha type, and color space. The color type is always 32 bit float. The alpha type is premul if one of the pixmaps is premul and the other is unpremul. The color space is linear sRGB if the pixmaps have different colorspaces, otherwise their common color space is used.
'tolRGBA' expresses the allowed difference between pixels in the comparison space per channel. If pixel components differ more than by 'tolRGBA' in absolute value in any channel then 'error' is called with the coordinate and difference in the comparison space (B - A).
The function quits after a single error is reported and returns false if 'error' was called and true otherwise.
Definition at line 142 of file TestUtils.cpp.
std::unique_ptr< skgpu::ganesh::SurfaceContext > CreateSurfaceContext | ( | GrRecordingContext * | rContext, |
const GrImageInfo & | info, | ||
SkBackingFit | fit = SkBackingFit::kExact , |
||
GrSurfaceOrigin | origin = kTopLeft_GrSurfaceOrigin , |
||
GrRenderable | renderable = GrRenderable::kNo , |
||
int | sampleCount = 1 , |
||
skgpu::Mipmapped | mipmapped = skgpu::Mipmapped::kNo , |
||
GrProtected | isProtected = GrProtected::kNo , |
||
skgpu::Budgeted | budgeted = skgpu::Budgeted::kYes |
||
) |
Definition at line 242 of file TestUtils.cpp.
void TestCopyFromSurface | ( | skiatest::Reporter * | reporter, |
GrDirectContext * | dContext, | ||
sk_sp< GrSurfaceProxy > | proxy, | ||
GrSurfaceOrigin | origin, | ||
GrColorType | colorType, | ||
uint32_t | expectedPixelValues[], | ||
const char * | testName | ||
) |
Definition at line 98 of file TestUtils.cpp.
void TestReadPixels | ( | skiatest::Reporter * | reporter, |
GrDirectContext * | dContext, | ||
skgpu::ganesh::SurfaceContext * | srcContext, | ||
uint32_t | expectedPixelValues[], | ||
const char * | testName | ||
) |
Definition at line 39 of file TestUtils.cpp.
void TestWritePixels | ( | skiatest::Reporter * | reporter, |
GrDirectContext * | dContext, | ||
skgpu::ganesh::SurfaceContext * | dstContext, | ||
bool | expectedToWork, | ||
const char * | testName | ||
) |
Definition at line 66 of file TestUtils.cpp.