Flutter Engine
The Flutter Engine
|
#include "tests/TestUtils.h"
#include "include/core/SkAlphaType.h"
#include "include/core/SkColorSpace.h"
#include "include/core/SkColorType.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkPixmap.h"
#include "include/core/SkSize.h"
#include "include/gpu/GrBackendSurface.h"
#include "include/gpu/GrDirectContext.h"
#include "include/gpu/GrRecordingContext.h"
#include "include/private/base/SkTemplates.h"
#include "include/private/base/SkTo.h"
#include "include/private/gpu/ganesh/GrTypesPriv.h"
#include "src/core/SkAutoPixmapStorage.h"
#include "src/gpu/ganesh/GrCaps.h"
#include "src/gpu/ganesh/GrDataUtils.h"
#include "src/gpu/ganesh/GrDirectContextPriv.h"
#include "src/gpu/ganesh/GrImageInfo.h"
#include "src/gpu/ganesh/GrRecordingContextPriv.h"
#include "src/gpu/ganesh/GrSurfaceProxy.h"
#include "src/gpu/ganesh/GrSurfaceProxyView.h"
#include "src/gpu/ganesh/SkGr.h"
#include "src/gpu/ganesh/SurfaceContext.h"
#include "src/utils/SkCharToGlyphCache.h"
#include "tests/Test.h"
#include <cmath>
#include <cstdlib>
#include <utility>
Go to the source code of this file.
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.
|
static |
Definition at line 122 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, | ||
GrSurfaceOrigin | origin, | ||
GrRenderable | renderable, | ||
int | sampleCount, | ||
skgpu::Mipmapped | mipmapped, | ||
GrProtected | isProtected, | ||
skgpu::Budgeted | budgeted | ||
) |
Definition at line 242 of file TestUtils.cpp.
DEF_TEST | ( | chartoglyph_cache | , |
reporter | |||
) |
Definition at line 283 of file TestUtils.cpp.
|
static |
Definition at line 265 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.