Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Macros | Functions | Variables
GrResourceProvider.cpp File Reference
#include "src/gpu/ganesh/GrResourceProvider.h"
#include "include/core/SkAlphaType.h"
#include "include/core/SkColorSpace.h"
#include "include/core/SkData.h"
#include "include/core/SkRect.h"
#include "include/core/SkSize.h"
#include "include/gpu/GpuTypes.h"
#include "include/gpu/GrBackendSurface.h"
#include "include/gpu/GrTypes.h"
#include "include/private/base/SingleOwner.h"
#include "include/private/base/SkTemplates.h"
#include "src/base/SkMathPriv.h"
#include "src/core/SkMipmap.h"
#include "src/gpu/BufferWriter.h"
#include "src/gpu/ResourceKey.h"
#include "src/gpu/SkBackingFit.h"
#include "src/gpu/ganesh/GrAttachment.h"
#include "src/gpu/ganesh/GrCaps.h"
#include "src/gpu/ganesh/GrDataUtils.h"
#include "src/gpu/ganesh/GrGpu.h"
#include "src/gpu/ganesh/GrGpuBuffer.h"
#include "src/gpu/ganesh/GrGpuResourcePriv.h"
#include "src/gpu/ganesh/GrImageInfo.h"
#include "src/gpu/ganesh/GrPixmap.h"
#include "src/gpu/ganesh/GrRenderTarget.h"
#include "src/gpu/ganesh/GrResourceCache.h"
#include "src/gpu/ganesh/GrSemaphore.h"
#include "src/gpu/ganesh/GrSurface.h"
#include "src/gpu/ganesh/GrTexture.h"
#include <algorithm>
#include <utility>

Go to the source code of this file.

Macros

#define ASSERT_SINGLE_OWNER   SKGPU_ASSERT_SINGLE_OWNER(fSingleOwner)
 

Functions

static int num_stencil_samples (const GrRenderTarget *rt, bool useMSAASurface, const GrCaps &caps)
 
static bool prepare_level (const GrMipLevel &inLevel, SkISize dimensions, bool rowBytesSupport, GrColorType origColorType, GrColorType allowedColorType, GrMipLevel *outLevel, std::unique_ptr< char[]> *data)
 

Variables

static constexpr int kMaxNumNonAAQuads = 1 << 12
 
static const int kVertsPerNonAAQuad = 4
 
static const int kIndicesPerNonAAQuad = 6
 
static constexpr int kMaxNumAAQuads = 1 << 9
 
static const int kVertsPerAAQuad = 8
 
static const int kIndicesPerAAQuad = 30
 

Macro Definition Documentation

◆ ASSERT_SINGLE_OWNER

#define ASSERT_SINGLE_OWNER   SKGPU_ASSERT_SINGLE_OWNER(fSingleOwner)

Definition at line 46 of file GrResourceProvider.cpp.

Function Documentation

◆ num_stencil_samples()

static int num_stencil_samples ( const GrRenderTarget rt,
bool  useMSAASurface,
const GrCaps caps 
)
static

Definition at line 655 of file GrResourceProvider.cpp.

655 {
656 int numSamples = rt->numSamples();
657 if (numSamples == 1 && useMSAASurface) { // Are we using dynamic msaa?
658 numSamples = caps.internalMultisampleCount(rt->backendFormat());
659 SkASSERT(numSamples > 1); // Caller must ensure dmsaa is supported before trying to use it.
660 }
661 return numSamples;
662}
#define SkASSERT(cond)
Definition SkAssert.h:116
int internalMultisampleCount(const GrBackendFormat &format) const
Definition GrCaps.h:271
int numSamples() const
virtual GrBackendFormat backendFormat() const =0

◆ prepare_level()

static bool prepare_level ( const GrMipLevel inLevel,
SkISize  dimensions,
bool  rowBytesSupport,
GrColorType  origColorType,
GrColorType  allowedColorType,
GrMipLevel outLevel,
std::unique_ptr< char[]> *  data 
)
static

Definition at line 848 of file GrResourceProvider.cpp.

854 {
855 if (!inLevel.fPixels) {
856 outLevel->fPixels = nullptr;
857 outLevel->fRowBytes = 0;
858 return true;
859 }
860 size_t minRB = dimensions.fWidth * GrColorTypeBytesPerPixel(origColorType);
861 size_t actualRB = inLevel.fRowBytes ? inLevel.fRowBytes : minRB;
862 if (actualRB < minRB) {
863 return false;
864 }
865 if (origColorType == allowedColorType && (actualRB == minRB || rowBytesSupport)) {
866 outLevel->fRowBytes = actualRB;
867 outLevel->fPixels = inLevel.fPixels;
868 return true;
869 }
870 auto tempRB = dimensions.fWidth * GrColorTypeBytesPerPixel(allowedColorType);
871 data->reset(new char[tempRB * dimensions.fHeight]);
872 outLevel->fPixels = data->get();
873 outLevel->fRowBytes = tempRB;
874 GrImageInfo srcInfo( origColorType, kUnpremul_SkAlphaType, nullptr, dimensions);
875 GrImageInfo dstInfo(allowedColorType, kUnpremul_SkAlphaType, nullptr, dimensions);
876 return GrConvertPixels( GrPixmap(dstInfo, data->get(), tempRB),
877 GrCPixmap(srcInfo, inLevel.fPixels, actualRB));
878}
bool GrConvertPixels(const GrPixmap &dst, const GrCPixmap &src, bool flipY)
static constexpr size_t GrColorTypeBytesPerPixel(GrColorType ct)
kUnpremul_SkAlphaType
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41
const void * fPixels
size_t fRowBytes
int32_t fHeight
Definition SkSize.h:18
int32_t fWidth
Definition SkSize.h:17

Variable Documentation

◆ kIndicesPerAAQuad

const int kIndicesPerAAQuad = 30
static

Definition at line 569 of file GrResourceProvider.cpp.

◆ kIndicesPerNonAAQuad

const int kIndicesPerNonAAQuad = 6
static

Definition at line 547 of file GrResourceProvider.cpp.

◆ kMaxNumAAQuads

constexpr int kMaxNumAAQuads = 1 << 9
staticconstexpr

Definition at line 567 of file GrResourceProvider.cpp.

◆ kMaxNumNonAAQuads

constexpr int kMaxNumNonAAQuads = 1 << 12
staticconstexpr

Definition at line 545 of file GrResourceProvider.cpp.

◆ kVertsPerAAQuad

const int kVertsPerAAQuad = 8
static

Definition at line 568 of file GrResourceProvider.cpp.

◆ kVertsPerNonAAQuad

const int kVertsPerNonAAQuad = 4
static

Definition at line 546 of file GrResourceProvider.cpp.