Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Enumerations | Functions
GaneshGLSurfaceManager.cpp File Reference
#include "include/core/SkColorSpace.h"
#include "include/core/SkColorType.h"
#include "include/core/SkSurface.h"
#include "include/gpu/GrContextOptions.h"
#include "include/gpu/GrTypes.h"
#include "include/gpu/ganesh/SkSurfaceGanesh.h"
#include "include/private/base/SkAssert.h"
#include "tools/gpu/BackendSurfaceFactory.h"
#include "tools/gpu/GrContextFactory.h"
#include "tools/testrunners/common/surface_manager/SurfaceManager.h"
#include <string>

Go to the source code of this file.

Classes

class  GaneshGLSurfaceManager
 

Enumerations

enum class  SurfaceType {
  kDefault , kBackendTexture , kBackendRenderTarget , kDefault ,
  kBackendTexture , kBackendRenderTarget
}
 

Functions

std::unique_ptr< SurfaceManagermakeGLESSurfaceManager (std::string config, SurfaceOptions surfaceOptions, GrContextOptions grContextOptions, sk_gpu_test::GrContextFactory::ContextOverrides contextOverrides, SkColorInfo colorInfo, SurfaceType surfaceType, uint32_t surfaceFlags, int sampleCount)
 

Enumeration Type Documentation

◆ SurfaceType

enum class SurfaceType
strong
Enumerator
kDefault 
kBackendTexture 
kBackendRenderTarget 
kDefault 
kBackendTexture 
kBackendRenderTarget 

Definition at line 51 of file GaneshGLSurfaceManager.cpp.

Function Documentation

◆ makeGLESSurfaceManager()

std::unique_ptr< SurfaceManager > makeGLESSurfaceManager ( std::string  config,
SurfaceOptions  surfaceOptions,
GrContextOptions  grContextOptions,
sk_gpu_test::GrContextFactory::ContextOverrides  contextOverrides,
SkColorInfo  colorInfo,
SurfaceType  surfaceType,
uint32_t  surfaceFlags,
int  sampleCount 
)

Definition at line 53 of file GaneshGLSurfaceManager.cpp.

61 {
62 if (surfaceOptions.modifyGrContextOptions) {
63 surfaceOptions.modifyGrContextOptions(&grContextOptions);
64 }
65
66 // Based on
67 // https://skia.googlesource.com/skia/+/8da85ea79d1ba2b3f32d25178eb21f2ebda83437/dm/DMSrcSink.cpp#1579.
68 auto contextFactory = std::make_unique<sk_gpu_test::GrContextFactory>(grContextOptions);
69 sk_gpu_test::ContextInfo contextInfo =
70 contextFactory.get()->getContextInfo(skgpu::ContextType::kGLES, contextOverrides);
71 GrDirectContext* context = contextInfo.directContext();
72 SkASSERT_RELEASE(context);
73
74 // Based on
75 // https://skia.googlesource.com/skia/+/8da85ea79d1ba2b3f32d25178eb21f2ebda83437/dm/DMSrcSink.cpp#1524.
76 SkImageInfo imageInfo = SkImageInfo::Make({surfaceOptions.width, surfaceOptions.height}, colorInfo);
77 SkSurfaceProps surfaceProps(surfaceFlags, kRGB_H_SkPixelGeometry);
79 switch (surfaceType) {
80 default:
83 context, skgpu::Budgeted::kNo, imageInfo, sampleCount, &surfaceProps);
84 break;
85
88 imageInfo,
90 sampleCount,
91 skgpu::Mipmapped::kNo,
92 skgpu::Protected::kNo,
93 &surfaceProps);
94 break;
95
98 imageInfo,
100 sampleCount,
101 skgpu::Protected::kNo,
102 &surfaceProps);
103 break;
104 }
106
107 return std::make_unique<GaneshGLSurfaceManager>(
108 std::move(contextFactory), contextInfo, context, surface, config, colorInfo);
109}
@ kBottomLeft_GrSurfaceOrigin
Definition GrTypes.h:149
@ kTopLeft_GrSurfaceOrigin
Definition GrTypes.h:148
#define SkASSERT_RELEASE(cond)
Definition SkAssert.h:100
@ kRGB_H_SkPixelGeometry
GrDirectContext * directContext() const
VkSurfaceKHR surface
Definition main.cc:49
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
sk_sp< SkSurface > MakeBackendRenderTargetSurface(GrDirectContext *dContext, const SkImageInfo &ii, GrSurfaceOrigin origin, int sampleCnt, GrProtected isProtected, const SkSurfaceProps *props)
sk_sp< SkSurface > MakeBackendTextureSurface(GrDirectContext *dContext, const SkImageInfo &ii, GrSurfaceOrigin origin, int sampleCnt, skgpu::Mipmapped mipmapped, GrProtected isProtected, const SkSurfaceProps *props)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
std::function< void(GrContextOptions *)> modifyGrContextOptions