本文整理汇总了C++中GR_STATIC_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ GR_STATIC_ASSERT函数的具体用法?C++ GR_STATIC_ASSERT怎么用?C++ GR_STATIC_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GR_STATIC_ASSERT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: sample_offset_array_name
static const char* sample_offset_array_name(GrGLSLFPFragmentBuilder::Coordinates coords) {
static const char* kArrayNames[] = {
"deviceSpaceSampleOffsets",
"windowSpaceSampleOffsets"
};
return kArrayNames[coords];
GR_STATIC_ASSERT(0 == GrGLSLFPFragmentBuilder::kSkiaDevice_Coordinates);
GR_STATIC_ASSERT(1 == GrGLSLFPFragmentBuilder::kGLSLWindow_Coordinates);
GR_STATIC_ASSERT(SK_ARRAY_COUNT(kArrayNames) == GrGLSLFPFragmentBuilder::kLast_Coordinates + 1);
}
开发者ID:aseprite,项目名称:skia,代码行数:11,代码来源:GrGLSLFragmentShaderBuilder.cpp
示例2: tile_to_vk_sampler_address
static inline VkSamplerAddressMode tile_to_vk_sampler_address(SkShader::TileMode tm) {
static const VkSamplerAddressMode gWrapModes[] = {
VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE,
VK_SAMPLER_ADDRESS_MODE_REPEAT,
VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT
};
GR_STATIC_ASSERT(SkShader::kTileModeCount == SK_ARRAY_COUNT(gWrapModes));
GR_STATIC_ASSERT(0 == SkShader::kClamp_TileMode);
GR_STATIC_ASSERT(1 == SkShader::kRepeat_TileMode);
GR_STATIC_ASSERT(2 == SkShader::kMirror_TileMode);
return gWrapModes[tm];
}
开发者ID:03050903,项目名称:skia,代码行数:12,代码来源:GrVkSampler.cpp
示例3: GR_STATIC_ASSERT
GrPathRenderer* GrPathRendererChain::getPathRenderer(const GrDrawTarget* target,
const GrPipelineBuilder* pipelineBuilder,
const SkMatrix& viewMatrix,
const SkPath& path,
const GrStrokeInfo& stroke,
DrawType drawType,
StencilSupport* stencilSupport) {
if (!fInit) {
this->init();
}
bool antiAlias = (kColorAntiAlias_DrawType == drawType ||
kStencilAndColorAntiAlias_DrawType == drawType);
GR_STATIC_ASSERT(GrPathRenderer::kNoSupport_StencilSupport <
GrPathRenderer::kStencilOnly_StencilSupport);
GR_STATIC_ASSERT(GrPathRenderer::kStencilOnly_StencilSupport <
GrPathRenderer::kNoRestriction_StencilSupport);
GrPathRenderer::StencilSupport minStencilSupport;
if (kStencilOnly_DrawType == drawType) {
minStencilSupport = GrPathRenderer::kStencilOnly_StencilSupport;
} else if (kStencilAndColor_DrawType == drawType ||
kStencilAndColorAntiAlias_DrawType == drawType) {
minStencilSupport = GrPathRenderer::kNoRestriction_StencilSupport;
} else {
minStencilSupport = GrPathRenderer::kNoSupport_StencilSupport;
}
for (int i = 0; i < fChain.count(); ++i) {
GrPathRenderer::CanDrawPathArgs args;
args.fShaderCaps = target->caps()->shaderCaps();
args.fPipelineBuilder = pipelineBuilder;
args.fViewMatrix = &viewMatrix;
args.fPath = &path;
args.fStroke = &stroke;
args.fAntiAlias = antiAlias;
if (fChain[i]->canDrawPath(args)) {
if (GrPathRenderer::kNoSupport_StencilSupport != minStencilSupport) {
GrPathRenderer::StencilSupport support =
fChain[i]->getStencilSupport(path, stroke);
if (support < minStencilSupport) {
continue;
} else if (stencilSupport) {
*stencilSupport = support;
}
}
return fChain[i];
}
}
return NULL;
}
开发者ID:webbjiang,项目名称:skia,代码行数:51,代码来源:GrPathRendererChain.cpp
示例4: draw_face_to_vk_cull_mode
VkCullModeFlags draw_face_to_vk_cull_mode(GrPipelineBuilder::DrawFace drawFace) {
// Assumes that we've set the front face to be ccw
static const VkCullModeFlags gTable[] = {
VK_CULL_MODE_NONE, // kBoth_DrawFace
VK_CULL_MODE_BACK_BIT, // kCCW_DrawFace, cull back face
VK_CULL_MODE_FRONT_BIT, // kCW_DrawFace, cull front face
};
GR_STATIC_ASSERT(0 == GrPipelineBuilder::kBoth_DrawFace);
GR_STATIC_ASSERT(1 == GrPipelineBuilder::kCCW_DrawFace);
GR_STATIC_ASSERT(2 == GrPipelineBuilder::kCW_DrawFace);
SkASSERT((unsigned)drawFace <= 2);
return gTable[drawFace];
}
开发者ID:nicholas-yangding,项目名称:skia,代码行数:14,代码来源:GrVkPipeline.cpp
示例5: path_key_from_data_size
// If the path is small enough to be keyed from its data this returns key length, otherwise -1.
static int path_key_from_data_size(const SkPath& path) {
const int verbCnt = path.countVerbs();
if (verbCnt > GrShape::kMaxKeyFromDataVerbCnt) {
return -1;
}
const int pointCnt = path.countPoints();
const int conicWeightCnt = SkPathPriv::ConicWeightCnt(path);
GR_STATIC_ASSERT(sizeof(SkPoint) == 2 * sizeof(uint32_t));
GR_STATIC_ASSERT(sizeof(SkScalar) == sizeof(uint32_t));
// 2 is for the verb cnt and a fill type. Each verb is a byte but we'll pad the verb data out to
// a uint32_t length.
return 2 + (SkAlign4(verbCnt) >> 2) + 2 * pointCnt + conicWeightCnt;
}
开发者ID:molikto,项目名称:Skia,代码行数:15,代码来源:GrShape.cpp
示例6: blend_equation_to_vk_blend_op
static VkBlendOp blend_equation_to_vk_blend_op(GrBlendEquation equation) {
static const VkBlendOp gTable[] = {
VK_BLEND_OP_ADD, // kAdd_GrBlendEquation
VK_BLEND_OP_SUBTRACT, // kSubtract_GrBlendEquation
VK_BLEND_OP_REVERSE_SUBTRACT, // kReverseSubtract_GrBlendEquation
};
GR_STATIC_ASSERT(SK_ARRAY_COUNT(gTable) == kFirstAdvancedGrBlendEquation);
GR_STATIC_ASSERT(0 == kAdd_GrBlendEquation);
GR_STATIC_ASSERT(1 == kSubtract_GrBlendEquation);
GR_STATIC_ASSERT(2 == kReverseSubtract_GrBlendEquation);
SkASSERT((unsigned)equation < kGrBlendCoeffCnt);
return gTable[equation];
}
开发者ID:nicholas-yangding,项目名称:skia,代码行数:14,代码来源:GrVkPipeline.cpp
示例7: GrPrintf
void GrGLCaps::print() const {
INHERITED::print();
GrPrintf("--- GL-Specific ---\n");
for (int i = 0; i < fStencilFormats.count(); ++i) {
GrPrintf("Stencil Format %d, stencil bits: %02d, total bits: %02d\n",
i,
fStencilFormats[i].fStencilBits,
fStencilFormats[i].fTotalBits);
}
GR_STATIC_ASSERT(0 == kNone_MSFBOType);
GR_STATIC_ASSERT(1 == kDesktopARB_MSFBOType);
GR_STATIC_ASSERT(2 == kDesktopEXT_MSFBOType);
GR_STATIC_ASSERT(3 == kAppleES_MSFBOType);
GR_STATIC_ASSERT(4 == kImaginationES_MSFBOType);
static const char* gMSFBOExtStr[] = {
"None",
"ARB",
"EXT",
"Apple",
"IMG",
};
GrPrintf("MSAA Type: %s\n", gMSFBOExtStr[fMSFBOType]);
GrPrintf("Max FS Uniform Vectors: %d\n", fMaxFragmentUniformVectors);
GrPrintf("Max Vertex Attributes: %d\n", fMaxVertexAttributes);
GrPrintf("Support RGBA8 Render Buffer: %s\n", (fRGBA8RenderbufferSupport ? "YES": "NO"));
GrPrintf("BGRA support: %s\n", (fBGRAFormatSupport ? "YES": "NO"));
GrPrintf("BGRA is an internal format: %s\n", (fBGRAIsInternalFormat ? "YES": "NO"));
GrPrintf("Support texture swizzle: %s\n", (fTextureSwizzleSupport ? "YES": "NO"));
GrPrintf("Unpack Row length support: %s\n", (fUnpackRowLengthSupport ? "YES": "NO"));
GrPrintf("Unpack Flip Y support: %s\n", (fUnpackFlipYSupport ? "YES": "NO"));
GrPrintf("Pack Row length support: %s\n", (fPackRowLengthSupport ? "YES": "NO"));
GrPrintf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO"));
GrPrintf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO"));
GrPrintf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO"));
GrPrintf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO"));
GrPrintf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO"));
GrPrintf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO"));
GrPrintf("Fragment coord conventions support: %s\n",
(fFragCoordsConventionSupport ? "YES": "NO"));
GrPrintf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO"));
GrPrintf("Use non-VBO for dynamic data: %s\n",
(fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO"));
GrPrintf("Core Profile: %s\n", (fIsCoreProfile ? "YES" : "NO"));
GrPrintf("Discard FrameBuffer support: %s\n", (fDiscardFBSupport ? "YES" : "NO"));
}
开发者ID:JoKaWare,项目名称:GViews,代码行数:49,代码来源:GrGLCaps.cpp
示例8: setup_quad_index_buffer
static uint32_t setup_quad_index_buffer(const GrGLInterface* gl) {
static const int kMaxQuads = 1;//1 << 12; // max possible: (1 << 14) - 1;
GR_STATIC_ASSERT(4 * kMaxQuads <= 65535);
static const uint16_t kPattern[] = { 0, 1, 2, 0, 2, 3 };
static const int kPatternSize = 6;
static const int kVertCount = 4;
static const int kIndicesCount = kPatternSize * kMaxQuads;
int size = kPatternSize * kMaxQuads * sizeof(uint16_t);
uint16_t* data = SkNEW_ARRAY(uint16_t, kMaxQuads * kPatternSize);
for (int i = 0; i < kMaxQuads; ++i) {
int baseIdx = i * kPatternSize;
uint16_t baseVert = (uint16_t)(i * kVertCount);
for (int j = 0; j < kPatternSize; ++j) {
data[baseIdx+j] = baseVert + kPattern[j];
}
}
GrGLuint quadIBO;
GR_GL_CALL(gl, GenBuffers(1, &quadIBO));
GR_GL_CALL(gl, BindBuffer(GR_GL_ELEMENT_ARRAY_BUFFER, quadIBO));
GR_GL_CALL(gl, BufferData(GR_GL_ELEMENT_ARRAY_BUFFER, size, data, GR_GL_STATIC_DRAW));
SkDELETE_ARRAY(data);
return kIndicesCount;
}
开发者ID:ReyCG,项目名称:skia,代码行数:27,代码来源:GLInstancedArraysBench.cpp
示例9: buffer_type_to_heap
static GrVkGpu::Heap buffer_type_to_heap(GrVkBuffer::Type type) {
const GrVkGpu::Heap kBufferToHeap[] {
GrVkGpu::kVertexBuffer_Heap,
GrVkGpu::kIndexBuffer_Heap,
GrVkGpu::kUniformBuffer_Heap,
GrVkGpu::kCopyReadBuffer_Heap,
GrVkGpu::kCopyWriteBuffer_Heap,
};
GR_STATIC_ASSERT(0 == GrVkBuffer::kVertex_Type);
GR_STATIC_ASSERT(1 == GrVkBuffer::kIndex_Type);
GR_STATIC_ASSERT(2 == GrVkBuffer::kUniform_Type);
GR_STATIC_ASSERT(3 == GrVkBuffer::kCopyRead_Type);
GR_STATIC_ASSERT(4 == GrVkBuffer::kCopyWrite_Type);
return kBufferToHeap[type];
}
开发者ID:rlugojr,项目名称:skia,代码行数:16,代码来源:GrVkMemory.cpp
示例10: get_blend_info_key
uint32_t get_blend_info_key(const GrPipeline& pipeline) {
GrXferProcessor::BlendInfo blendInfo;
pipeline.getXferProcessor().getBlendInfo(&blendInfo);
static const uint32_t kBlendWriteShift = 1;
static const uint32_t kBlendCoeffShift = 5;
GR_STATIC_ASSERT(kLast_GrBlendCoeff < (1 << kBlendCoeffShift));
GR_STATIC_ASSERT(kFirstAdvancedGrBlendEquation - 1 < 4);
uint32_t key = blendInfo.fWriteColor;
key |= (blendInfo.fSrcBlend << kBlendWriteShift);
key |= (blendInfo.fDstBlend << (kBlendWriteShift + kBlendCoeffShift));
key |= (blendInfo.fEquation << (kBlendWriteShift + 2 * kBlendCoeffShift));
return key;
}
开发者ID:C-Tillion,项目名称:skia,代码行数:16,代码来源:GrVkPipelineState.cpp
示例11: GR_STATIC_ASSERT
void GrGLConvexPolyEffect::GenKey(const GrProcessor& processor, const GrGLSLCaps&,
GrProcessorKeyBuilder* b) {
const GrConvexPolyEffect& cpe = processor.cast<GrConvexPolyEffect>();
GR_STATIC_ASSERT(kGrProcessorEdgeTypeCnt <= 8);
uint32_t key = (cpe.getEdgeCount() << 3) | cpe.getEdgeType();
b->add32(key);
}
开发者ID:china20,项目名称:skia,代码行数:7,代码来源:GrConvexPolyEffect.cpp
示例12: blend_coeff_refs_constant
bool blend_coeff_refs_constant(GrBlendCoeff coeff) {
static const bool gCoeffReferencesBlendConst[] = {
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
true,
true,
true,
true,
// extended blend coeffs
false,
false,
false,
false,
};
return gCoeffReferencesBlendConst[coeff];
GR_STATIC_ASSERT(kGrBlendCoeffCnt == SK_ARRAY_COUNT(gCoeffReferencesBlendConst));
// Individual enum asserts already made in blend_coeff_to_vk_blend
}
开发者ID:nicholas-yangding,项目名称:skia,代码行数:27,代码来源:GrVkPipeline.cpp
示例13: GR_STATIC_ASSERT
const GrIndexBuffer* GrResourceProvider::createQuadIndexBuffer() {
static const int kMaxQuads = 1 << 12; // max possible: (1 << 14) - 1;
GR_STATIC_ASSERT(4 * kMaxQuads <= 65535);
static const uint16_t kPattern[] = { 0, 1, 2, 0, 2, 3 };
return this->createInstancedIndexBuffer(kPattern, 6, kMaxQuads, 4, fQuadIndexBufferKey);
}
开发者ID:Nazi-Nigger,项目名称:gecko-dev,代码行数:7,代码来源:GrResourceProvider.cpp
示例14: GR_STATIC_ASSERT
GrResourceKey GrTexture::ComputeScratchKey(const GrTextureDesc& desc) {
GrCacheID::Key idKey;
// Instead of a client-provided key of the texture contents we create a key from the
// descriptor.
GR_STATIC_ASSERT(sizeof(idKey) >= 16);
GrAssert(desc.fHeight < (1 << 16));
GrAssert(desc.fWidth < (1 << 16));
idKey.fData32[0] = (desc.fWidth) | (desc.fHeight << 16);
idKey.fData32[1] = desc.fConfig | desc.fSampleCnt << 16;
idKey.fData32[2] = desc.fFlags;
idKey.fData32[3] = resolve_origin(desc); // Only needs 2 bits actually
static const int kPadSize = sizeof(idKey) - 16;
GR_STATIC_ASSERT(kPadSize >= 0);
memset(idKey.fData8 + 16, 0, kPadSize);
GrCacheID cacheID(GrResourceKey::ScratchDomain(), idKey);
return GrResourceKey(cacheID, texture_resource_type(), 0);
}
开发者ID:ConradIrwin,项目名称:gecko-dev,代码行数:18,代码来源:GrTexture.cpp
示例15: SkASSERT
void GrLayerCache::initAtlas() {
SkASSERT(NULL == fAtlas.get());
GR_STATIC_ASSERT(kNumPlotsX*kNumPlotsX == GrPictureInfo::kNumPlots);
SkISize textureSize = SkISize::Make(kAtlasTextureWidth, kAtlasTextureHeight);
fAtlas.reset(SkNEW_ARGS(GrAtlas, (fContext->getGpu(), kSkia8888_GrPixelConfig,
kRenderTarget_GrSurfaceFlag,
textureSize, kNumPlotsX, kNumPlotsY, false)));
}
开发者ID:Arternis,项目名称:skia,代码行数:9,代码来源:GrLayerCache.cpp
示例16: GR_STATIC_ASSERT
GrPathRenderer* GrPathRendererChain::getPathRenderer(const GrDrawTarget* target,
const GrPipelineBuilder* pipelineBuilder,
const SkMatrix& viewMatrix,
const SkPath& path,
const SkStrokeRec& stroke,
DrawType drawType,
StencilSupport* stencilSupport) {
if (!fInit) {
this->init();
}
bool antiAlias = (kColorAntiAlias_DrawType == drawType ||
kStencilAndColorAntiAlias_DrawType == drawType);
GR_STATIC_ASSERT(GrPathRenderer::kNoSupport_StencilSupport <
GrPathRenderer::kStencilOnly_StencilSupport);
GR_STATIC_ASSERT(GrPathRenderer::kStencilOnly_StencilSupport <
GrPathRenderer::kNoRestriction_StencilSupport);
GrPathRenderer::StencilSupport minStencilSupport;
if (kStencilOnly_DrawType == drawType) {
minStencilSupport = GrPathRenderer::kStencilOnly_StencilSupport;
} else if (kStencilAndColor_DrawType == drawType ||
kStencilAndColorAntiAlias_DrawType == drawType) {
minStencilSupport = GrPathRenderer::kNoRestriction_StencilSupport;
} else {
minStencilSupport = GrPathRenderer::kNoSupport_StencilSupport;
}
for (int i = 0; i < fChain.count(); ++i) {
if (fChain[i]->canDrawPath(target, pipelineBuilder, viewMatrix, path, stroke, antiAlias)) {
if (GrPathRenderer::kNoSupport_StencilSupport != minStencilSupport) {
GrPathRenderer::StencilSupport support =
fChain[i]->getStencilSupport(target, pipelineBuilder, path, stroke);
if (support < minStencilSupport) {
continue;
} else if (stencilSupport) {
*stencilSupport = support;
}
}
return fChain[i];
}
}
return NULL;
}
开发者ID:Ashu17,项目名称:blackberry,代码行数:44,代码来源:GrPathRendererChain.cpp
示例17: GR_STATIC_ASSERT
SkString GrDrawTargetCaps::dump() const {
SkString r;
static const char* gNY[] = {"NO", "YES"};
r.appendf("8 Bit Palette Support : %s\n", gNY[f8BitPaletteSupport]);
r.appendf("MIP Map Support : %s\n", gNY[fMipMapSupport]);
r.appendf("NPOT Texture Tile Support : %s\n", gNY[fNPOTTextureTileSupport]);
r.appendf("Two Sided Stencil Support : %s\n", gNY[fTwoSidedStencilSupport]);
r.appendf("Stencil Wrap Ops Support : %s\n", gNY[fStencilWrapOpsSupport]);
r.appendf("HW AA Lines Support : %s\n", gNY[fHWAALineSupport]);
r.appendf("Shader Derivative Support : %s\n", gNY[fShaderDerivativeSupport]);
r.appendf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]);
r.appendf("Dual Source Blending Support : %s\n", gNY[fDualSourceBlendingSupport]);
r.appendf("Buffer Lock Support : %s\n", gNY[fBufferLockSupport]);
r.appendf("Path Rendering Support : %s\n", gNY[fPathRenderingSupport]);
r.appendf("Dst Read In Shader Support : %s\n", gNY[fDstReadInShaderSupport]);
r.appendf("Discard Render Target Support: %s\n", gNY[fDiscardRenderTargetSupport]);
r.appendf("Reuse Scratch Textures : %s\n", gNY[fReuseScratchTextures]);
r.appendf("Gpu Tracing Support : %s\n", gNY[fGpuTracingSupport]);
r.appendf("Max Texture Size : %d\n", fMaxTextureSize);
r.appendf("Max Render Target Size : %d\n", fMaxRenderTargetSize);
r.appendf("Max Sample Count : %d\n", fMaxSampleCount);
static const char* kConfigNames[] = {
"Unknown", // kUnknown_GrPixelConfig
"Alpha8", // kAlpha_8_GrPixelConfig,
"Index8", // kIndex_8_GrPixelConfig,
"RGB565", // kRGB_565_GrPixelConfig,
"RGBA444", // kRGBA_4444_GrPixelConfig,
"RGBA8888", // kRGBA_8888_GrPixelConfig,
"BGRA8888", // kBGRA_8888_GrPixelConfig,
};
GR_STATIC_ASSERT(0 == kUnknown_GrPixelConfig);
GR_STATIC_ASSERT(1 == kAlpha_8_GrPixelConfig);
GR_STATIC_ASSERT(2 == kIndex_8_GrPixelConfig);
GR_STATIC_ASSERT(3 == kRGB_565_GrPixelConfig);
GR_STATIC_ASSERT(4 == kRGBA_4444_GrPixelConfig);
GR_STATIC_ASSERT(5 == kRGBA_8888_GrPixelConfig);
GR_STATIC_ASSERT(6 == kBGRA_8888_GrPixelConfig);
GR_STATIC_ASSERT(SK_ARRAY_COUNT(kConfigNames) == kGrPixelConfigCnt);
SkASSERT(!fConfigRenderSupport[kUnknown_GrPixelConfig][0]);
SkASSERT(!fConfigRenderSupport[kUnknown_GrPixelConfig][1]);
for (size_t i = 0; i < SK_ARRAY_COUNT(kConfigNames); ++i) {
if (i != kUnknown_GrPixelConfig) {
r.appendf("%s is renderable: %s, with MSAA: %s\n",
kConfigNames[i],
gNY[fConfigRenderSupport[i][0]],
gNY[fConfigRenderSupport[i][1]]);
}
}
return r;
}
开发者ID:danielbak,项目名称:skia,代码行数:52,代码来源:GrDrawTarget.cpp
示例18: GR_STATIC_ASSERT
void GrGLSLShaderBuilder::compileAndAppendLayoutQualifiers() {
static const char* interfaceQualifierNames[] = {
"out"
};
for (int interface = 0; interface <= kLastInterfaceQualifier; ++interface) {
const SkTArray<SkString>& params = fLayoutParams[interface];
if (params.empty()) {
continue;
}
this->layoutQualifiers().appendf("layout(%s", params[0].c_str());
for (int i = 1; i < params.count(); ++i) {
this->layoutQualifiers().appendf(", %s", params[i].c_str());
}
this->layoutQualifiers().appendf(") %s;\n", interfaceQualifierNames[interface]);
}
GR_STATIC_ASSERT(0 == GrGLSLShaderBuilder::kOut_InterfaceQualifier);
GR_STATIC_ASSERT(SK_ARRAY_COUNT(interfaceQualifierNames) == kLastInterfaceQualifier + 1);
}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:20,代码来源:GrGLSLShaderBuilder.cpp
示例19: GR_STATIC_ASSERT
GrPathRenderer* GrPathRendererChain::getPathRenderer(
const GrPathRenderer::CanDrawPathArgs& args,
DrawType drawType,
GrPathRenderer::StencilSupport* stencilSupport) {
GR_STATIC_ASSERT(GrPathRenderer::kNoSupport_StencilSupport <
GrPathRenderer::kStencilOnly_StencilSupport);
GR_STATIC_ASSERT(GrPathRenderer::kStencilOnly_StencilSupport <
GrPathRenderer::kNoRestriction_StencilSupport);
GrPathRenderer::StencilSupport minStencilSupport;
if (kStencilOnly_DrawType == drawType) {
minStencilSupport = GrPathRenderer::kStencilOnly_StencilSupport;
} else if (kStencilAndColor_DrawType == drawType ||
kStencilAndColorAntiAlias_DrawType == drawType) {
minStencilSupport = GrPathRenderer::kNoRestriction_StencilSupport;
} else {
minStencilSupport = GrPathRenderer::kNoSupport_StencilSupport;
}
if (minStencilSupport != GrPathRenderer::kNoSupport_StencilSupport) {
// We don't support (and shouldn't need) stenciling of non-fill paths.
if (!args.fStyle->isSimpleFill()) {
return nullptr;
}
}
for (int i = 0; i < fChain.count(); ++i) {
if (fChain[i]->canDrawPath(args)) {
if (GrPathRenderer::kNoSupport_StencilSupport != minStencilSupport) {
GrPathRenderer::StencilSupport support =
fChain[i]->getStencilSupport(*args.fPath);
if (support < minStencilSupport) {
continue;
} else if (stencilSupport) {
*stencilSupport = support;
}
}
return fChain[i];
}
}
return nullptr;
}
开发者ID:C-Tillion,项目名称:skia,代码行数:40,代码来源:GrPathRendererChain.cpp
示例20: fContext
SkMesaGLContext::SkMesaGLContext()
: fContext(static_cast<Context>(NULL))
, fImage(NULL) {
GR_STATIC_ASSERT(sizeof(Context) == sizeof(OSMesaContext));
/* Create an RGBA-mode context */
#if OSMESA_MAJOR_VERSION * 100 + OSMESA_MINOR_VERSION >= 305
/* specify Z, stencil, accum sizes */
fContext = (Context)OSMesaCreateContextExt(OSMESA_BGRA, 0, 0, 0, NULL);
#else
fContext = (Context)OSMesaCreateContext(OSMESA_BGRA, NULL);
#endif
if (!fContext) {
SkDebugf("OSMesaCreateContext failed!\n");
this->destroyGLContext();
return;
}
// Allocate the image buffer
fImage = (GrGLubyte *) sk_malloc_throw(gBOGUS_SIZE * gBOGUS_SIZE *
4 * sizeof(GrGLubyte));
if (!fImage) {
SkDebugf("Alloc image buffer failed!\n");
this->destroyGLContext();
return;
}
// Bind the buffer to the context and make it current
if (!OSMesaMakeCurrent((OSMesaContext)fContext,
fImage,
GR_GL_UNSIGNED_BYTE,
gBOGUS_SIZE,
gBOGUS_SIZE)) {
SkDebugf("OSMesaMakeCurrent failed!\n");
this->destroyGLContext();
return;
}
SkAutoTUnref<const GrGLInterface> gl(GrGLCreateMesaInterface());
if (NULL == gl.get()) {
SkDebugf("Could not create GL interface!\n");
this->destroyGLContext();
return;
}
if (!gl->validate()) {
SkDebugf("Could not validate GL interface!\n");
this->destroyGLContext();
return;
}
this->init(gl.detach());
}
开发者ID:mariospr,项目名称:chromium-browser,代码行数:52,代码来源:SkMesaGLContext.cpp
注:本文中的GR_STATIC_ASSERT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论