diff options
Diffstat (limited to 'src/gpu')
60 files changed, 651 insertions, 651 deletions
diff --git a/src/gpu/FlingState.cpp b/src/gpu/FlingState.cpp index 050a810499..8d9e1c5607 100644 --- a/src/gpu/FlingState.cpp +++ b/src/gpu/FlingState.cpp @@ -110,13 +110,13 @@ float GrAnimateFloat::evaluate() { if (!fTime0) { return fValue1; } - + double elapsed = (SkTime::GetMSecs() - fTime0) * 0.001; if (elapsed >= fDuration) { fTime0 = 0; return fValue1; } - + double t = elapsed / fDuration; if (true) { t = (3 - 2 * t) * t * t; diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp index 1857beb22f..718cfdd199 100644 --- a/src/gpu/GrAAConvexPathRenderer.cpp +++ b/src/gpu/GrAAConvexPathRenderer.cpp @@ -226,7 +226,7 @@ bool get_segments(const SkPath& path, // This renderer overemphasises very thin path regions. We use the distance // to the path from the sample to compute coverage. Every pixel intersected // by the path will be hit and the maximum distance is sqrt(2)/2. We don't - // notice that the sample may be close to a very thin area of the path and + // notice that the sample may be close to a very thin area of the path and // thus should be very light. This is particularly egregious for degenerate // line paths. We detect paths that are very close to a line (zero area) and // draw nothing. @@ -299,7 +299,7 @@ struct QuadVertex { GrScalar fD0; GrScalar fD1; }; - + void create_vertices(const SegmentArray& segments, const SkPoint& fanPt, QuadVertex* verts, @@ -312,7 +312,7 @@ void create_vertices(const SegmentArray& segments, const Segment& sega = segments[a]; int b = (a + 1) % count; const Segment& segb = segments[b]; - + // FIXME: These tris are inset in the 1 unit arc around the corner verts[v + 0].fPos = sega.endPt(); verts[v + 1].fPos = verts[v + 0].fPos + sega.endNorm(); @@ -326,14 +326,14 @@ void create_vertices(const SegmentArray& segments, verts[v + 1].fD0 = verts[v + 1].fD1 = -SK_Scalar1; verts[v + 2].fD0 = verts[v + 2].fD1 = -SK_Scalar1; verts[v + 3].fD0 = verts[v + 3].fD1 = -SK_Scalar1; - + idxs[i + 0] = v + 0; idxs[i + 1] = v + 2; idxs[i + 2] = v + 1; idxs[i + 3] = v + 0; idxs[i + 4] = v + 3; idxs[i + 5] = v + 2; - + v += 4; i += 6; diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp index 43e87d61e6..94b607ce12 100644 --- a/src/gpu/GrAAHairLinePathRenderer.cpp +++ b/src/gpu/GrAAHairLinePathRenderer.cpp @@ -139,7 +139,7 @@ int get_float_exp(float x) { // if it returns -1 then should be drawn as lines int num_quad_subdivs(const SkPoint p[3]) { static const SkScalar gDegenerateToLineTol = SK_Scalar1; - static const SkScalar gDegenerateToLineTolSqd = + static const SkScalar gDegenerateToLineTolSqd = SkScalarMul(gDegenerateToLineTol, gDegenerateToLineTol); if (p[0].distanceToSqd(p[1]) < gDegenerateToLineTolSqd || @@ -177,7 +177,7 @@ int num_quad_subdivs(const SkPoint p[3]) { return log; #else SkScalar log = SkScalarLog( - SkScalarDiv(dsqd, + SkScalarDiv(dsqd, SkScalarMul(gSubdivTol, gSubdivTol))); static const SkScalar conv = SkScalarInvert(SkScalarLog(2)); log = SkScalarMul(log, conv); @@ -269,7 +269,7 @@ int generate_lines_and_quads(const SkPath& path, // We convert cubics to quadratics (for now). // In perspective have to do conversion in src space. if (persp) { - SkScalar tolScale = + SkScalar tolScale = GrPathUtils::scaleToleranceToSrc(SK_Scalar1, m, path.getBounds()); GrPathUtils::convertCubicToQuads(pts, tolScale, false, kDummyDir, &q); @@ -351,7 +351,7 @@ void intersect_lines(const SkPoint& ptA, const SkVector& normA, result->fX = SkScalarMul(normA.fY, lineBW) - SkScalarMul(lineAW, normB.fY); result->fX = SkScalarMul(result->fX, wInv); - + result->fY = SkScalarMul(lineAW, normB.fX) - SkScalarMul(normA.fX, lineBW); result->fY = SkScalarMul(result->fY, wInv); } @@ -512,7 +512,7 @@ bool GrAAHairLinePathRenderer::createGeom( int rtHeight = drawState.getRenderTarget()->height(); GrIRect devClipBounds; - target->getClip()->getConservativeBounds(drawState.getRenderTarget(), + target->getClip()->getConservativeBounds(drawState.getRenderTarget(), &devClipBounds); GrVertexLayout layout = GrDrawTarget::kEdge_VertexLayoutBit; @@ -611,7 +611,7 @@ bool GrAAHairLinePathRenderer::onDrawPath(const SkPath& path, } drawState->viewMatrix()->reset(); } - + // TODO: See whether rendering lines as degenerate quads improves perf // when we have a mix diff --git a/src/gpu/GrAddPathRenderers_none.cpp b/src/gpu/GrAddPathRenderers_none.cpp index 46855db7ff..02da710724 100644 --- a/src/gpu/GrAddPathRenderers_none.cpp +++ b/src/gpu/GrAddPathRenderers_none.cpp @@ -10,6 +10,6 @@ #include "GrPathRenderer.h" -void GrPathRenderer::AddPathRenderers(GrContext*, +void GrPathRenderer::AddPathRenderers(GrContext*, GrPathRendererChain::UsageFlags, GrPathRendererChain*) {} diff --git a/src/gpu/GrAllocPool.cpp b/src/gpu/GrAllocPool.cpp index ecd2acfa05..39f8350c16 100644 --- a/src/gpu/GrAllocPool.cpp +++ b/src/gpu/GrAllocPool.cpp @@ -40,7 +40,7 @@ struct GrAllocPool::Block { fPtr += bytes; return ptr; } - + size_t release(size_t bytes) { GrAssert(bytes > 0); size_t free = GrMin(bytes, fBytesTotal - fBytesFree); @@ -48,7 +48,7 @@ struct GrAllocPool::Block { fPtr -= free; return bytes - free; } - + bool empty() const { return fBytesTotal == fBytesFree; } }; @@ -79,7 +79,7 @@ void GrAllocPool::reset() { void* GrAllocPool::alloc(size_t size) { this->validate(); - + if (!fBlock || !fBlock->canAlloc(size)) { size_t blockSize = GrMax(fMinBlockSize, size); fBlock = Block::Create(blockSize, fBlock); @@ -90,7 +90,7 @@ void* GrAllocPool::alloc(size_t size) { void GrAllocPool::release(size_t bytes) { this->validate(); - + while (bytes && NULL != fBlock) { bytes = fBlock->release(bytes); if (fBlock->empty()) { diff --git a/src/gpu/GrAllocPool.h b/src/gpu/GrAllocPool.h index 3ecc4aa189..3489cb9563 100644 --- a/src/gpu/GrAllocPool.h +++ b/src/gpu/GrAllocPool.h @@ -29,7 +29,7 @@ public: * address was allocated by malloc or new (because it hasn't). */ void* alloc(size_t bytes); - + /** * Releases the most recently allocated bytes back to allocpool. */ diff --git a/src/gpu/GrBufferAllocPool.cpp b/src/gpu/GrBufferAllocPool.cpp index 70924f27b9..c2ee357ed5 100644 --- a/src/gpu/GrBufferAllocPool.cpp +++ b/src/gpu/GrBufferAllocPool.cpp @@ -134,11 +134,11 @@ void GrBufferAllocPool::validate(bool unusedBlockAllowed) const { GrAssert(!fBlocks[i].fBuffer->isLocked()); } for (int i = 0; i < fBlocks.count(); ++i) { - size_t bytes = fBlocks[i].fBuffer->sizeInBytes() - fBlocks[i].fBytesFree; + size_t bytes = fBlocks[i].fBuffer->sizeInBytes() - fBlocks[i].fBytesFree; bytesInUse += bytes; GrAssert(bytes || unusedBlockAllowed); } - + GrAssert(bytesInUse == fBytesInUse); if (unusedBlockAllowed) { GrAssert((fBytesInUse && !fBlocks.empty()) || @@ -181,7 +181,7 @@ void* GrBufferAllocPool::makeSpace(size_t size, // may be cheating on the actual buffer size by shrinking the buffer on // updateData() if the amount of data passed is less than the full buffer // size. - + if (!createBlock(size)) { return NULL; } diff --git a/src/gpu/GrBufferAllocPool.h b/src/gpu/GrBufferAllocPool.h index 3e2cd395c6..7ed4b0c07e 100644 --- a/src/gpu/GrBufferAllocPool.h +++ b/src/gpu/GrBufferAllocPool.h @@ -164,7 +164,7 @@ private: #if GR_DEBUG void validate(bool unusedBlockAllowed = false) const; #endif - + size_t fBytesInUse; GrGpu* fGpu; diff --git a/src/gpu/GrCacheID.cpp b/src/gpu/GrCacheID.cpp index 5f60d94e4b..4c6dd492c3 100644 --- a/src/gpu/GrCacheID.cpp +++ b/src/gpu/GrCacheID.cpp @@ -10,7 +10,7 @@ uint8_t GrCacheID::GetNextDomain() { // 0 reserved for kUnrestricted_ResourceDomain - static int32_t gNextDomain = 1; + static int32_t gNextDomain = 1; int32_t domain = sk_atomic_inc(&gNextDomain); if (domain >= 256) { @@ -22,7 +22,7 @@ uint8_t GrCacheID::GetNextDomain() { uint8_t GrCacheID::GetNextResourceType() { // 0 reserved for kInvalid_ResourceType - static int32_t gNextResourceType = 1; + static int32_t gNextResourceType = 1; int32_t type = sk_atomic_inc(&gNextResourceType); if (type >= 256) { diff --git a/src/gpu/GrClipData.cpp b/src/gpu/GrClipData.cpp index 488643d1d1..7c84c18a9b 100644 --- a/src/gpu/GrClipData.cpp +++ b/src/gpu/GrClipData.cpp @@ -23,7 +23,7 @@ void GrClipData::getConservativeBounds(const GrSurface* surface, bool* isIntersectionOfRects) const { GrRect devBounds; - fClipStack->getConservativeBounds(-fOrigin.fX, + fClipStack->getConservativeBounds(-fOrigin.fX, -fOrigin.fY, surface->width(), surface->height(), diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp index a1cd75b5f8..de8f323ce6 100644 --- a/src/gpu/GrClipMaskManager.cpp +++ b/src/gpu/GrClipMaskManager.cpp @@ -26,7 +26,7 @@ GR_DEFINE_RESOURCE_CACHE_DOMAIN(GrClipMaskManager, GetAlphaMaskDomain) GrClipMaskCache::GrClipMaskCache() : fContext(NULL) , fStack(sizeof(GrClipStackFrame)) { - // We need an initial frame to capture the clip state prior to + // We need an initial frame to capture the clip state prior to // any pushes SkNEW_PLACEMENT(fStack.push_back(), GrClipStackFrame); } @@ -37,10 +37,10 @@ void GrClipMaskCache::push() { //////////////////////////////////////////////////////////////////////////////// namespace { -// set up the draw state to enable the aa clipping mask. Besides setting up the +// set up the draw state to enable the aa clipping mask. Besides setting up the // sampler matrix this also alters the vertex layout -void setup_drawstate_aaclip(GrGpu* gpu, - GrTexture* result, +void setup_drawstate_aaclip(GrGpu* gpu, + GrTexture* result, const GrIRect &devBound) { GrDrawState* drawState = gpu->drawState(); GrAssert(drawState); @@ -49,7 +49,7 @@ void setup_drawstate_aaclip(GrGpu* gpu, GrMatrix mat; mat.setIDiv(result->width(), result->height()); - mat.preTranslate(SkIntToScalar(-devBound.fLeft), + mat.preTranslate(SkIntToScalar(-devBound.fLeft), SkIntToScalar(-devBound.fTop)); mat.preConcat(drawState->getViewMatrix()); @@ -134,8 +134,8 @@ bool GrClipMaskManager::useSWOnlyPath(const SkClipStack& clipIn) { // rects can always be drawn directly w/o using the software path // so only paths need to be checked if (NULL != clip->fPath && - path_needs_SW_renderer(this->getContext(), fGpu, - *clip->fPath, + path_needs_SW_renderer(this->getContext(), fGpu, + *clip->fPath, get_path_fill(*clip->fPath), clip->fDoAA)) { useSW = true; @@ -165,7 +165,7 @@ bool GrClipMaskManager::setupClipping(const GrClipData* clipDataIn) { GrIRect devClipBounds; bool isIntersectionOfRects = false; - clipDataIn->getConservativeBounds(rt, &devClipBounds, + clipDataIn->getConservativeBounds(rt, &devClipBounds, &isIntersectionOfRects); if (devClipBounds.isEmpty()) { return false; @@ -175,11 +175,11 @@ bool GrClipMaskManager::setupClipping(const GrClipData* clipDataIn) { #if GR_SW_CLIP // If MSAA is enabled we can do everything in the stencil buffer. - // Otherwise check if we should just create the entire clip mask + // Otherwise check if we should just create the entire clip mask // in software (this will only happen if the clip mask is anti-aliased // and too complex for the gpu to handle in its entirety) if (0 == rt->numSamples() && - requiresAA && + requiresAA && this->useSWOnlyPath(*clipDataIn->fClipStack)) { // The clip geometry is complex enough that it will be more // efficient to create it entirely in software @@ -219,12 +219,12 @@ bool GrClipMaskManager::setupClipping(const GrClipData* clipDataIn) { } #endif // GR_AA_CLIP - // Either a hard (stencil buffer) clip was explicitly requested or + // Either a hard (stencil buffer) clip was explicitly requested or // an antialiased clip couldn't be created. In either case, free up // the texture in the antialiased mask cache. // TODO: this may require more investigation. Ganesh performs a lot of // utility draws (e.g., clears, InOrderDrawBuffer playbacks) that hit - // the stencil buffer path. These may be "incorrectly" clearing the + // the stencil buffer path. These may be "incorrectly" clearing the // AA cache. fAACache.reset(); @@ -237,7 +237,7 @@ bool GrClipMaskManager::setupClipping(const GrClipData* clipDataIn) { } // use the stencil clip if we can't represent the clip as a rectangle. - bool useStencil = !clipDataIn->fClipStack->isWideOpen() && + bool useStencil = !clipDataIn->fClipStack->isWideOpen() && !devClipBounds.isEmpty(); if (useStencil) { @@ -269,13 +269,13 @@ namespace { * "devContainee" is in device coordiates. "origin" provides the mapping between * the two. */ -bool contains(const SkRect& canvContainer, +bool contains(const SkRect& canvContainer, const SkIRect& devContainee, const SkIPoint& origin) { return !devContainee.isEmpty() && !canvContainer.isEmpty() && - canvContainer.fLeft <= SkIntToScalar(devContainee.fLeft+origin.fX) && + canvContainer.fLeft <= SkIntToScalar(devContainee.fLeft+origin.fX) && canvContainer.fTop <= SkIntToScalar(devContainee.fTop+origin.fY) && - canvContainer.fRight >= SkIntToScalar(devContainee.fRight+origin.fX) && + canvContainer.fRight >= SkIntToScalar(devContainee.fRight+origin.fX) && canvContainer.fBottom >= SkIntToScalar(devContainee.fBottom+origin.fY); } @@ -292,7 +292,7 @@ const SkClipStack::Iter::Clip* process_initial_clip_elements( GrAssert(NULL != iter && NULL != clearToInside && NULL != firstOp); - // logically before the first element of the clip stack is + // logically before the first element of the clip stack is // processed the clip is entirely open. However, depending on the // first set op we may prefer to clear to 0 for performance. We may // also be able to skip the initial clip paths/rects. We loop until @@ -331,7 +331,7 @@ const SkClipStack::Iter::Clip* process_initial_clip_elements( // we can skip a leading union. case SkRegion::kUnion_Op: // if everything is initially outside then union is - // same as replace. Otherwise, every pixel is still + // same as replace. Otherwise, every pixel is still // clearToInside if (!*clearToInside) { *firstOp = SkRegion::kReplace_Op; @@ -385,8 +385,8 @@ const SkClipStack::Iter::Clip* process_initial_clip_elements( namespace { //////////////////////////////////////////////////////////////////////////////// -// set up the OpenGL blend function to perform the specified -// boolean operation for alpha clip mask creation +// set up the OpenGL blend function to perform the specified +// boolean operation for alpha clip mask creation void setup_boolean_blendcoeffs(GrDrawState* drawState, SkRegion::Op op) { switch (op) { @@ -423,8 +423,8 @@ bool draw_path_in_software(GrContext* context, const GrIRect& resultBounds) { SkAutoTUnref<GrTexture> texture( - GrSWMaskHelper::DrawPathMaskToTexture(context, path, - resultBounds, fill, + GrSWMaskHelper::DrawPathMaskToTexture(context, path, + resultBounds, fill, doAA, NULL)); if (NULL == texture) { return false; @@ -510,7 +510,7 @@ void GrClipMaskManager::drawTexture(GrTexture* target, drawState->sampler(0)->reset(sampleM); drawState->createTextureEffect(0, texture); - GrRect rect = GrRect::MakeWH(SkIntToScalar(target->width()), + GrRect rect = GrRect::MakeWH(SkIntToScalar(target->width()), SkIntToScalar(target->height())); fGpu->drawSimpleRect(rect, NULL); @@ -520,7 +520,7 @@ void GrClipMaskManager::drawTexture(GrTexture* target, // get a texture to act as a temporary buffer for AA clip boolean operations // TODO: given the expense of createTexture we may want to just cache this too -void GrClipMaskManager::getTemp(const GrIRect& bounds, +void GrClipMaskManager::getTemp(const GrIRect& bounds, GrAutoScratchTexture* temp) { if (NULL != temp->texture()) { // we've already allocated the temp texture @@ -578,7 +578,7 @@ bool GrClipMaskManager::clipMaskPreamble(const GrClipData& clipDataIn, // TODO: make sure we don't outset if bounds are still 0,0 @ min - if (fAACache.canReuse(*clipDataIn.fClipStack, + if (fAACache.canReuse(*clipDataIn.fClipStack, devClipBounds.width(), devClipBounds.height())) { *result = fAACache.getLastMask(); @@ -620,17 +620,17 @@ bool GrClipMaskManager::createAlphaClipMask(const GrClipData& clipDataIn, if (0 != devResultBounds->fTop || 0 != devResultBounds->fLeft || 0 != clipDataIn.fOrigin.fX || 0 != clipDataIn.fOrigin.fY) { - // if we were able to trim down the size of the mask we need to + // if we were able to trim down the size of the mask we need to // offset the paths & rects that will be used to compute it drawState->viewMatrix()->setTranslate( - SkIntToScalar(-devResultBounds->fLeft-clipDataIn.fOrigin.fX), + SkIntToScalar(-devResultBounds->fLeft-clipDataIn.fOrigin.fX), SkIntToScalar(-devResultBounds->fTop-clipDataIn.fOrigin.fY)); } bool clearToInside; SkRegion::Op firstOp = SkRegion::kReplace_Op; // suppress warning - SkClipStack::Iter iter(*clipDataIn.fClipStack, + SkClipStack::Iter iter(*clipDataIn.fClipStack, SkClipStack::Iter::kBottom_IterStart); const SkClipStack::Iter::Clip* clip = process_initial_clip_elements(&iter, *devResultBounds, @@ -638,8 +638,8 @@ bool GrClipMaskManager::createAlphaClipMask(const GrClipData& clipDataIn, &firstOp, clipDataIn); - fGpu->clear(NULL, - clearToInside ? 0xffffffff : 0x00000000, + fGpu->clear(NULL, + clearToInside ? 0xffffffff : 0x00000000, accum->asRenderTarget()); GrAutoScratchTexture temp; @@ -698,12 +698,12 @@ bool GrClipMaskManager::createAlphaClipMask(const GrClipData& clipDataIn, if (0 != devResultBounds->fTop || 0 != devResultBounds->fLeft || 0 != clipDataIn.fOrigin.fX || 0 != clipDataIn.fOrigin.fY) { drawState->viewMatrix()->setTranslate( - SkIntToScalar(-devResultBounds->fLeft-clipDataIn.fOrigin.fX), + SkIntToScalar(-devResultBounds->fLeft-clipDataIn.fOrigin.fX), SkIntToScalar(-devResultBounds->fTop-clipDataIn.fOrigin.fY)); } } else { - // all the remaining ops can just be directly draw into + // all the remaining ops can just be directly draw into // the accumulation buffer setup_boolean_blendcoeffs(drawState, op); this->drawClipShape(accum, clip, *devResultBounds); @@ -716,7 +716,7 @@ bool GrClipMaskManager::createAlphaClipMask(const GrClipData& clipDataIn, } //////////////////////////////////////////////////////////////////////////////// -// Create a 1-bit clip mask in the stencil buffer. 'devClipBounds' are in device +// Create a 1-bit clip mask in the stencil buffer. 'devClipBounds' are in device // (as opposed to canvas) coordinates bool GrClipMaskManager::createStencilClipMask(const GrClipData& clipDataIn, const GrIRect& devClipBounds) { @@ -759,10 +759,10 @@ bool GrClipMaskManager::createStencilClipMask(const GrClipData& clipDataIn, GrDrawTarget::AutoGeometryPush agp(fGpu); if (0 != clipDataIn.fOrigin.fX || 0 != clipDataIn.fOrigin.fY) { - // Add the saveLayer's offset to the view matrix rather than + // Add the saveLayer's offset to the view matrix rather than // offset each individual draw drawState->viewMatrix()->setTranslate( - SkIntToScalar(-clipDataIn.fOrigin.fX), + SkIntToScalar(-clipDataIn.fOrigin.fX), SkIntToScalar(-clipDataIn.fOrigin.fY)); } @@ -780,7 +780,7 @@ bool GrClipMaskManager::createStencilClipMask(const GrClipData& clipDataIn, bool clearToInside; SkRegion::Op firstOp = SkRegion::kReplace_Op; // suppress warning - SkClipStack::Iter iter(*oldClipData->fClipStack, + SkClipStack::Iter iter(*oldClipData->fClipStack, SkClipStack::Iter::kBottom_IterStart); const SkClipStack::Iter::Clip* clip = process_initial_clip_elements(&iter, devRTRect, @@ -898,8 +898,8 @@ bool GrClipMaskManager::createStencilClipMask(const GrClipData& clipDataIn, } } else { SET_RANDOM_COLOR - // 'devClipBounds' is already in device coordinates so the - // translation in the view matrix is inappropriate. + // 'devClipBounds' is already in device coordinates so the + // translation in the view matrix is inappropriate. // Convert it to canvas space so the drawn rect will // be in the correct location GrRect canvClipBounds; @@ -921,7 +921,7 @@ bool GrClipMaskManager::createStencilClipMask(const GrClipData& clipDataIn, // mapping of clip-respecting stencil funcs to normal stencil funcs // mapping depends on whether stencil-clipping is in effect. -static const GrStencilFunc +static const GrStencilFunc gSpecialToBasicStencilFunc[2][kClipStencilFuncCount] = { {// Stencil-Clipping is DISABLED, we are effectively always inside the clip // In the Clip Funcs @@ -966,7 +966,7 @@ const GrStencilSettings& basic_apply_stencil_clip_settings() { kAlwaysIfInClip_StencilFunc, 0x0000, 0x0000, - 0x0000); + 0x0000); return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings); } } @@ -1010,7 +1010,7 @@ void GrClipMaskManager::setGpuStencil() { // TODO: dynamically attach a stencil buffer int stencilBits = 0; - GrStencilBuffer* stencilBuffer = + GrStencilBuffer* stencilBuffer = drawState.getRenderTarget()->getStencilBuffer(); if (NULL != stencilBuffer) { stencilBits = stencilBuffer->bits(); @@ -1078,7 +1078,7 @@ void GrClipMaskManager::adjustStencilParams(GrStencilSettings* settings, funcMask &= userBits; funcRef &= userBits; } - const GrStencilFunc* table = + const GrStencilFunc* table = gSpecialToBasicStencilFunc[respectClip]; func = table[func - kBasicStencilFuncCount]; GrAssert(func >= 0 && func < kBasicStencilFuncCount); @@ -1145,14 +1145,14 @@ bool GrClipMaskManager::createSoftwareClipMask(const GrClipData& clipDataIn, GrSWMaskHelper helper(this->getContext()); GrMatrix matrix; - matrix.setTranslate(SkIntToScalar(-clipDataIn.fOrigin.fX), + matrix.setTranslate(SkIntToScalar(-clipDataIn.fOrigin.fX), SkIntToScalar(-clipDataIn.fOrigin.fY)); helper.init(*devResultBounds, &matrix); bool clearToInside; SkRegion::Op firstOp = SkRegion::kReplace_Op; // suppress warning - SkClipStack::Iter iter(*clipDataIn.fClipStack, + SkClipStack::Iter iter(*clipDataIn.fClipStack, SkClipStack::Iter::kBottom_IterStart); const SkClipStack::Iter::Clip* clip = process_initial_clip_elements(&iter, *devResultBounds, @@ -1193,7 +1193,7 @@ bool GrClipMaskManager::createSoftwareClipMask(const GrClipData& clipDataIn, SkPath temp; temp.addRect(*clip->fRect); - helper.draw(temp, SkRegion::kReplace_Op, + helper.draw(temp, SkRegion::kReplace_Op, kInverseEvenOdd_GrPathFill, clip->fDoAA, 0x00); } else if (NULL != clip->fPath) { @@ -1216,7 +1216,7 @@ bool GrClipMaskManager::createSoftwareClipMask(const GrClipData& clipDataIn, clip->fDoAA, 0xFF); } else if (NULL != clip->fPath) { - helper.draw(*clip->fPath, + helper.draw(*clip->fPath, op, get_path_fill(*clip->fPath), clip->fDoAA, 0xFF); diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index 6f1e24d3c5..d1fdb1803b 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -146,7 +146,7 @@ void GrContext::resetContext() { void GrContext::freeGpuResources() { this->flush(); - + fGpu->purgeResources(); fAARectRenderer->reset(); @@ -275,7 +275,7 @@ static void stretchImage(void* dst, } } -// The desired texture is NPOT and tiled but that isn't supported by +// The desired texture is NPOT and tiled but that isn't supported by // the current hardware. Resize the texture to be a POT GrTexture* GrContext::createResizedTexture(const GrTextureDesc& desc, const GrCacheData& cacheData, @@ -373,7 +373,7 @@ GrTexture* GrContext::createAndLockTexture( GrTexture* texture = NULL; if (GrTexture::NeedsResizing(resourceKey)) { texture = this->createResizedTexture(desc, cacheData, - srcData, rowBytes, + srcData, rowBytes, GrTexture::NeedsFiltering(resourceKey)); } else { texture = fGpu->createTexture(desc, srcData, rowBytes); @@ -416,12 +416,12 @@ GrTexture* GrContext::lockScratchTexture(const GrTextureDesc& inDesc, if (NULL != resource || kExact_ScratchTexMatch == match) { break; } - // We no longer try to reuse textures that were previously used as render targets in + // We no longer try to reuse textures that were previously used as render targets in // situations where no RT is needed; doing otherwise can confuse the video driver and // cause significant performance problems in some cases. if (desc.fFlags & kNoStencil_GrTextureFlagBit) { desc.fFlags = desc.fFlags & ~kNoStencil_GrTextureFlagBit; - } else if (!doubledW) { + } else if (!doubledW) { desc.fFlags = inDesc.fFlags; desc.fWidth *= 2; doubledW = true; @@ -433,7 +433,7 @@ GrTexture* GrContext::lockScratchTexture(const GrTextureDesc& inDesc, } else { break; } - + } while (true); if (NULL == resource) { @@ -554,7 +554,7 @@ bool GrContext::supportsIndex8PixelConfig(const GrTextureParams* params, //////////////////////////////////////////////////////////////////////////////// const GrClipData* GrContext::getClip() const { - return fGpu->getClip(); + return fGpu->getClip(); } void GrContext::setClip(const GrClipData* clipData) { @@ -649,19 +649,19 @@ static void setStrokeRectStrip(GrPoint verts[10], GrRect rect, * Returns true if the rects edges are integer-aligned. */ static bool isIRect(const GrRect& r) { - return GrScalarIsInt(r.fLeft) && GrScalarIsInt(r.fTop) && + return GrScalarIsInt(r.fLeft) && GrScalarIsInt(r.fTop) && GrScalarIsInt(r.fRight) && GrScalarIsInt(r.fBottom); } static bool apply_aa_to_rect(GrDrawTarget* target, const GrRect& rect, - GrScalar width, + GrScalar width, const GrMatrix* matrix, GrMatrix* combinedMatrix, GrRect* devRect, bool* useVertexCoverage) { // we use a simple coverage ramp to do aa on axis-aligned rects - // we check if the rect will be axis-aligned, and the rect won't land on + // we check if the rect will be axis-aligned, and the rect won't land on // integer coords. // we are keeping around the "tweak the alpha" trick because @@ -692,7 +692,7 @@ static bool apply_aa_to_rect(GrDrawTarget* target, return false; } - if (NULL != matrix && + if (NULL != matrix && !matrix->preservesAxisAlignment()) { return false; } @@ -702,7 +702,7 @@ static bool apply_aa_to_rect(GrDrawTarget* target, combinedMatrix->preConcat(*matrix); GrAssert(combinedMatrix->preservesAxisAlignment()); } - + combinedMatrix->mapRect(devRect, rect); devRect->sort(); @@ -745,10 +745,10 @@ void GrContext::drawRect(const GrPaint& paint, } else { strokeSize.set(GR_Scalar1, GR_Scalar1); } - fAARectRenderer->strokeAARect(this->getGpu(), target, devRect, + fAARectRenderer->strokeAARect(this->getGpu(), target, devRect, strokeSize, useVertexCoverage); } else { - fAARectRenderer->fillAARect(this->getGpu(), target, + fAARectRenderer->fillAARect(this->getGpu(), target, devRect, useVertexCoverage); } return; @@ -815,7 +815,7 @@ void GrContext::drawRect(const GrPaint& paint, } drawState->preConcatViewMatrix(m); drawState->preConcatSamplerMatrices(m); - + target->drawNonIndexed(kTriangleFan_GrPrimitiveType, 0, 4); #else target->drawSimpleRect(rect, matrix); @@ -941,7 +941,7 @@ void GrContext::drawVertices(const GrPaint& paint, target->setVertexSourceToArray(layout, positions, vertexCount); } - // we don't currently apply offscreen AA to this path. Need improved + // we don't currently apply offscreen AA to this path. Need improved // management of GrDrawTarget's geometry to avoid copying points per-tile. if (NULL != indices) { @@ -1182,7 +1182,7 @@ void GrContext::writeTexturePixels(GrTexture* texture, this->flush(); } - fGpu->writeTexturePixels(texture, left, top, width, height, + fGpu->writeTexturePixels(texture, left, top, width, height, config, buffer, rowBytes); } @@ -1244,7 +1244,7 @@ bool GrContext::readRenderTargetPixels(GrRenderTarget* target, SK_TRACE_EVENT0("GrContext::readRenderTargetPixels"); ASSERT_OWNED_RESOURCE(target); - if (NULL == target) { + if (NULL == target) { target = fDrawState->getRenderTarget(); if (NULL == target) { return false; @@ -1399,7 +1399,7 @@ void GrContext::copyTexture(GrTexture* src, GrRenderTarget* dst) { fGpu->drawSimpleRect(rect, NULL); } -void GrContext::writeRenderTargetPixels(GrRenderTarget* target, +void GrContext::writeRenderTargetPixels(GrRenderTarget* target, int left, int top, int width, int height, GrPixelConfig config, const void* buffer, @@ -1408,7 +1408,7 @@ void GrContext::writeRenderTargetPixels(GrRenderTarget* target, SK_TRACE_EVENT0("GrContext::writeRenderTargetPixels"); ASSERT_OWNED_RESOURCE(target); - if (NULL == target) { + if (NULL == target) { target = fDrawState->getRenderTarget(); if (NULL == target) { return; @@ -1421,7 +1421,7 @@ void GrContext::writeRenderTargetPixels(GrRenderTarget* target, // If the RT is also a texture and we don't have to premultiply then take the texture path. // We expect to be at least as fast or faster since it doesn't use an intermediate texture as // we do below. - + #if !GR_MAC_BUILD // At least some drivers on the Mac get confused when glTexImage2D is called // on a texture attached to an FBO. The FBO still sees the old image. TODO: @@ -1521,7 +1521,7 @@ void GrContext::setPaint(const GrPaint& paint) { *fDrawState->sampler(s) = paint.getMaskSampler(i); } } - + // disable all stages not accessible via the paint for (int s = GrPaint::kTotalStages; s < GrDrawState::kNumStages; ++s) { fDrawState->disableStage(s); @@ -1577,7 +1577,7 @@ GrDrawTarget* GrContext::prepareToDraw(const GrPaint* paint, BufferedDraw buffer /* * This method finds a path renderer that can draw the specified path on * the provided target. - * Due to its expense, the software path renderer has split out so it can + * Due to its expense, the software path renderer has split out so it can * can be individually allowed/disallowed via the "allowSW" boolean. */ GrPathRenderer* GrContext::getPathRenderer(const SkPath& path, @@ -1586,7 +1586,7 @@ GrPathRenderer* GrContext::getPathRenderer(const SkPath& path, bool antiAlias, bool allowSW) { if (NULL == fPathRendererChain) { - fPathRendererChain = + fPathRendererChain = SkNEW_ARGS(GrPathRendererChain, (this, GrPathRendererChain::kNone_UsageFlag)); } @@ -1726,7 +1726,7 @@ GrTexture* GrContext::gaussianBlur(GrTexture* srcTexture, SkRect srcRect(rect); scale_rect(&srcRect, 1.0f / scaleFactorX, 1.0f / scaleFactorY); srcRect.roundOut(); - scale_rect(&srcRect, static_cast<float>(scaleFactorX), + scale_rect(&srcRect, static_cast<float>(scaleFactorX), static_cast<float>(scaleFactorY)); AutoClip acs(this, srcRect); @@ -1771,7 +1771,7 @@ GrTexture* GrContext::gaussianBlur(GrTexture* srcTexture, if (scaleFactorX > 1) { // Clear out a radius to the right of the srcRect to prevent the // X convolution from reading garbage. - clearRect = SkIRect::MakeXYWH(srcIRect.fRight, srcIRect.fTop, + clearRect = SkIRect::MakeXYWH(srcIRect.fRight, srcIRect.fTop, radiusX, srcIRect.height()); this->clear(&clearRect, 0x0); } @@ -1788,7 +1788,7 @@ GrTexture* GrContext::gaussianBlur(GrTexture* srcTexture, if (scaleFactorY > 1 || sigmaX > 0.0f) { // Clear out a radius below the srcRect to prevent the Y // convolution from reading garbage. - clearRect = SkIRect::MakeXYWH(srcIRect.fLeft, srcIRect.fBottom, + clearRect = SkIRect::MakeXYWH(srcIRect.fLeft, srcIRect.fBottom, srcIRect.width(), radiusY); this->clear(&clearRect, 0x0); } @@ -1804,10 +1804,10 @@ GrTexture* GrContext::gaussianBlur(GrTexture* srcTexture, if (scaleFactorX > 1 || scaleFactorY > 1) { // Clear one pixel to the right and below, to accommodate bilinear // upsampling. - clearRect = SkIRect::MakeXYWH(srcIRect.fLeft, srcIRect.fBottom, + clearRect = SkIRect::MakeXYWH(srcIRect.fLeft, srcIRect.fBottom, srcIRect.width() + 1, 1); this->clear(&clearRect, 0x0); - clearRect = SkIRect::MakeXYWH(srcIRect.fRight, srcIRect.fTop, + clearRect = SkIRect::MakeXYWH(srcIRect.fRight, srcIRect.fTop, 1, srcIRect.height()); this->clear(&clearRect, 0x0); // FIXME: This should be mitchell, not bilinear. diff --git a/src/gpu/GrDefaultPathRenderer.cpp b/src/gpu/GrDefaultPathRenderer.cpp index a59a7be355..eb4072d5fc 100644 --- a/src/gpu/GrDefaultPathRenderer.cpp +++ b/src/gpu/GrDefaultPathRenderer.cpp @@ -269,7 +269,7 @@ bool GrDefaultPathRenderer::createGeom(const SkPath& path, case kQuadratic_PathCmd: { // first pt of quad is the pt we ended on in previous step uint16_t firstQPtIdx = (uint16_t)(vert - base) - 1; - uint16_t numPts = (uint16_t) + uint16_t numPts = (uint16_t) GrPathUtils::generateQuadraticPoints( pts[0], pts[1], pts[2], srcSpaceTolSqd, &vert, @@ -312,7 +312,7 @@ FINISHED: *vertexCnt = vert - base; *indexCnt = idx - idxBase; - if (NULL != translate && + if (NULL != translate && (translate->fX || translate->fY)) { int count = vert - base; for (int i = 0; i < count; i++) { @@ -492,7 +492,7 @@ bool GrDefaultPathRenderer::internalDrawPath(const SkPath& path, drawState->enableState(GrDrawState::kNoColorWrites_StateBit); } if (indexCnt) { - target->drawIndexed(primType, 0, 0, + target->drawIndexed(primType, 0, 0, vertexCnt, indexCnt); } else { target->drawNonIndexed(primType, 0, vertexCnt); @@ -507,7 +507,7 @@ bool GrDefaultPathRenderer::canDrawPath(const SkPath& path, GrPathFill fill, const GrDrawTarget* target, bool antiAlias) const { - // this class can draw any path with any fill but doesn't do any + // this class can draw any path with any fill but doesn't do any // anti-aliasing. return !antiAlias; } diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp index e562300dd9..e04392608d 100644 --- a/src/gpu/GrInOrderDrawBuffer.cpp +++ b/src/gpu/GrInOrderDrawBuffer.cpp @@ -126,7 +126,7 @@ void GrInOrderDrawBuffer::drawRect(const GrRect& rect, bool disabledClip = false; if (drawState->isClipState()) { - + GrRect devClipRect; bool isIntersectionOfRects = false; @@ -189,7 +189,7 @@ void GrInOrderDrawBuffer::drawRect(const GrRect& rect, GeometryPoolState& poolState = fGeoPoolStateStack.back(); - appendToPreviousDraw = + appendToPreviousDraw = kDraw_Cmd != fCmds.back() && lastDraw.fVertexBuffer == poolState.fPoolVertexBuffer && (fCurrQuad * 4 + lastDraw.fStartVertex) == poolState.fPoolStartVertex; @@ -373,7 +373,7 @@ void GrInOrderDrawBuffer::onDrawIndexed(GrPrimitiveType primitiveType, case kArray_GeometrySrcType: { size_t vertexBytes = (vertexCount + startVertex) * VertexSize(draw->fVertexLayout); - poolState.fUsedPoolVertexBytes = + poolState.fUsedPoolVertexBytes = GrMax(poolState.fUsedPoolVertexBytes, vertexBytes); draw->fVertexBuffer = poolState.fPoolVertexBuffer; draw->fStartVertex += poolState.fPoolStartVertex; @@ -388,10 +388,10 @@ void GrInOrderDrawBuffer::onDrawIndexed(GrPrimitiveType primitiveType, case kBuffer_GeometrySrcType: draw->fIndexBuffer = this->getGeomSrc().fIndexBuffer; break; - case kReserved_GeometrySrcType: // fallthrough + case kReserved_GeometrySrcType: // fallthrough case kArray_GeometrySrcType: { size_t indexBytes = (indexCount + startIndex) * sizeof(uint16_t); - poolState.fUsedPoolIndexBytes = + poolState.fUsedPoolIndexBytes = GrMax(poolState.fUsedPoolIndexBytes, indexBytes); draw->fIndexBuffer = poolState.fPoolIndexBuffer; draw->fStartIndex += poolState.fPoolStartIndex; @@ -436,7 +436,7 @@ void GrInOrderDrawBuffer::onDrawNonIndexed(GrPrimitiveType primitiveType, case kArray_GeometrySrcType: { size_t vertexBytes = (vertexCount + startVertex) * VertexSize(draw->fVertexLayout); - poolState.fUsedPoolVertexBytes = + poolState.fUsedPoolVertexBytes = GrMax(poolState.fUsedPoolVertexBytes, vertexBytes); draw->fVertexBuffer = poolState.fPoolVertexBuffer; draw->fStartVertex += poolState.fPoolStartVertex; @@ -463,7 +463,7 @@ void GrInOrderDrawBuffer::onStencilPath(const GrPath* path, GrPathFill fill) { sp->fFill = fill; } -void GrInOrderDrawBuffer::clear(const GrIRect* rect, +void GrInOrderDrawBuffer::clear(const GrIRect* rect, GrColor color, GrRenderTarget* renderTarget) { GrIRect r; @@ -587,7 +587,7 @@ bool GrInOrderDrawBuffer::playback(GrDrawTarget* target) { ++currClip; break; case kClear_Cmd: - target->clear(&fClears[currClear].fRect, + target->clear(&fClears[currClear].fRect, fClears[currClear].fColor, fClears[currClear].fRenderTarget); ++currClear; @@ -635,10 +635,10 @@ void GrInOrderDrawBuffer::willReserveVertexAndIndexSpace( // we don't know that the client has finished writing to it. bool targetHasReservedGeom = fAutoFlushTarget->hasReservedVerticesOrIndices(); - + int vcount = vertexCount; int icount = indexCount; - + if (!insideGeoPush && !unreleasedVertexSpace && !unreleasedIndexSpace && @@ -687,14 +687,14 @@ bool GrInOrderDrawBuffer::onReserveVertexSpace(GrVertexLayout vertexLayout, GrAssert(vertexCount > 0); GrAssert(NULL != vertices); GrAssert(0 == poolState.fUsedPoolVertexBytes); - + *vertices = fVertexPool.makeSpace(vertexLayout, vertexCount, &poolState.fPoolVertexBuffer, &poolState.fPoolStartVertex); return NULL != *vertices; } - + bool GrInOrderDrawBuffer::onReserveIndexSpace(int indexCount, void** indices) { GeometryPoolState& poolState = fGeoPoolStateStack.back(); GrAssert(indexCount > 0); @@ -709,7 +709,7 @@ bool GrInOrderDrawBuffer::onReserveIndexSpace(int indexCount, void** indices) { void GrInOrderDrawBuffer::releaseReservedVertexSpace() { GeometryPoolState& poolState = fGeoPoolStateStack.back(); - const GeometrySrcState& geoSrc = this->getGeomSrc(); + const GeometrySrcState& geoSrc = this->getGeomSrc(); // If we get a release vertex space call then our current source should either be reserved // or array (which we copied into reserved space). @@ -722,7 +722,7 @@ void GrInOrderDrawBuffer::releaseReservedVertexSpace() { // pool any portion at the tail of the allocation that no draw referenced. size_t reservedVertexBytes = VertexSize(geoSrc.fVertexLayout) * geoSrc.fVertexCount; - fVertexPool.putBack(reservedVertexBytes - + fVertexPool.putBack(reservedVertexBytes - poolState.fUsedPoolVertexBytes); poolState.fUsedPoolVertexBytes = 0; poolState.fPoolVertexBuffer = NULL; @@ -731,7 +731,7 @@ void GrInOrderDrawBuffer::releaseReservedVertexSpace() { void GrInOrderDrawBuffer::releaseReservedIndexSpace() { GeometryPoolState& poolState = fGeoPoolStateStack.back(); - const GeometrySrcState& geoSrc = this->getGeomSrc(); + const GeometrySrcState& geoSrc = this->getGeomSrc(); // If we get a release index space call then our current source should either be reserved // or array (which we copied into reserved space). @@ -746,7 +746,7 @@ void GrInOrderDrawBuffer::releaseReservedIndexSpace() { poolState.fPoolIndexBuffer = NULL; poolState.fPoolStartIndex = 0; } - + void GrInOrderDrawBuffer::onSetVertexSourceToArray(const void* vertexArray, int vertexCount) { @@ -812,13 +812,13 @@ void GrInOrderDrawBuffer::geometrySourceWillPop( // pool. if (kReserved_GeometrySrcType == restoredState.fVertexSrc || kArray_GeometrySrcType == restoredState.fVertexSrc) { - poolState.fUsedPoolVertexBytes = - VertexSize(restoredState.fVertexLayout) * + poolState.fUsedPoolVertexBytes = + VertexSize(restoredState.fVertexLayout) * restoredState.fVertexCount; } if (kReserved_GeometrySrcType == restoredState.fIndexSrc || kArray_GeometrySrcType == restoredState.fIndexSrc) { - poolState.fUsedPoolIndexBytes = sizeof(uint16_t) * + poolState.fUsedPoolIndexBytes = sizeof(uint16_t) * restoredState.fIndexCount; } this->resetDrawTracking(); @@ -832,7 +832,7 @@ bool GrInOrderDrawBuffer::needsNewState() const { bool GrInOrderDrawBuffer::needsNewClip() const { if (this->getDrawState().isClipState()) { - if (fClipSet && + if (fClipSet && (fClips.back() != *fClip->fClipStack || fClipOrigins.back() != fClip->fOrigin)) { return true; diff --git a/src/gpu/GrInOrderDrawBuffer.h b/src/gpu/GrInOrderDrawBuffer.h index 73a9068fee..08dd774c27 100644 --- a/src/gpu/GrInOrderDrawBuffer.h +++ b/src/gpu/GrInOrderDrawBuffer.h @@ -104,16 +104,16 @@ public: /** * This function allows the draw buffer to automatically flush itself to - * another target. This means the buffer may internally call + * another target. This means the buffer may internally call * this->flushTo(target) when it is safe to do so. - * + * * When the auto flush target is set to NULL (as it initially is) the draw * buffer will never automatically flush itself. */ void setAutoFlushTarget(GrDrawTarget* target); // overrides from GrDrawTarget - virtual void drawRect(const GrRect& rect, + virtual void drawRect(const GrRect& rect, const GrMatrix* matrix = NULL, const GrRect* srcRects[] = NULL, const GrMatrix* srcMatrices[] = NULL) SK_OVERRIDE; @@ -128,7 +128,7 @@ public: int* vertexCount, int* indexCount) const SK_OVERRIDE; - virtual void clear(const GrIRect* rect, + virtual void clear(const GrIRect* rect, GrColor color, GrRenderTarget* renderTarget = NULL) SK_OVERRIDE; @@ -180,7 +180,7 @@ private: int startVertex, int vertexCount) SK_OVERRIDE; virtual void onStencilPath(const GrPath*, GrPathFill) SK_OVERRIDE; - virtual bool onReserveVertexSpace(GrVertexLayout layout, + virtual bool onReserveVertexSpace(GrVertexLayout layout, int vertexCount, void** vertices) SK_OVERRIDE; virtual bool onReserveIndexSpace(int indexCount, @@ -212,7 +212,7 @@ private: StencilPath* recordStencilPath(); Clear* recordClear(); - // call this to invalidate the tracking data that is used to concatenate + // call this to invalidate the tracking data that is used to concatenate // multiple draws into a single draw. void resetDrawTracking(); diff --git a/src/gpu/GrRectanizer_fifo.cpp b/src/gpu/GrRectanizer_fifo.cpp index 0f412b83fa..aab012de6a 100644 --- a/src/gpu/GrRectanizer_fifo.cpp +++ b/src/gpu/GrRectanizer_fifo.cpp @@ -20,44 +20,44 @@ public: fAreaSoFar = 0; Gr_bzero(fRows, sizeof(fRows)); } - + virtual ~GrRectanizerFIFO() { } - + virtual bool addRect(int w, int h, GrIPoint16* loc); - + virtual float percentFull() const { return fAreaSoFar / ((float)this->width() * this->height()); } - + virtual int stripToPurge(int height) const { return -1; } virtual void purgeStripAtY(int yCoord) { } - + /////////////////////////////////////////////////////////////////////////// - + struct Row { GrIPoint16 fLoc; int fRowHeight; - + bool canAddWidth(int width, int containerWidth) const { return fLoc.fX + width <= containerWidth; } }; - + Row fRows[16]; - + static int HeightToRowIndex(int height) { GrAssert(height >= MIN_HEIGHT_POW2); return 32 - Gr_clz(height - 1); } - + int fNextStripY; int32_t fAreaSoFar; - + bool canAddStrip(int height) const { return fNextStripY + height <= this->height(); } - + void initRow(Row* row, int rowHeight) { row->fLoc.set(0, fNextStripY); row->fRowHeight = rowHeight; @@ -70,9 +70,9 @@ bool GrRectanizerFIFO::addRect(int width, int height, GrIPoint16* loc) { (unsigned)height > (unsigned)this->height()) { return false; } - + int32_t area = width * height; - + /* We use bsearch, but there may be more than one row with the same height, so we actually search for height-1, which can only be a pow2 itself if @@ -82,10 +82,10 @@ bool GrRectanizerFIFO::addRect(int width, int height, GrIPoint16* loc) { if (height < MIN_HEIGHT_POW2) { height = MIN_HEIGHT_POW2; } - + Row* row = &fRows[HeightToRowIndex(height)]; GrAssert(row->fRowHeight == 0 || row->fRowHeight == height); - + if (0 == row->fRowHeight) { if (!this->canAddStrip(height)) { return false; @@ -101,12 +101,12 @@ bool GrRectanizerFIFO::addRect(int width, int height, GrIPoint16* loc) { this->initRow(row, height); } } - + GrAssert(row->fRowHeight == height); GrAssert(row->canAddWidth(width, this->width())); *loc = row->fLoc; row->fLoc.fX += width; - + GrAssert(row->fLoc.fX <= this->width()); GrAssert(row->fLoc.fY <= this->height()); GrAssert(fNextStripY <= this->height()); diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp index cae2ec9bba..60e20a77c5 100644 --- a/src/gpu/GrResourceCache.cpp +++ b/src/gpu/GrResourceCache.cpp @@ -296,7 +296,7 @@ void GrResourceCache::unlock(GrResourceEntry* entry) { } /** - * Destroying a resource may potentially trigger the unlock of additional + * Destroying a resource may potentially trigger the unlock of additional * resources which in turn will trigger a nested purge. We block the nested * purge using the fPurging variable. However, the initial purge will keep * looping until either all resources in the cache are unlocked or we've met @@ -311,8 +311,8 @@ void GrResourceCache::purgeAsNeeded() { bool withinBudget = false; do { SkTDLinkedList<GrResourceEntry>::Iter iter; - - // Note: the following code relies on the fact that the + + // Note: the following code relies on the fact that the // doubly linked list doesn't invalidate its data/pointers // outside of the specific area where a deletion occurs (e.g., // in internalDetach) @@ -388,7 +388,7 @@ size_t GrResourceCache::countBytes(const SkTDLinkedList<GrResourceEntry>& list) size_t bytes = 0; SkTDLinkedList<GrResourceEntry>::Iter iter; - + const GrResourceEntry* entry = iter.init( const_cast<SkTDLinkedList<GrResourceEntry>&>(list), SkTDLinkedList<GrResourceEntry>::Iter::kTail_IterStart); @@ -418,7 +418,7 @@ void GrResourceCache::validate() const { int unlockCount = 0; SkTDLinkedList<GrResourceEntry>::Iter iter; - + const GrResourceEntry* entry = iter.init( const_cast<SkTDLinkedList<GrResourceEntry>&>(fList), SkTDLinkedList<GrResourceEntry>::Iter::kHead_IterStart); diff --git a/src/gpu/GrResourceCache.h b/src/gpu/GrResourceCache.h index 55bbc25e1f..162e1ef04a 100644 --- a/src/gpu/GrResourceCache.h +++ b/src/gpu/GrResourceCache.h @@ -186,7 +186,7 @@ public: /** * Return the current resource cache limits. * - * @param maxResource If non-null, returns maximum number of resources + * @param maxResource If non-null, returns maximum number of resources * that can be held in the cache. * @param maxBytes If non-null, returns maximum number of bytes of * gpu memory that can be held in the cache. @@ -224,10 +224,10 @@ public: GrResource* findAndLock(const GrResourceKey&, LockType style); /** - * Create a new cache entry, based on the provided key and resource, and + * Create a new cache entry, based on the provided key and resource, and * return it. * - * Ownership of the resource is transferred to the resource cache, + * Ownership of the resource is transferred to the resource cache, * which will unref() it when it is purged or deleted. */ void createAndLock(const GrResourceKey&, GrResource*); @@ -235,7 +235,7 @@ public: /** * Create a new cache entry, based on the provided key and resource. * - * Ownership of the resource is transferred to the resource cache, + * Ownership of the resource is transferred to the resource cache, * which will unref() it when it is purged or deleted. * * Currently this entry point is only intended for textures "detached" diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp index 27d6760e7b..9e7012bfca 100644 --- a/src/gpu/GrSWMaskHelper.cpp +++ b/src/gpu/GrSWMaskHelper.cpp @@ -52,7 +52,7 @@ SkPath::FillType gr_fill_to_sk_fill(GrPathFill fill) { /** * Draw a single rect element of the clip stack into the accumulation bitmap */ -void GrSWMaskHelper::draw(const GrRect& rect, SkRegion::Op op, +void GrSWMaskHelper::draw(const GrRect& rect, SkRegion::Op op, bool antiAlias, uint8_t alpha) { SkPaint paint; @@ -99,7 +99,7 @@ void GrSWMaskHelper::draw(const SkPath& path, SkRegion::Op op, SkSafeUnref(mode); } -bool GrSWMaskHelper::init(const GrIRect& resultBounds, +bool GrSWMaskHelper::init(const GrIRect& resultBounds, const GrMatrix* matrix) { if (NULL != matrix) { fMatrix = *matrix; @@ -151,24 +151,24 @@ void GrSWMaskHelper::toTexture(GrTexture *texture, uint8_t alpha) { // The destination texture is almost always larger than "fBM". Clear // it appropriately so we don't get mask artifacts outside of the path's // bounding box - + // "texture" needs to be installed as the render target for the clear // and the texture upload but cannot remain the render target upon // return. Callers typically use it as a texture and it would then // be both source and dest. - GrDrawState::AutoRenderTargetRestore artr(fContext->getGpu()->drawState(), + GrDrawState::AutoRenderTargetRestore artr(fContext->getGpu()->drawState(), texture->asRenderTarget()); fContext->getGpu()->clear(NULL, SkColorSetARGB(alpha, alpha, alpha, alpha)); - texture->writePixels(0, 0, fBM.width(), fBM.height(), + texture->writePixels(0, 0, fBM.width(), fBM.height(), kAlpha_8_GrPixelConfig, fBM.getPixels(), fBM.rowBytes()); } //////////////////////////////////////////////////////////////////////////////// /** - * Software rasterizes path to A8 mask (possibly using the context's matrix) + * Software rasterizes path to A8 mask (possibly using the context's matrix) * and uploads the result to a scratch texture. Returns the resulting * texture on success; NULL on failure. */ diff --git a/src/gpu/GrStencil.cpp b/src/gpu/GrStencil.cpp index decfd2df14..767726084c 100644 --- a/src/gpu/GrStencil.cpp +++ b/src/gpu/GrStencil.cpp @@ -233,7 +233,7 @@ GR_STATIC_CONST_SAME_STENCIL(gDiffClip, ); bool GrStencilSettings::GetClipPasses( - SkRegion::Op op, + SkRegion::Op op, bool canBeDirect, unsigned int stencilClipMask, bool invertedFill, diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index 2052b77b39..8701178ccc 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -90,15 +90,15 @@ static GrTexture* sk_gr_create_bitmap_texture(GrContext* ctx, // our compressed data will be trimmed, so pass width() for its // "rowBytes", since they are the same now. - + if (GrCacheData::kScratch_CacheID != key) { - return ctx->createAndLockTexture(params, desc, cacheData, + return ctx->createAndLockTexture(params, desc, cacheData, storage.get(), bitmap->width()); } else { GrTexture* result = ctx->lockScratchTexture(desc, GrContext::kExact_ScratchTexMatch); - result->writePixels(0, 0, bitmap->width(), + result->writePixels(0, 0, bitmap->width(), bitmap->height(), desc.fConfig, storage.get()); return result; @@ -119,10 +119,10 @@ static GrTexture* sk_gr_create_bitmap_texture(GrContext* ctx, bitmap->getPixels(), bitmap->rowBytes()); } else { - // This texture is unlikely to be used again (in its present form) so - // just use a scratch texture. This will remove the texture from the - // cache so no one else can find it. Additionally, once unlocked, the - // scratch texture will go to the end of the list for purging so will + // This texture is unlikely to be used again (in its present form) so + // just use a scratch texture. This will remove the texture from the + // cache so no one else can find it. Additionally, once unlocked, the + // scratch texture will go to the end of the list for purging so will // likely be available for this volatile bitmap the next time around. GrTexture* result = ctx->lockScratchTexture(desc, GrContext::kExact_ScratchTexMatch); @@ -137,7 +137,7 @@ static GrTexture* sk_gr_create_bitmap_texture(GrContext* ctx, /////////////////////////////////////////////////////////////////////////////// -GrTexture* GrLockCachedBitmapTexture(GrContext* ctx, +GrTexture* GrLockCachedBitmapTexture(GrContext* ctx, const SkBitmap& bitmap, const GrTextureParams* params) { GrTexture* result = NULL; diff --git a/src/gpu/android/SkNativeGLContext_android.cpp b/src/gpu/android/SkNativeGLContext_android.cpp index dd444dfc48..f21eed8666 100644 --- a/src/gpu/android/SkNativeGLContext_android.cpp +++ b/src/gpu/android/SkNativeGLContext_android.cpp @@ -22,7 +22,7 @@ SkNativeGLContext::AutoContextRestore::~AutoContextRestore() { /////////////////////////////////////////////////////////////////////////////// -SkNativeGLContext::SkNativeGLContext() +SkNativeGLContext::SkNativeGLContext() : fContext(EGL_NO_CONTEXT) , fDisplay(EGL_NO_DISPLAY) , fSurface(EGL_NO_SURFACE) { diff --git a/src/gpu/app-android.cpp b/src/gpu/app-android.cpp index 56a96a66c6..c656b59a3f 100644 --- a/src/gpu/app-android.cpp +++ b/src/gpu/app-android.cpp @@ -60,7 +60,7 @@ struct State { void setViewport(int w, int h); int getWidth() const { return fViewport.fX; } int getHeight() const { return fViewport.fY; } - + void handleTouch(void*, TouchState, float x, float y); void applyMatrix(SkCanvas*); @@ -69,7 +69,7 @@ struct State { private: SkView* fView; SkIPoint fViewport; - + SkTouchGesture fGesture; SkTDArray<SkViewFactory> fFactory; @@ -96,7 +96,7 @@ SkViewRegister::SkViewRegister(SkViewFactory fact) : fFact(fact) { gHead = NULL; gOnce = true; } - + fChain = gHead; gHead = this; } @@ -309,7 +309,7 @@ static void doDraw() { int fps = (FRAME_COUNT * 1000) / gDuration; SkString str; str.printf("FPS=%3d MS=%3d", fps, gDuration / FRAME_COUNT); - + SkGpuCanvas c(gContext); c.setBitmapDevice(viewport); diff --git a/src/gpu/effects/GrColorTableEffect.h b/src/gpu/effects/GrColorTableEffect.h index de86768ca3..f79e586579 100644 --- a/src/gpu/effects/GrColorTableEffect.h +++ b/src/gpu/effects/GrColorTableEffect.h @@ -16,7 +16,7 @@ class GrGLColorTableEffect; /** * LUT-based color transformation effect. This class implements the Gr * counterpart to the SkTable_ColorFilter effect. A 256 * 4 (single-channel) - * LUT is used to transform the input colors of the image. + * LUT is used to transform the input colors of the image. */ class GrColorTableEffect : public GrSingleTextureEffect { diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp index 92c6ffb169..2cefbc4e26 100644 --- a/src/gpu/effects/GrConvolutionEffect.cpp +++ b/src/gpu/effects/GrConvolutionEffect.cpp @@ -69,7 +69,7 @@ void GrGLConvolutionEffect::emitFS(GrGLShaderBuilder* builder, SkString* code = &builder->fFSCode; code->appendf("\t\t%s = vec4(0, 0, 0, 0);\n", outputColor); - + int width = this ->width(); const GrGLShaderVar& kernel = builder->getUniformVariable(fKernelUni); const char* imgInc = builder->getUniformCStr(fImageIncrementUni); diff --git a/src/gpu/effects/GrConvolutionEffect.h b/src/gpu/effects/GrConvolutionEffect.h index 21c022d85f..4c42a6ce41 100644 --- a/src/gpu/effects/GrConvolutionEffect.h +++ b/src/gpu/effects/GrConvolutionEffect.h @@ -13,7 +13,7 @@ class GrGLConvolutionEffect; /** - * A convolution effect. The kernel is specified as an array of 2 * half-width + * A convolution effect. The kernel is specified as an array of 2 * half-width * + 1 weights. Each texel is multiplied by it's weight and summed to determine * the output color. The output color is modulated by the input color. */ diff --git a/src/gpu/effects/GrTextureStripAtlas.cpp b/src/gpu/effects/GrTextureStripAtlas.cpp index 3462e9243b..a43f9d6f68 100644 --- a/src/gpu/effects/GrTextureStripAtlas.cpp +++ b/src/gpu/effects/GrTextureStripAtlas.cpp @@ -51,7 +51,7 @@ GrTextureStripAtlas* GrTextureStripAtlas::GetAtlas(const GrTextureStripAtlas::De } } -GrTextureStripAtlas::GrTextureStripAtlas(GrTextureStripAtlas::Desc desc) +GrTextureStripAtlas::GrTextureStripAtlas(GrTextureStripAtlas::Desc desc) : fCacheID(sk_atomic_inc(&gCacheCount)) , fLockedRows(0) , fDesc(desc) @@ -88,9 +88,9 @@ int GrTextureStripAtlas::lockRow(const SkBitmap& data) { ++row->fLocks; ++fLockedRows; - // Since all the rows are always stored in a contiguous array, we can save the memory + // Since all the rows are always stored in a contiguous array, we can save the memory // required for storing row numbers and just compute it with some pointer arithmetic - rowNumber = static_cast<int>(row - fRows); + rowNumber = static_cast<int>(row - fRows); } else { // ~index is the index where we will insert the new key to keep things sorted index = ~index; @@ -131,7 +131,7 @@ int GrTextureStripAtlas::lockRow(const SkBitmap& data) { row->fKey = key; row->fLocks = 1; fKeyTable.insert(index, 1, &row); - rowNumber = static_cast<int>(row - fRows); + rowNumber = static_cast<int>(row - fRows); SkAutoLockPixels lock(data); @@ -139,7 +139,7 @@ int GrTextureStripAtlas::lockRow(const SkBitmap& data) { // that is not currently in use fDesc.fContext->writeTexturePixels(fTexture, 0, rowNumber * fDesc.fRowHeight, - fDesc.fWidth, fDesc.fRowHeight, + fDesc.fWidth, fDesc.fRowHeight, SkBitmapConfig2GrPixelConfig(data.config()), data.getPixels(), data.rowBytes(), @@ -239,7 +239,7 @@ void GrTextureStripAtlas::removeFromLRU(AtlasRow* row) { if (fLRUFront) { fLRUFront->fPrev = NULL; } - } + } } row->fNext = NULL; row->fPrev = NULL; @@ -249,8 +249,8 @@ int GrTextureStripAtlas::searchByKey(uint32_t key) { AtlasRow target; target.fKey = key; return SkTSearch<AtlasRow, GrTextureStripAtlas::compareKeys>((const AtlasRow**)fKeyTable.begin(), - fKeyTable.count(), - &target, + fKeyTable.count(), + &target, sizeof(AtlasRow*)); } diff --git a/src/gpu/effects/GrTextureStripAtlas.h b/src/gpu/effects/GrTextureStripAtlas.h index c763599963..1a4c371b69 100644 --- a/src/gpu/effects/GrTextureStripAtlas.h +++ b/src/gpu/effects/GrTextureStripAtlas.h @@ -15,7 +15,7 @@ #include "SkTDArray.h" /** - * Maintains a single large texture whose rows store many textures of a small fixed height, + * Maintains a single large texture whose rows store many textures of a small fixed height, * stored in rows across the x-axis such that we can safely wrap/repeat them horizontally. */ class GrTextureStripAtlas { @@ -49,20 +49,20 @@ public: int lockRow(const SkBitmap& data); void unlockRow(int row); - /** - * These functions help turn an integer row index in [0, 1, 2, ... numRows] into a scalar y + /** + * These functions help turn an integer row index in [0, 1, 2, ... numRows] into a scalar y * texture coordinate in [0, 1] that we can use in a shader. * - * If a regular texture access without using the atlas looks like: + * If a regular texture access without using the atlas looks like: * * texture2D(sampler, vec2(x, y)) * - * Then when using the atlas we'd replace it with: + * Then when using the atlas we'd replace it with: * - * texture2D(sampler, vec2(x, yOffset + y * scaleFactor)) + * texture2D(sampler, vec2(x, yOffset + y * scaleFactor)) * * Where yOffset, returned by getYOffset(), is the offset to the start of the row within the - * atlas and scaleFactor, returned by getVerticalScaleFactor(), is the y-scale of the row, + * atlas and scaleFactor, returned by getVerticalScaleFactor(), is the y-scale of the row, * relative to the height of the overall atlas texture. */ GrScalar getYOffset(int row) const { return SkIntToScalar(row) / fNumRows; } @@ -76,30 +76,30 @@ private: // Key to indicate an atlas row without any meaningful data stored in it const static uint32_t kEmptyAtlasRowKey = 0xffffffff; - /** + /** * The state of a single row in our cache, next/prev pointers allow these to be chained * together to represent LRU status */ struct AtlasRow : public GrNoncopyable { AtlasRow() : fKey(kEmptyAtlasRowKey), fLocks(0), fNext(NULL), fPrev(NULL) { } // GenerationID of the bitmap that is represented by this row, 0xffffffff means "empty" - uint32_t fKey; + uint32_t fKey; // How many times this has been locked (0 == unlocked) - int32_t fLocks; + int32_t fLocks; // We maintain an LRU linked list between unlocked nodes with these pointers AtlasRow* fNext; AtlasRow* fPrev; }; - /** + /** * We'll only allow construction via the static GrTextureStripAtlas::GetAtlas */ GrTextureStripAtlas(Desc desc); - + void lockTexture(); void unlockTexture(); - /** + /** * Initialize our LRU list (if one already exists, clear it and start anew) */ void initLRU(); @@ -112,8 +112,8 @@ private: void appendLRU(AtlasRow* row); void removeFromLRU(AtlasRow* row); - /** - * Searches the key table for a key and returns the index if found; if not found, it returns + /** + * Searches the key table for a key and returns the index if found; if not found, it returns * the bitwise not of the index at which we could insert the key to maintain a sorted list. **/ int searchByKey(uint32_t key); @@ -144,7 +144,7 @@ private: GrTexture* fTexture; // Array of AtlasRows which store the state of all our rows. Stored in a contiguous array, in - // order that they appear in our texture, this means we can subtract this pointer from a row + // order that they appear in our texture, this means we can subtract this pointer from a row // pointer to get its index in the texture, and can save storing a row number in AtlasRow. AtlasRow* fRows; diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index 2682eb2680..52c480ad3f 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -163,8 +163,8 @@ void GrGLCaps::init(const GrGLContextInfo& ctxInfo) { } bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf, - GrGLenum format, - GrGLenum type) const { + GrGLenum format, + GrGLenum type) const { if (GR_GL_RGBA == format && GR_GL_UNSIGNED_BYTE == type) { // ES 2 guarantees this format is supported return true; @@ -180,11 +180,11 @@ bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf, // The other supported format/type combo supported for ReadPixels // can change based on which render target is bound - GR_GL_GetIntegerv(intf, + GR_GL_GetIntegerv(intf, GR_GL_IMPLEMENTATION_COLOR_READ_FORMAT, &otherFormat); - GR_GL_GetIntegerv(intf, + GR_GL_GetIntegerv(intf, GR_GL_IMPLEMENTATION_COLOR_READ_TYPE, &otherType); @@ -301,7 +301,7 @@ void GrGLCaps::initStencilFormats(const GrGLContextInfo& ctxInfo) { if (kDesktop_GrGLBinding == ctxInfo.binding()) { bool supportsPackedDS = - ctxInfo.version() >= GR_GL_VER(3,0) || + ctxInfo.version() >= GR_GL_VER(3,0) || ctxInfo.hasExtension("GL_EXT_packed_depth_stencil") || ctxInfo.hasExtension("GL_ARB_framebuffer_object"); diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h index 2acfbd74ae..1cc50c2220 100644 --- a/src/gpu/gl/GrGLCaps.h +++ b/src/gpu/gl/GrGLCaps.h @@ -49,7 +49,7 @@ public: /** * no support for MSAA FBOs */ - kNone_MSFBOType = 0, + kNone_MSFBOType = 0, /** * GL3.0-style MSAA FBO (GL_ARB_framebuffer_object) */ @@ -141,7 +141,7 @@ public: * Reports the maximum number of samples supported. */ int maxSampleCount() const { return fMaxSampleCount; } - + /** * Reports the type of coverage sample AA support. */ @@ -218,7 +218,7 @@ public: // Does ReadPixels support the provided format/type combo? bool readPixelsSupported(const GrGLInterface* intf, - GrGLenum format, + GrGLenum format, GrGLenum type) const; private: diff --git a/src/gpu/gl/GrGLCreateNullInterface.cpp b/src/gpu/gl/GrGLCreateNullInterface.cpp index 6451fcafe9..d0e2bb6d3f 100644 --- a/src/gpu/gl/GrGLCreateNullInterface.cpp +++ b/src/gpu/gl/GrGLCreateNullInterface.cpp @@ -213,7 +213,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE nullGLGetBufferParameteriv(GrGLenum target, GrGLenu break; case GR_GL_ELEMENT_ARRAY_BUFFER: buf = gCurrElementArrayBuffer; - break; + break; } if (buf) { for (int i = 0; i < gMappedBuffers.count(); ++i) { @@ -384,7 +384,7 @@ GrGLint GR_GL_FUNCTION_TYPE nullGLGetUniformLocation(GrGLuint program, const cha } // end anonymous namespace const GrGLInterface* GrGLCreateNullInterface() { - // The gl functions are not context-specific so we create one global + // The gl functions are not context-specific so we create one global // interface static SkAutoTUnref<GrGLInterface> glInterface; if (!glInterface.get()) { diff --git a/src/gpu/gl/GrGLIndexBuffer.cpp b/src/gpu/gl/GrGLIndexBuffer.cpp index 54689923a4..9c019c149b 100644 --- a/src/gpu/gl/GrGLIndexBuffer.cpp +++ b/src/gpu/gl/GrGLIndexBuffer.cpp @@ -125,7 +125,7 @@ bool GrGLIndexBuffer::updateData(const void* src, size_t srcSizeInBytes) { // Note that we're cheating on the size here. Currently no methods // allow a partial update that preserves contents of non-updated // portions of the buffer (lock() does a glBufferData(..size, NULL..)) - GL_CALL(BufferData(GR_GL_ELEMENT_ARRAY_BUFFER, + GL_CALL(BufferData(GR_GL_ELEMENT_ARRAY_BUFFER, srcSizeInBytes, src, usage)); #endif return true; diff --git a/src/gpu/gl/GrGLInterface.cpp b/src/gpu/gl/GrGLInterface.cpp index 02e9337c43..297e1fc1d9 100644 --- a/src/gpu/gl/GrGLInterface.cpp +++ b/src/gpu/gl/GrGLInterface.cpp @@ -327,7 +327,7 @@ bool GrGLInterface::validate(GrGLBinding binding) const { // On ES buffer mapping is an extension. On Desktop // buffer mapping was part of original VBO extension // which we require. - if (kDesktop_GrGLBinding == binding || + if (kDesktop_GrGLBinding == binding || GrGLHasExtensionFromString("GL_OES_mapbuffer", ext)) { if (NULL == fMapBuffer || NULL == fUnmapBuffer) { @@ -337,7 +337,7 @@ bool GrGLInterface::validate(GrGLBinding binding) const { // Dual source blending if (kDesktop_GrGLBinding == binding && - (glVer >= GR_GL_VER(3,3) || + (glVer >= GR_GL_VER(3,3) || GrGLHasExtensionFromString("GL_ARB_blend_func_extended", ext))) { if (NULL == fBindFragDataLocationIndexed) { return false; diff --git a/src/gpu/gl/GrGLPath.cpp b/src/gpu/gl/GrGLPath.cpp index 64d5a55945..95e11f2167 100644 --- a/src/gpu/gl/GrGLPath.cpp +++ b/src/gpu/gl/GrGLPath.cpp @@ -70,7 +70,7 @@ GrGLPath::GrGLPath(GrGpuGL* gpu, const SkPath& path) : INHERITED(gpu) { // TODO: Direct access to path points since we could pass them on directly. path.getPoints(&pathPoints[0], pointCnt); path.getVerbs(&pathCommands[0], verbCnt); - + GR_DEBUGCODE(int numPts = 0); for (int i = 0; i < verbCnt; ++i) { SkPath::Verb v = static_cast<SkPath::Verb>(pathCommands[i]); @@ -78,7 +78,7 @@ GrGLPath::GrGLPath(GrGpuGL* gpu, const SkPath& path) : INHERITED(gpu) { GR_DEBUGCODE(numPts += num_pts(v)); } GrAssert(pathPoints.count() == numPts); - + GL_CALL(PathCommands(fPathID, verbCnt, &pathCommands[0], 2 * pointCnt, GR_GL_FLOAT, &pathPoints[0])); diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp index b04d924eb5..bd406f4c0c 100644 --- a/src/gpu/gl/GrGLProgram.cpp +++ b/src/gpu/gl/GrGLProgram.cpp @@ -316,7 +316,7 @@ bool GrGLProgram::genEdgeCoverage(SkString* coverageVar, break; case GrDrawState::kQuad_EdgeType: segments->fFSCode.append("\tfloat edgeAlpha;\n"); - // keep the derivative instructions outside the conditional + // keep the derivative instructions outside the conditional segments->fFSCode.appendf("\tvec2 duvdx = dFdx(%s.xy);\n", fsName); segments->fFSCode.appendf("\tvec2 duvdy = dFdy(%s.xy);\n", fsName); segments->fFSCode.appendf("\tif (%s.z > 0.0 && %s.w > 0.0) {\n", fsName, fsName); @@ -508,7 +508,7 @@ GrGLuint compile_shader(const GrGLContextInfo& gl, // retrieve length even though we don't need it to workaround bug in chrome cmd buffer // param validation. GrGLsizei length = GR_GL_INIT_ZERO; - GR_GL_CALL(gli, GetShaderInfoLog(shader, infoLen+1, + GR_GL_CALL(gli, GetShaderInfoLog(shader, infoLen+1, &length, (char*)log.get())); print_shader(stringCnt, strings, stringLengths); GrPrintf("\n%s", log.get()); @@ -816,10 +816,10 @@ bool GrGLProgram::genProgram(const GrCustomStage** customStages) { const GrProgramStageFactory& factory = customStages[s]->getFactory(); fProgramStage[s] = factory.createGLInstance(*customStages[s]); } - // stages don't know how to deal with a scalar input. (Maybe they should. We + // stages don't know how to deal with a scalar input. (Maybe they should. We // could pass a GrGLShaderVar) if (inCoverageIsScalar) { - builder.fFSCode.appendf("\tvec4 %s4 = vec4(%s);\n", + builder.fFSCode.appendf("\tvec4 %s4 = vec4(%s);\n", inCoverage.c_str(), inCoverage.c_str()); inCoverage.append("4"); } @@ -1092,13 +1092,13 @@ void GrGLProgram::genStageCode(int stageNum, if (desc.fInConfigFlags & kMulByAlphaMask) { // only one of the mul by alpha flags should be set GrAssert(GrIsPow2(kMulByAlphaMask & desc.fInConfigFlags)); - GrAssert(!(desc.fInConfigFlags & + GrAssert(!(desc.fInConfigFlags & StageDesc::kSmearAlpha_InConfigFlag)); - GrAssert(!(desc.fInConfigFlags & + GrAssert(!(desc.fInConfigFlags & StageDesc::kSmearRed_InConfigFlag)); builder->fFSCode.appendf("\t%s = %s(%s, %s)%s;\n", fsOutColor, - builder->fTexFunc.c_str(), + builder->fTexFunc.c_str(), samplerName, builder->fSampleCoords.c_str(), builder->fSwizzle.c_str()); diff --git a/src/gpu/gl/GrGLRenderTarget.h b/src/gpu/gl/GrGLRenderTarget.h index d5f04d4134..64d95fa932 100644 --- a/src/gpu/gl/GrGLRenderTarget.h +++ b/src/gpu/gl/GrGLRenderTarget.h @@ -50,7 +50,7 @@ public: void setViewport(const GrGLIRect& rect) { fViewport = rect; } const GrGLIRect& getViewport() const { return fViewport; } - // The following two functions return the same ID when a + // The following two functions return the same ID when a // texture-rendertarget is multisampled, and different IDs when // it is. // FBO ID used to render into @@ -58,9 +58,9 @@ public: // FBO ID that has texture ID attached. GrGLuint textureFBOID() const { return fTexFBOID; } - // override of GrRenderTarget + // override of GrRenderTarget virtual intptr_t getRenderTargetHandle() const { - return this->renderFBOID(); + return this->renderFBOID(); } virtual intptr_t getRenderTargetResolvedHandle() const { return this->textureFBOID(); diff --git a/src/gpu/gl/GrGLSL.h b/src/gpu/gl/GrGLSL.h index a58f7e8e75..d766dd9154 100644 --- a/src/gpu/gl/GrGLSL.h +++ b/src/gpu/gl/GrGLSL.h @@ -64,7 +64,7 @@ const char* GrGetGLSLVersionDecl(GrGLBinding binding, * declare an output variable for the color. If this function returns true: * * Parameter var's name will be set to nameIfDeclared * * The variable must be declared in the fragment shader - * * The variable has to be bound as the color output + * * The variable has to be bound as the color output * (using glBindFragDataLocation) * If the function returns false: * * Parameter var's name will be set to the GLSL built-in color output name. diff --git a/src/gpu/gl/GrGLShaderVar.h b/src/gpu/gl/GrGLShaderVar.h index 92d7ee07fd..e8f491c511 100644 --- a/src/gpu/gl/GrGLShaderVar.h +++ b/src/gpu/gl/GrGLShaderVar.h @@ -233,12 +233,12 @@ public: GrSLType effectiveType = this->getType(); if (this->isArray()) { if (this->isUnsizedArray()) { - out->appendf("%s %s[]", - TypeString(effectiveType), + out->appendf("%s %s[]", + TypeString(effectiveType), this->getName().c_str()); } else { GrAssert(this->getArrayCount() > 0); - out->appendf("%s %s[%d]", + out->appendf("%s %s[%d]", TypeString(effectiveType), this->getName().c_str(), this->getArrayCount()); diff --git a/src/gpu/gl/GrGLStencilBuffer.h b/src/gpu/gl/GrGLStencilBuffer.h index 7b3da4f34a..65eb0d9582 100644 --- a/src/gpu/gl/GrGLStencilBuffer.h +++ b/src/gpu/gl/GrGLStencilBuffer.h @@ -23,10 +23,10 @@ public: bool fPacked; }; - GrGLStencilBuffer(GrGpu* gpu, GrGLint rbid, + GrGLStencilBuffer(GrGpu* gpu, GrGLint rbid, int width, int height, int sampleCnt, - const Format& format) + const Format& format) : GrStencilBuffer(gpu, width, height, format.fStencilBits, sampleCnt) , fFormat(format) , fRenderbufferID(rbid) { diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp index e3608747a9..2c5e4a2367 100644 --- a/src/gpu/gl/GrGLTexture.cpp +++ b/src/gpu/gl/GrGLTexture.cpp @@ -42,7 +42,7 @@ void GrGLTexture::init(GrGpuGL* gpu, } GrGLTexture::GrGLTexture(GrGpuGL* gpu, - const Desc& textureDesc) + const Desc& textureDesc) : INHERITED(gpu, textureDesc) { this->init(gpu, textureDesc, NULL); } diff --git a/src/gpu/gl/GrGLUtil.cpp b/src/gpu/gl/GrGLUtil.cpp index 2f22f00f69..0e9e21fb2f 100644 --- a/src/gpu/gl/GrGLUtil.cpp +++ b/src/gpu/gl/GrGLUtil.cpp @@ -111,7 +111,7 @@ GrGLVersion GrGLGetVersionFromString(const char* versionString) { if (4 == n) { return GR_GL_VER(major, minor); } - + n = sscanf(versionString, "OpenGL ES %d.%d", &major, &minor); if (2 == n) { return GR_GL_VER(major, minor); @@ -132,7 +132,7 @@ GrGLSLVersion GrGLGetGLSLVersionFromString(const char* versionString) { if (2 == n) { return GR_GLSL_VER(major, minor); } - + n = sscanf(versionString, "OpenGL ES GLSL ES %d.%d", &major, &minor); if (2 == n) { return GR_GLSL_VER(major, minor); diff --git a/src/gpu/gl/GrGLVertexBuffer.cpp b/src/gpu/gl/GrGLVertexBuffer.cpp index d932f11b71..3d6062dc59 100644 --- a/src/gpu/gl/GrGLVertexBuffer.cpp +++ b/src/gpu/gl/GrGLVertexBuffer.cpp @@ -85,7 +85,7 @@ bool GrGLVertexBuffer::isLocked() const { if (this->isValid() && this->getGpu()->getCaps().fBufferLockSupport) { GrGLint mapped; this->bind(); - GL_CALL(GetBufferParameteriv(GR_GL_ARRAY_BUFFER, + GL_CALL(GetBufferParameteriv(GR_GL_ARRAY_BUFFER, GR_GL_BUFFER_MAPPED, &mapped)); GrAssert(!!mapped == !!fLockPtr); } @@ -112,7 +112,7 @@ bool GrGLVertexBuffer::updateData(const void* src, size_t srcSizeInBytes) { // draws that reference the old contents. With this hint it can // assign a different allocation for the new contents to avoid // flushing the gpu past draws consuming the old contents. - GL_CALL(BufferData(GR_GL_ARRAY_BUFFER, + GL_CALL(BufferData(GR_GL_ARRAY_BUFFER, this->sizeInBytes(), NULL, usage)); GL_CALL(BufferSubData(GR_GL_ARRAY_BUFFER, 0, srcSizeInBytes, src)); } diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp index 03462e743b..3763709b6e 100644 --- a/src/gpu/gl/GrGpuGL.cpp +++ b/src/gpu/gl/GrGpuGL.cpp @@ -29,7 +29,7 @@ static const int SPARE_TEX_UNIT = GrDrawState::kNumStages; #define CLEAR_ERROR_BEFORE_ALLOC(iface) GrGLClearErr(iface) #define GL_ALLOC_CALL(iface, call) GR_GL_CALL_NOERRCHECK(iface, call) #define CHECK_ALLOC_ERROR(iface) GR_GL_GET_ERROR(iface) -#else +#else #define CLEAR_ERROR_BEFORE_ALLOC(iface) #define GL_ALLOC_CALL(iface, call) GR_GL_CALL(iface, call) #define CHECK_ALLOC_ERROR(iface) GR_GL_NO_ERROR @@ -245,7 +245,7 @@ void GrGpuGL::initCaps() { } if (kDesktop_GrGLBinding == this->glBinding()) { - if (this->glVersion() >= GR_GL_VER(2,0) || + if (this->glVersion() >= GR_GL_VER(2,0) || this->hasExtension("GL_ARB_texture_non_power_of_two")) { fCaps.fNPOTTextureTileSupport = true; } else { @@ -275,7 +275,7 @@ void GrGpuGL::initCaps() { this->hasExtension("GL_ARB_blend_func_extended"); fCaps.fShaderDerivativeSupport = true; // we don't support GL_ARB_geometry_shader4, just GL 3.2+ GS - fCaps.fGeometryShaderSupport = + fCaps.fGeometryShaderSupport = this->glVersion() >= GR_GL_VER(3,2) && this->glslGeneration() >= k150_GrGLSLGeneration; } else { @@ -287,9 +287,9 @@ void GrGpuGL::initCaps() { void GrGpuGL::fillInConfigRenderableTable() { // OpenGL < 3.0 - // no support for render targets unless the GL_ARB_framebuffer_object - // extension is supported (in which case we get ALPHA, RED, RG, RGB, - // RGBA (ALPHA8, RGBA4, RGBA8) for OpenGL > 1.1). Note that we + // no support for render targets unless the GL_ARB_framebuffer_object + // extension is supported (in which case we get ALPHA, RED, RG, RGB, + // RGBA (ALPHA8, RGBA4, RGBA8) for OpenGL > 1.1). Note that we // probably don't get R8 in this case. // OpenGL 3.0 @@ -320,7 +320,7 @@ void GrGpuGL::fillInConfigRenderableTable() { } } else { // On ES we can only hope for R8 - fConfigRenderSupport[kAlpha_8_GrPixelConfig] = + fConfigRenderSupport[kAlpha_8_GrPixelConfig] = this->glCaps().textureRedSupport(); } @@ -329,7 +329,7 @@ void GrGpuGL::fillInConfigRenderableTable() { fConfigRenderSupport[kRGB_565_GrPixelConfig] = true; } - // Pre 3.0, Ganesh relies on either GL_ARB_framebuffer_object or + // Pre 3.0, Ganesh relies on either GL_ARB_framebuffer_object or // GL_EXT_framebuffer_object for FBO support. Both of these // allow RGBA4 render targets so this is always supported. fConfigRenderSupport[kRGBA_4444_GrPixelConfig] = true; @@ -413,7 +413,7 @@ bool GrGpuGL::canPreserveReadWriteUnpremulPixels() { } } } - fCanPreserveUnpremulRoundtrip = failed ? + fCanPreserveUnpremulRoundtrip = failed ? kNo_CanPreserveUnpremulRoundtrip : kYes_CanPreserveUnpremulRoundtrip; } @@ -476,7 +476,7 @@ void GrGpuGL::onResetContext() { GL_CALL(Enable(GR_GL_VERTEX_PROGRAM_POINT_SIZE)); // We should set glPolygonMode(FRONT_AND_BACK,FILL) here, too. It isn't - // currently part of our gl interface. There are probably others as + // currently part of our gl interface. There are probably others as // well. } fHWAAState.invalidate(); @@ -594,7 +594,7 @@ GrTexture* GrGpuGL::onCreatePlatformTexture(const GrPlatformTextureDesc& desc) { if (NULL == texture) { return NULL; } - + this->setSpareTextureUnit(); return texture; } @@ -612,7 +612,7 @@ GrRenderTarget* GrGpuGL::onCreatePlatformRenderTarget(const GrPlatformRenderTarg viewport.fBottom = 0; viewport.fWidth = desc.fWidth; viewport.fHeight = desc.fHeight; - + GrRenderTarget* tgt = SkNEW_ARGS(GrGLRenderTarget, (this, glDesc, viewport)); if (desc.fStencilBits) { @@ -657,7 +657,7 @@ void GrGpuGL::onWriteTexturePixels(GrTexture* texture, desc.fOrientation = glTex->orientation(); this->uploadTexData(desc, false, - left, top, width, height, + left, top, width, height, config, buffer, rowBytes); } @@ -711,7 +711,7 @@ bool GrGpuGL::uploadTexData(const GrGLTexture::Desc& desc, bool useTexStorage = isNewTexture && desc.fConfig != kIndex_8_GrPixelConfig && this->glCaps().texStorageSupport(); - + if (useTexStorage && kDesktop_GrGLBinding == this->glBinding()) { // 565 is not a sized internal format on desktop GL. So on desktop with // 565 we always use an unsized internal format to let the system pick @@ -787,7 +787,7 @@ bool GrGpuGL::uploadTexData(const GrGLTexture::Desc& desc, GL_CALL(PixelStorei(GR_GL_UNPACK_ALIGNMENT, static_cast<GrGLint>(bpp))); } bool succeeded = true; - if (isNewTexture && + if (isNewTexture && 0 == left && 0 == top && desc.fWidth == width && desc.fHeight == height) { CLEAR_ERROR_BEFORE_ALLOC(this->glInterface()); @@ -908,7 +908,7 @@ bool GrGpuGL::createRenderTargetObjects(int width, int height, if (!desc->fTexFBOID) { goto FAILED; } - + // If we are using multisampling we will create two FBOS. We render // to one and then resolve to the texture bound to the other. @@ -919,7 +919,7 @@ bool GrGpuGL::createRenderTargetObjects(int width, int height, GL_CALL(GenFramebuffers(1, &desc->fRTFBOID)); GL_CALL(GenRenderbuffers(1, &desc->fMSColorRenderbufferID)); if (!desc->fRTFBOID || - !desc->fMSColorRenderbufferID || + !desc->fMSColorRenderbufferID || !this->configToGLFormats(desc->fConfig, // GLES requires sized internal formats kES2_GrGLBinding == this->glBinding(), @@ -943,7 +943,7 @@ bool GrGpuGL::createRenderTargetObjects(int width, int height, goto FAILED; } GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, desc->fRTFBOID)); - GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, + GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, GR_GL_COLOR_ATTACHMENT0, GR_GL_RENDERBUFFER, desc->fMSColorRenderbufferID)); @@ -1116,7 +1116,7 @@ namespace { const GrGLuint kUnknownBitCount = GrGLStencilBuffer::kUnknownBitCount; void inline get_stencil_rb_sizes(const GrGLInterface* gl, - GrGLuint rb, + GrGLuint rb, GrGLStencilBuffer::Format* format) { // we shouldn't ever know one size and not the other GrAssert((kUnknownBitCount == format->fStencilBits) == @@ -1187,7 +1187,7 @@ bool GrGpuGL::createStencilBufferForRenderTarget(GrRenderTarget* rt, GrGLStencilBuffer::Format format = sFmt; get_stencil_rb_sizes(this->glInterface(), sbID, &format); sb = SkNEW_ARGS(GrGLStencilBuffer, - (this, sbID, width, height, + (this, sbID, width, height, samples, format)); if (this->attachStencilBufferToRenderTarget(sb, rt)) { fLastSuccessfulStencilFmtIdx = sIdx; @@ -1409,7 +1409,7 @@ void GrGpuGL::clearStencil() { if (NULL == this->getDrawState().getRenderTarget()) { return; } - + this->flushRenderTarget(&GrIRect::EmptyIRect()); GrAutoTRestore<ScissorState> asr(&fScissorState); @@ -1536,14 +1536,14 @@ bool GrGpuGL::onReadPixels(GrRenderTarget* target, // the read rect is viewport-relative GrGLIRect readRect; readRect.setRelativeTo(glvp, left, top, width, height); - + size_t tightRowBytes = bpp * width; if (0 == rowBytes) { rowBytes = tightRowBytes; } size_t readDstRowBytes = tightRowBytes; void* readDst = buffer; - + // determine if GL can read using the passed rowBytes or if we need // a scratch buffer. SkAutoSMalloc<32 * sizeof(GrColor)> scratch; diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp index c1eb36e9a7..f9d71db154 100644 --- a/src/gpu/gl/GrGpuGL_program.cpp +++ b/src/gpu/gl/GrGpuGL_program.cpp @@ -283,7 +283,7 @@ void GrGpuGL::flushColor(GrColor color) { // OpenGL ES only supports the float varieties of // glVertexAttrib float c[] = GR_COLOR_TO_VEC4(color); - GL_CALL(VertexAttrib4fv(GrGLProgram::ColorAttributeIdx(), + GL_CALL(VertexAttrib4fv(GrGLProgram::ColorAttributeIdx(), c)); fHWConstAttribColor = color; } @@ -331,7 +331,7 @@ void GrGpuGL::flushCoverage(GrColor coverage) { // OpenGL ES only supports the float varieties of // glVertexAttrib float c[] = GR_COLOR_TO_VEC4(coverage); - GL_CALL(VertexAttrib4fv(GrGLProgram::CoverageAttributeIdx(), + GL_CALL(VertexAttrib4fv(GrGLProgram::CoverageAttributeIdx(), c)); fHWConstAttribCoverage = coverage; } @@ -430,7 +430,7 @@ bool GrGpuGL::flushGraphicsState(DrawType type) { GrIRect* devRect = NULL; GrIRect devClipBounds; if (drawState.isClipState()) { - fClip->getConservativeBounds(drawState.getRenderTarget(), + fClip->getConservativeBounds(drawState.getRenderTarget(), &devClipBounds); devRect = &devClipBounds; } @@ -520,7 +520,7 @@ void GrGpuGL::setupGeometry(int* startVertex, if (posAndTexChange) { int idx = GrGLProgram::PositionAttributeIdx(); - GL_CALL(VertexAttribPointer(idx, 2, scalarType, false, newStride, + GL_CALL(VertexAttribPointer(idx, 2, scalarType, false, newStride, (GrGLvoid*)vertexOffset)); fHWGeometryState.fVertexOffset = vertexOffset; } @@ -531,11 +531,11 @@ void GrGpuGL::setupGeometry(int* startVertex, int idx = GrGLProgram::TexCoordAttributeIdx(t); if (oldTexCoordOffsets[t] <= 0) { GL_CALL(EnableVertexAttribArray(idx)); - GL_CALL(VertexAttribPointer(idx, 2, scalarType, texCoordNorm, + GL_CALL(VertexAttribPointer(idx, 2, scalarType, texCoordNorm, newStride, texCoordOffset)); } else if (posAndTexChange || newTexCoordOffsets[t] != oldTexCoordOffsets[t]) { - GL_CALL(VertexAttribPointer(idx, 2, scalarType, texCoordNorm, + GL_CALL(VertexAttribPointer(idx, 2, scalarType, texCoordNorm, newStride, texCoordOffset)); } } else if (oldTexCoordOffsets[t] > 0) { @@ -671,9 +671,9 @@ void GrGpuGL::buildProgram(bool isPoints, } else { desc->fColorInput = ProgramDesc::kAttribute_ColorInput; } - + bool covIsSolidWhite = !requiresAttributeCoverage && 0xffffffff == drawState.getCoverage(); - + if (skipCoverage) { desc->fCoverageInput = ProgramDesc::kTransBlack_ColorInput; } else if (covIsSolidWhite) { @@ -780,7 +780,7 @@ void GrGpuGL::buildProgram(bool isPoints, #endif // We want to avoid generating programs with different "first cov stage" values when they would - // compute the same result. We set field in the desc to kNumStages when either there are no + // compute the same result. We set field in the desc to kNumStages when either there are no // coverage stages or the distinction between coverage and color is immaterial. int firstCoverageStage = GrDrawState::kNumStages; desc->fFirstCoverageStage = GrDrawState::kNumStages; diff --git a/src/gpu/gl/SkGLContext.cpp b/src/gpu/gl/SkGLContext.cpp index f67e68cc54..c5069b2db8 100644 --- a/src/gpu/gl/SkGLContext.cpp +++ b/src/gpu/gl/SkGLContext.cpp @@ -71,7 +71,7 @@ bool SkGLContext::init(int width, int height) { } SK_GL(*this, FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, GR_GL_COLOR_ATTACHMENT0, - GR_GL_RENDERBUFFER, + GR_GL_RENDERBUFFER, fColorBufferID)); SK_GL(*this, GenRenderbuffers(1, &fDepthStencilBufferID)); SK_GL(*this, BindRenderbuffer(GR_GL_RENDERBUFFER, fDepthStencilBufferID)); @@ -81,7 +81,7 @@ bool SkGLContext::init(int width, int height) { // depth stencil being available. bool supportsPackedDepthStencil; if (kES2_GrGLBinding == bindingInUse) { - supportsPackedDepthStencil = + supportsPackedDepthStencil = this->hasExtension("GL_OES_packed_depth_stencil"); } else { supportsPackedDepthStencil = version >= GR_GL_VER(3,0) || @@ -92,7 +92,7 @@ bool SkGLContext::init(int width, int height) { if (supportsPackedDepthStencil) { // ES2 requires sized internal formats for RenderbufferStorage // On Desktop we let the driver decide. - GrGLenum format = kES2_GrGLBinding == bindingInUse ? + GrGLenum format = kES2_GrGLBinding == bindingInUse ? GR_GL_DEPTH24_STENCIL8 : GR_GL_DEPTH_STENCIL; SK_GL(*this, RenderbufferStorage(GR_GL_RENDERBUFFER, @@ -103,7 +103,7 @@ bool SkGLContext::init(int width, int height) { GR_GL_RENDERBUFFER, fDepthStencilBufferID)); } else { - GrGLenum format = kES2_GrGLBinding == bindingInUse ? + GrGLenum format = kES2_GrGLBinding == bindingInUse ? GR_GL_STENCIL_INDEX8 : GR_GL_STENCIL_INDEX; SK_GL(*this, RenderbufferStorage(GR_GL_RENDERBUFFER, @@ -117,7 +117,7 @@ bool SkGLContext::init(int width, int height) { SK_GL(*this, Viewport(0, 0, width, height)); SK_GL(*this, ClearStencil(0)); SK_GL(*this, Clear(GR_GL_STENCIL_BUFFER_BIT)); - + error = SK_GL(*this, GetError()); GrGLenum status = SK_GL(*this, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); diff --git a/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp b/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp index cd1da719e6..19fe44f6d8 100644 --- a/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp +++ b/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp @@ -24,7 +24,7 @@ const GrGLInterface* GrGLCreateANGLEInterface() { static SkAutoTUnref<GrGLInterface> glInterface; static HMODULE ghANGLELib = NULL; - + if (NULL == ghANGLELib) { // We load the ANGLE library and never let it go ghANGLELib = LoadLibrary("libGLESv2.dll"); @@ -101,8 +101,8 @@ const GrGLInterface* GrGLCreateANGLEInterface() { #if GL_ARB_texture_storage GR_GET_PROC(GrGLTexStorage2DProc, TexStorage2D); #elif GL_EXT_texture_storage - interface->fTexStorage2D = (GrGLTexStorage2DProc) - GetProcAddress(ghANGLELib, + interface->fTexStorage2D = (GrGLTexStorage2DProc) + GetProcAddress(ghANGLELib, "glTexStorage2DEXT"); #endif GR_GET_PROC(GrGLUniform1fProc, Uniform1f); @@ -141,9 +141,9 @@ const GrGLInterface* GrGLCreateANGLEInterface() { GR_GET_PROC(GrGLFramebufferTexture2DProc, FramebufferTexture2D); GR_GET_PROC(GrGLGenFramebuffersProc, GenFramebuffers); GR_GET_PROC(GrGLGenRenderbuffersProc, GenRenderbuffers); - GR_GET_PROC(GrGLGetFramebufferAttachmentParameterivProc, + GR_GET_PROC(GrGLGetFramebufferAttachmentParameterivProc, GetFramebufferAttachmentParameteriv); - GR_GET_PROC(GrGLGetRenderbufferParameterivProc, + GR_GET_PROC(GrGLGetRenderbufferParameterivProc, GetRenderbufferParameteriv); GR_GET_PROC(GrGLRenderbufferStorageProc, RenderbufferStorage); diff --git a/src/gpu/gl/debug/GrBufferObj.h b/src/gpu/gl/debug/GrBufferObj.h index a78da837d2..faa23985c5 100644 --- a/src/gpu/gl/debug/GrBufferObj.h +++ b/src/gpu/gl/debug/GrBufferObj.h @@ -17,7 +17,7 @@ class GrBufferObj : public GrFakeRefObj { GR_DEFINE_CREATOR(GrBufferObj); public: - GrBufferObj() + GrBufferObj() : GrFakeRefObj() , fDataPtr(NULL) , fMapped(false) @@ -58,8 +58,8 @@ private: bool fMapped; // is the buffer object mapped via "glMapBuffer"? bool fBound; // is the buffer object bound via "glBindBuffer"? GrGLint fSize; // size in bytes - GrGLint fUsage; // one of: GL_STREAM_DRAW, - // GL_STATIC_DRAW, + GrGLint fUsage; // one of: GL_STREAM_DRAW, + // GL_STATIC_DRAW, // GL_DYNAMIC_DRAW typedef GrFakeRefObj INHERITED; diff --git a/src/gpu/gl/debug/GrDebugGL.cpp b/src/gpu/gl/debug/GrDebugGL.cpp index 657003967f..9e2e510b1b 100644 --- a/src/gpu/gl/debug/GrDebugGL.cpp +++ b/src/gpu/gl/debug/GrDebugGL.cpp @@ -29,7 +29,7 @@ GrDebugGL::Create GrDebugGL::gFactoryFunc[kObjTypeCount] = { }; -GrDebugGL::GrDebugGL() +GrDebugGL::GrDebugGL() : fPackRowLength(0) , fUnPackRowLength(0) , fCurTextureUnit(0) @@ -76,7 +76,7 @@ GrFakeRefObj *GrDebugGL::findObject(GrGLuint ID, GrObjTypes type) { for (int i = 0; i < fObjects.count(); ++i) { if (fObjects[i]->getID() == ID) { // && fObjects[i]->getType() == type) { // The application shouldn't be accessing objects - // that (as far as OpenGL knows) were already deleted + // that (as far as OpenGL knows) were already deleted GrAlwaysAssert(!fObjects[i]->getDeleted()); GrAlwaysAssert(!fObjects[i]->getMarkedForDeletion()); return fObjects[i]; @@ -86,7 +86,7 @@ GrFakeRefObj *GrDebugGL::findObject(GrGLuint ID, GrObjTypes type) { return NULL; } -void GrDebugGL::setArrayBuffer(GrBufferObj *arrayBuffer) { +void GrDebugGL::setArrayBuffer(GrBufferObj *arrayBuffer) { if (fArrayBuffer) { // automatically break the binding of the old buffer GrAlwaysAssert(fArrayBuffer->getBound()); @@ -96,7 +96,7 @@ void GrDebugGL::setArrayBuffer(GrBufferObj *arrayBuffer) { fArrayBuffer->unref(); } - fArrayBuffer = arrayBuffer; + fArrayBuffer = arrayBuffer; if (fArrayBuffer) { GrAlwaysAssert(!fArrayBuffer->getDeleted()); @@ -107,7 +107,7 @@ void GrDebugGL::setArrayBuffer(GrBufferObj *arrayBuffer) { } } -void GrDebugGL::setElementArrayBuffer(GrBufferObj *elementArrayBuffer) { +void GrDebugGL::setElementArrayBuffer(GrBufferObj *elementArrayBuffer) { if (fElementArrayBuffer) { // automatically break the binding of the old buffer GrAlwaysAssert(fElementArrayBuffer->getBound()); @@ -117,7 +117,7 @@ void GrDebugGL::setElementArrayBuffer(GrBufferObj *elementArrayBuffer) { fElementArrayBuffer->unref(); } - fElementArrayBuffer = elementArrayBuffer; + fElementArrayBuffer = elementArrayBuffer; if (fElementArrayBuffer) { GrAlwaysAssert(!fElementArrayBuffer->getDeleted()); @@ -128,11 +128,11 @@ void GrDebugGL::setElementArrayBuffer(GrBufferObj *elementArrayBuffer) { } } -void GrDebugGL::setTexture(GrTextureObj *texture) { +void GrDebugGL::setTexture(GrTextureObj *texture) { fTextureUnits[fCurTextureUnit]->setTexture(texture); } -void GrDebugGL::setFrameBuffer(GrFrameBufferObj *frameBuffer) { +void GrDebugGL::setFrameBuffer(GrFrameBufferObj *frameBuffer) { if (fFrameBuffer) { GrAlwaysAssert(fFrameBuffer->getBound()); fFrameBuffer->resetBound(); @@ -141,7 +141,7 @@ void GrDebugGL::setFrameBuffer(GrFrameBufferObj *frameBuffer) { fFrameBuffer->unref(); } - fFrameBuffer = frameBuffer; + fFrameBuffer = frameBuffer; if (fFrameBuffer) { GrAlwaysAssert(!fFrameBuffer->getDeleted()); @@ -152,7 +152,7 @@ void GrDebugGL::setFrameBuffer(GrFrameBufferObj *frameBuffer) { } } -void GrDebugGL::setRenderBuffer(GrRenderBufferObj *renderBuffer) { +void GrDebugGL::setRenderBuffer(GrRenderBufferObj *renderBuffer) { if (fRenderBuffer) { GrAlwaysAssert(fRenderBuffer->getBound()); fRenderBuffer->resetBound(); @@ -161,7 +161,7 @@ void GrDebugGL::setRenderBuffer(GrRenderBufferObj *renderBuffer) { fRenderBuffer->unref(); } - fRenderBuffer = renderBuffer; + fRenderBuffer = renderBuffer; if (fRenderBuffer) { GrAlwaysAssert(!fRenderBuffer->getDeleted()); diff --git a/src/gpu/gl/debug/GrDebugGL.h b/src/gpu/gl/debug/GrDebugGL.h index d6697fd211..409f13d106 100644 --- a/src/gpu/gl/debug/GrDebugGL.h +++ b/src/gpu/gl/debug/GrDebugGL.h @@ -73,8 +73,8 @@ public: void useProgram(GrProgramObj *program); - void setPackRowLength(GrGLint packRowLength) { - fPackRowLength = packRowLength; + void setPackRowLength(GrGLint packRowLength) { + fPackRowLength = packRowLength; } GrGLint getPackRowLength() const { return fPackRowLength; } diff --git a/src/gpu/gl/debug/GrFBBindableObj.h b/src/gpu/gl/debug/GrFBBindableObj.h index 38c86380a2..e2b43a6a1b 100644 --- a/src/gpu/gl/debug/GrFBBindableObj.h +++ b/src/gpu/gl/debug/GrFBBindableObj.h @@ -17,7 +17,7 @@ class GrFBBindableObj : public GrFakeRefObj { public: - GrFBBindableObj() + GrFBBindableObj() : GrFakeRefObj() { } @@ -27,51 +27,51 @@ public: GrAlwaysAssert(0 == fStencilReferees.count()); } - void setColorBound(GrFakeRefObj *referee) { + void setColorBound(GrFakeRefObj *referee) { fColorReferees.append(1, &referee); } - void resetColorBound(GrFakeRefObj *referee) { + void resetColorBound(GrFakeRefObj *referee) { int index = fColorReferees.find(referee); GrAlwaysAssert(0 <= index); fColorReferees.removeShuffle(index); } - bool getColorBound(GrFakeRefObj *referee) const { + bool getColorBound(GrFakeRefObj *referee) const { int index = fColorReferees.find(referee); return 0 <= index; } - bool getColorBound() const { + bool getColorBound() const { return 0 != fColorReferees.count(); } - void setDepthBound(GrFakeRefObj *referee) { + void setDepthBound(GrFakeRefObj *referee) { fDepthReferees.append(1, &referee); } - void resetDepthBound(GrFakeRefObj *referee) { + void resetDepthBound(GrFakeRefObj *referee) { int index = fDepthReferees.find(referee); GrAlwaysAssert(0 <= index); fDepthReferees.removeShuffle(index); } - bool getDepthBound(GrFakeRefObj *referee) const { + bool getDepthBound(GrFakeRefObj *referee) const { int index = fDepthReferees.find(referee); return 0 <= index; } - bool getDepthBound() const { + bool getDepthBound() const { return 0 != fDepthReferees.count(); } - void setStencilBound(GrFakeRefObj *referee) { + void setStencilBound(GrFakeRefObj *referee) { fStencilReferees.append(1, &referee); } - void resetStencilBound(GrFakeRefObj *referee) { + void resetStencilBound(GrFakeRefObj *referee) { int index = fStencilReferees.find(referee); GrAlwaysAssert(0 <= index); fStencilReferees.removeShuffle(index); } - bool getStencilBound(GrFakeRefObj *referee) const { + bool getStencilBound(GrFakeRefObj *referee) const { int index = fStencilReferees.find(referee); return 0 <= index; } - bool getStencilBound() const { + bool getStencilBound() const { return 0 != fStencilReferees.count(); } diff --git a/src/gpu/gl/debug/GrFakeRefObj.h b/src/gpu/gl/debug/GrFakeRefObj.h index 81fb90c4d0..7f21c94181 100644 --- a/src/gpu/gl/debug/GrFakeRefObj.h +++ b/src/gpu/gl/debug/GrFakeRefObj.h @@ -14,41 +14,41 @@ //////////////////////////////////////////////////////////////////////////////// // This object is used to track the OpenGL objects. We don't use real -// reference counting (i.e., we don't free the objects when their ref count +// reference counting (i.e., we don't free the objects when their ref count // goes to 0) so that we can detect invalid memory accesses. The refs we // are tracking in this class are actually OpenGL's references to the objects // not "ours" // Each object also gets a unique globally identifying ID class GrFakeRefObj : public GrNoncopyable { public: - GrFakeRefObj() + GrFakeRefObj() : fRef(0) , fHighRefCount(0) , fMarkedForDeletion(false) , fDeleted(false) { // source for globally unique IDs - 0 is reserved! - static int fNextID = 0; + static int fNextID = 0; fID = ++fNextID; } virtual ~GrFakeRefObj() {}; - void ref() { - fRef++; + void ref() { + fRef++; if (fHighRefCount < fRef) { fHighRefCount = fRef; } } - void unref() { - fRef--; + void unref() { + fRef--; GrAlwaysAssert(fRef >= 0); - // often in OpenGL a given object may still be in use when the + // often in OpenGL a given object may still be in use when the // delete call is made. In these cases the object is marked // for deletion and then freed when it is no longer in use if (0 == fRef && fMarkedForDeletion) { - this->deleteAction(); + this->deleteAction(); } } int getRefCount() const { return fRef; } diff --git a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp index 3f58cc69da..4aff202a9f 100644 --- a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp +++ b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp @@ -34,7 +34,7 @@ namespace { // suppress no previsous prototype warning //////////////////////////////////////////////////////////////////////////////// GrGLvoid GR_GL_FUNCTION_TYPE debugGLActiveTexture(GrGLenum texture) { - + // Ganesh offsets the texture unit indices texture -= GR_GL_TEXTURE0; GrAlwaysAssert(texture < GrDebugGL::getInstance()->getMaxTextureUnits()); @@ -43,15 +43,15 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLActiveTexture(GrGLenum texture) { } //////////////////////////////////////////////////////////////////////////////// -GrGLvoid GR_GL_FUNCTION_TYPE debugGLAttachShader(GrGLuint programID, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLAttachShader(GrGLuint programID, GrGLuint shaderID) { - GrProgramObj *program = GR_FIND(programID, GrProgramObj, + GrProgramObj *program = GR_FIND(programID, GrProgramObj, GrDebugGL::kProgram_ObjTypes); GrAlwaysAssert(program); - GrShaderObj *shader = GR_FIND(shaderID, - GrShaderObj, + GrShaderObj *shader = GR_FIND(shaderID, + GrShaderObj, GrDebugGL::kShader_ObjTypes); GrAlwaysAssert(shader); @@ -61,51 +61,51 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLAttachShader(GrGLuint programID, GrGLvoid GR_GL_FUNCTION_TYPE debugGLBeginQuery(GrGLenum target, GrGLuint id) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindAttribLocation(GrGLuint program, - GrGLuint index, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindAttribLocation(GrGLuint program, + GrGLuint index, const char* name) { } //////////////////////////////////////////////////////////////////////////////// -GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindTexture(GrGLenum target, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindTexture(GrGLenum target, GrGLuint textureID) { // we don't use cube maps - GrAlwaysAssert(target == GR_GL_TEXTURE_2D); + GrAlwaysAssert(target == GR_GL_TEXTURE_2D); // || target == GR_GL_TEXTURE_CUBE_MAP); // a textureID of 0 is acceptable - it binds to the default texture target - GrTextureObj *texture = GR_FIND(textureID, GrTextureObj, + GrTextureObj *texture = GR_FIND(textureID, GrTextureObj, GrDebugGL::kTexture_ObjTypes); GrDebugGL::getInstance()->setTexture(texture); } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLBlendColor(GrGLclampf red, - GrGLclampf green, - GrGLclampf blue, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLBlendColor(GrGLclampf red, + GrGLclampf green, + GrGLclampf blue, GrGLclampf alpha) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindFragDataLocation(GrGLuint program, - GrGLuint colorNumber, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindFragDataLocation(GrGLuint program, + GrGLuint colorNumber, const GrGLchar* name) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLBlendFunc(GrGLenum sfactor, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLBlendFunc(GrGLenum sfactor, GrGLenum dfactor) { } //////////////////////////////////////////////////////////////////////////////// -GrGLvoid GR_GL_FUNCTION_TYPE debugGLBufferData(GrGLenum target, - GrGLsizeiptr size, - const GrGLvoid* data, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLBufferData(GrGLenum target, + GrGLsizeiptr size, + const GrGLvoid* data, GrGLenum usage) { - GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || + GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || GR_GL_ELEMENT_ARRAY_BUFFER == target); GrAlwaysAssert(size >= 0); - GrAlwaysAssert(GR_GL_STREAM_DRAW == usage || - GR_GL_STATIC_DRAW == usage || + GrAlwaysAssert(GR_GL_STREAM_DRAW == usage || + GR_GL_STATIC_DRAW == usage || GR_GL_DYNAMIC_DRAW == usage); GrBufferObj *buffer = NULL; @@ -128,40 +128,40 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLBufferData(GrGLenum target, buffer->setUsage(usage); } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLBufferSubData(GrGLenum target, - GrGLintptr offset, - GrGLsizeiptr size, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLBufferSubData(GrGLenum target, + GrGLintptr offset, + GrGLsizeiptr size, const GrGLvoid* data) { } GrGLvoid GR_GL_FUNCTION_TYPE debugGLClear(GrGLbitfield mask) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLClearColor(GrGLclampf red, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLClearColor(GrGLclampf red, GrGLclampf green, - GrGLclampf blue, + GrGLclampf blue, GrGLclampf alpha) { } GrGLvoid GR_GL_FUNCTION_TYPE debugGLClearStencil(GrGLint s) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLColorMask(GrGLboolean red, - GrGLboolean green, - GrGLboolean blue, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLColorMask(GrGLboolean red, + GrGLboolean green, + GrGLboolean blue, GrGLboolean alpha) { } GrGLvoid GR_GL_FUNCTION_TYPE debugGLCompileShader(GrGLuint shader) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLCompressedTexImage2D(GrGLenum target, - GrGLint level, - GrGLenum internalformat, - GrGLsizei width, - GrGLsizei height, - GrGLint border, - GrGLsizei imageSize, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLCompressedTexImage2D(GrGLenum target, + GrGLint level, + GrGLenum internalformat, + GrGLsizei width, + GrGLsizei height, + GrGLint border, + GrGLsizei imageSize, const GrGLvoid* data) { } @@ -177,21 +177,21 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLDisable(GrGLenum cap) { GrGLvoid GR_GL_FUNCTION_TYPE debugGLDisableVertexAttribArray(GrGLuint index) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLDrawArrays(GrGLenum mode, - GrGLint first, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLDrawArrays(GrGLenum mode, + GrGLint first, GrGLsizei count) { } GrGLvoid GR_GL_FUNCTION_TYPE debugGLDrawBuffer(GrGLenum mode) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLDrawBuffers(GrGLsizei n, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLDrawBuffers(GrGLsizei n, const GrGLenum* bufs) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLDrawElements(GrGLenum mode, - GrGLsizei count, - GrGLenum type, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLDrawElements(GrGLenum mode, + GrGLsizei count, + GrGLenum type, const GrGLvoid* indices) { } @@ -219,7 +219,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLLineWidth(GrGLfloat width) { GrGLvoid GR_GL_FUNCTION_TYPE debugGLLinkProgram(GrGLuint program) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLPixelStorei(GrGLenum pname, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLPixelStorei(GrGLenum pname, GrGLint param) { switch (pname) { @@ -240,19 +240,19 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLPixelStorei(GrGLenum pname, } } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLQueryCounter(GrGLuint id, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLQueryCounter(GrGLuint id, GrGLenum target) { } GrGLvoid GR_GL_FUNCTION_TYPE debugGLReadBuffer(GrGLenum src) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLReadPixels(GrGLint x, - GrGLint y, - GrGLsizei width, - GrGLsizei height, - GrGLenum format, - GrGLenum type, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLReadPixels(GrGLint x, + GrGLint y, + GrGLsizei width, + GrGLsizei height, + GrGLenum format, + GrGLenum type, GrGLvoid* pixels) { GrGLint pixelsInRow = width; @@ -297,8 +297,8 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLReadPixels(GrGLint x, if (componentSize >= alignment) { rowStride = componentsPerPixel * pixelsInRow; } else { - float fTemp = - sk_float_ceil(componentSize * componentsPerPixel * pixelsInRow / + float fTemp = + sk_float_ceil(componentSize * componentsPerPixel * pixelsInRow / static_cast<float>(alignment)); rowStride = static_cast<GrGLint>(alignment * fTemp / componentSize); } @@ -310,250 +310,250 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLReadPixels(GrGLint x, } } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLScissor(GrGLint x, - GrGLint y, - GrGLsizei width, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLScissor(GrGLint x, + GrGLint y, + GrGLsizei width, GrGLsizei height) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLShaderSource(GrGLuint shader, - GrGLsizei count, - const char** str, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLShaderSource(GrGLuint shader, + GrGLsizei count, + const char** str, const GrGLint* length) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLStencilFunc(GrGLenum func, - GrGLint ref, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLStencilFunc(GrGLenum func, + GrGLint ref, GrGLuint mask) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLStencilFuncSeparate(GrGLenum face, - GrGLenum func, - GrGLint ref, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLStencilFuncSeparate(GrGLenum face, + GrGLenum func, + GrGLint ref, GrGLuint mask) { } GrGLvoid GR_GL_FUNCTION_TYPE debugGLStencilMask(GrGLuint mask) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLStencilMaskSeparate(GrGLenum face, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLStencilMaskSeparate(GrGLenum face, GrGLuint mask) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLStencilOp(GrGLenum fail, - GrGLenum zfail, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLStencilOp(GrGLenum fail, + GrGLenum zfail, GrGLenum zpass) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLStencilOpSeparate(GrGLenum face, - GrGLenum fail, - GrGLenum zfail, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLStencilOpSeparate(GrGLenum face, + GrGLenum fail, + GrGLenum zfail, GrGLenum zpass) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLTexImage2D(GrGLenum target, - GrGLint level, - GrGLint internalformat, - GrGLsizei width, - GrGLsizei height, - GrGLint border, - GrGLenum format, - GrGLenum type, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLTexImage2D(GrGLenum target, + GrGLint level, + GrGLint internalformat, + GrGLsizei width, + GrGLsizei height, + GrGLint border, + GrGLenum format, + GrGLenum type, const GrGLvoid* pixels) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLTexParameteri(GrGLenum target, - GrGLenum pname, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLTexParameteri(GrGLenum target, + GrGLenum pname, GrGLint param) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLTexParameteriv(GrGLenum target, - GrGLenum pname, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLTexParameteriv(GrGLenum target, + GrGLenum pname, const GrGLint* params) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLTexStorage2D(GrGLenum target, - GrGLsizei levels, - GrGLenum internalformat, - GrGLsizei width, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLTexStorage2D(GrGLenum target, + GrGLsizei levels, + GrGLenum internalformat, + GrGLsizei width, GrGLsizei height) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLTexSubImage2D(GrGLenum target, - GrGLint level, - GrGLint xoffset, - GrGLint yoffset, - GrGLsizei width, - GrGLsizei height, - GrGLenum format, - GrGLenum type, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLTexSubImage2D(GrGLenum target, + GrGLint level, + GrGLint xoffset, + GrGLint yoffset, + GrGLsizei width, + GrGLsizei height, + GrGLenum format, + GrGLenum type, const GrGLvoid* pixels) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform1f(GrGLint location, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform1f(GrGLint location, GrGLfloat v0) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform1i(GrGLint location, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform1i(GrGLint location, GrGLint v0) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform1fv(GrGLint location, - GrGLsizei count, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform1fv(GrGLint location, + GrGLsizei count, const GrGLfloat* v) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform1iv(GrGLint location, - GrGLsizei count, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform1iv(GrGLint location, + GrGLsizei count, const GrGLint* v) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform2f(GrGLint location, - GrGLfloat v0, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform2f(GrGLint location, + GrGLfloat v0, GrGLfloat v1) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform2i(GrGLint location, - GrGLint v0, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform2i(GrGLint location, + GrGLint v0, GrGLint v1) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform2fv(GrGLint location, - GrGLsizei count, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform2fv(GrGLint location, + GrGLsizei count, const GrGLfloat* v) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform2iv(GrGLint location, - GrGLsizei count, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform2iv(GrGLint location, + GrGLsizei count, const GrGLint* v) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform3f(GrGLint location, - GrGLfloat v0, - GrGLfloat v1, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform3f(GrGLint location, + GrGLfloat v0, + GrGLfloat v1, GrGLfloat v2) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform3i(GrGLint location, - GrGLint v0, - GrGLint v1, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform3i(GrGLint location, + GrGLint v0, + GrGLint v1, GrGLint v2) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform3fv(GrGLint location, - GrGLsizei count, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform3fv(GrGLint location, + GrGLsizei count, const GrGLfloat* v) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform3iv(GrGLint location, - GrGLsizei count, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform3iv(GrGLint location, + GrGLsizei count, const GrGLint* v) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform4f(GrGLint location, - GrGLfloat v0, - GrGLfloat v1, - GrGLfloat v2, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform4f(GrGLint location, + GrGLfloat v0, + GrGLfloat v1, + GrGLfloat v2, GrGLfloat v3) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform4i(GrGLint location, - GrGLint v0, - GrGLint v1, - GrGLint v2, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform4i(GrGLint location, + GrGLint v0, + GrGLint v1, + GrGLint v2, GrGLint v3) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform4fv(GrGLint location, - GrGLsizei count, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform4fv(GrGLint location, + GrGLsizei count, const GrGLfloat* v) { } - GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform4iv(GrGLint location, - GrGLsizei count, + GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform4iv(GrGLint location, + GrGLsizei count, const GrGLint* v) { } - GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniformMatrix2fv(GrGLint location, - GrGLsizei count, - GrGLboolean transpose, + GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniformMatrix2fv(GrGLint location, + GrGLsizei count, + GrGLboolean transpose, const GrGLfloat* value) { } - GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniformMatrix3fv(GrGLint location, - GrGLsizei count, - GrGLboolean transpose, + GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniformMatrix3fv(GrGLint location, + GrGLsizei count, + GrGLboolean transpose, const GrGLfloat* value) { } - GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniformMatrix4fv(GrGLint location, - GrGLsizei count, - GrGLboolean transpose, + GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniformMatrix4fv(GrGLint location, + GrGLsizei count, + GrGLboolean transpose, const GrGLfloat* value) { } GrGLvoid GR_GL_FUNCTION_TYPE debugGLUseProgram(GrGLuint programID) { // A programID of 0 is legal - GrProgramObj *program = GR_FIND(programID, - GrProgramObj, + GrProgramObj *program = GR_FIND(programID, + GrProgramObj, GrDebugGL::kProgram_ObjTypes); GrDebugGL::getInstance()->useProgram(program); } - GrGLvoid GR_GL_FUNCTION_TYPE debugGLVertexAttrib4fv(GrGLuint indx, + GrGLvoid GR_GL_FUNCTION_TYPE debugGLVertexAttrib4fv(GrGLuint indx, const GrGLfloat* values) { } - GrGLvoid GR_GL_FUNCTION_TYPE debugGLVertexAttribPointer(GrGLuint indx, - GrGLint size, - GrGLenum type, - GrGLboolean normalized, - GrGLsizei stride, + GrGLvoid GR_GL_FUNCTION_TYPE debugGLVertexAttribPointer(GrGLuint indx, + GrGLint size, + GrGLenum type, + GrGLboolean normalized, + GrGLsizei stride, const GrGLvoid* ptr) { } - GrGLvoid GR_GL_FUNCTION_TYPE debugGLViewport(GrGLint x, - GrGLint y, - GrGLsizei width, + GrGLvoid GR_GL_FUNCTION_TYPE debugGLViewport(GrGLint x, + GrGLint y, + GrGLsizei width, GrGLsizei height) { } - GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindFramebuffer(GrGLenum target, + GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindFramebuffer(GrGLenum target, GrGLuint frameBufferID) { GrAlwaysAssert(GR_GL_FRAMEBUFFER == target); - // a frameBufferID of 0 is acceptable - it binds to the default + // a frameBufferID of 0 is acceptable - it binds to the default // frame buffer - GrFrameBufferObj *frameBuffer = GR_FIND(frameBufferID, - GrFrameBufferObj, + GrFrameBufferObj *frameBuffer = GR_FIND(frameBufferID, + GrFrameBufferObj, GrDebugGL::kFrameBuffer_ObjTypes); GrDebugGL::getInstance()->setFrameBuffer(frameBuffer); } - GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindRenderbuffer(GrGLenum target, + GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindRenderbuffer(GrGLenum target, GrGLuint renderBufferID) { GrAlwaysAssert(GR_GL_RENDERBUFFER == target); // a renderBufferID of 0 is acceptable - it unbinds the bound render buffer - GrRenderBufferObj *renderBuffer = GR_FIND(renderBufferID, - GrRenderBufferObj, + GrRenderBufferObj *renderBuffer = GR_FIND(renderBufferID, + GrRenderBufferObj, GrDebugGL::kRenderBuffer_ObjTypes); GrDebugGL::getInstance()->setRenderBuffer(renderBuffer); } - GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteTextures(GrGLsizei n, + GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteTextures(GrGLsizei n, const GrGLuint* textures) { // first potentially unbind the texture // TODO: move this into GrDebugGL as unBindTexture? - for (unsigned int i = 0; - i < GrDebugGL::getInstance()->getMaxTextureUnits(); + for (unsigned int i = 0; + i < GrDebugGL::getInstance()->getMaxTextureUnits(); ++i) { GrTextureUnitObj *pTU = GrDebugGL::getInstance()->getTextureUnit(i); @@ -569,7 +569,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform4fv(GrGLint location, } // TODO: fuse the following block with DeleteRenderBuffers? - // Open GL will remove a deleted render buffer from the active + // Open GL will remove a deleted render buffer from the active // frame buffer but not from any other frame buffer if (GrDebugGL::getInstance()->getFrameBuffer()) { @@ -577,15 +577,15 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform4fv(GrGLint location, for (int i = 0; i < n; ++i) { - if (NULL != frameBuffer->getColor() && + if (NULL != frameBuffer->getColor() && textures[i] == frameBuffer->getColor()->getID()) { frameBuffer->setColor(NULL); - } - if (NULL != frameBuffer->getDepth() && + } + if (NULL != frameBuffer->getDepth() && textures[i] == frameBuffer->getDepth()->getID()) { frameBuffer->setDepth(NULL); } - if (NULL != frameBuffer->getStencil() && + if (NULL != frameBuffer->getStencil() && textures[i] == frameBuffer->getStencil()->getID()) { frameBuffer->setStencil(NULL); } @@ -594,8 +594,8 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform4fv(GrGLint location, // then actually "delete" the buffers for (int i = 0; i < n; ++i) { - GrTextureObj *buffer = GR_FIND(textures[i], - GrTextureObj, + GrTextureObj *buffer = GR_FIND(textures[i], + GrTextureObj, GrDebugGL::kTexture_ObjTypes); GrAlwaysAssert(buffer); @@ -610,14 +610,14 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform4fv(GrGLint location, } - GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteFramebuffers(GrGLsizei n, + GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteFramebuffers(GrGLsizei n, const GrGLuint *frameBuffers) { // first potentially unbind the buffers if (GrDebugGL::getInstance()->getFrameBuffer()) { for (int i = 0; i < n; ++i) { - if (frameBuffers[i] == + if (frameBuffers[i] == GrDebugGL::getInstance()->getFrameBuffer()->getID()) { // this ID is the current frame buffer - rebind to the default GrDebugGL::getInstance()->setFrameBuffer(NULL); @@ -627,8 +627,8 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform4fv(GrGLint location, // then actually "delete" the buffers for (int i = 0; i < n; ++i) { - GrFrameBufferObj *buffer = GR_FIND(frameBuffers[i], - GrFrameBufferObj, + GrFrameBufferObj *buffer = GR_FIND(frameBuffers[i], + GrFrameBufferObj, GrDebugGL::kFrameBuffer_ObjTypes); GrAlwaysAssert(buffer); @@ -637,16 +637,16 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform4fv(GrGLint location, } } - GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteRenderbuffers(GrGLsizei n, + GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteRenderbuffers(GrGLsizei n, const GrGLuint *renderBuffers) { // first potentially unbind the buffers if (GrDebugGL::getInstance()->getRenderBuffer()) { for (int i = 0; i < n; ++i) { - if (renderBuffers[i] == + if (renderBuffers[i] == GrDebugGL::getInstance()->getRenderBuffer()->getID()) { - // this ID is the current render buffer - make no + // this ID is the current render buffer - make no // render buffer be bound GrDebugGL::getInstance()->setRenderBuffer(NULL); } @@ -654,24 +654,24 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform4fv(GrGLint location, } // TODO: fuse the following block with DeleteTextures? - // Open GL will remove a deleted render buffer from the active frame + // Open GL will remove a deleted render buffer from the active frame // buffer but not from any other frame buffer if (GrDebugGL::getInstance()->getFrameBuffer()) { - GrFrameBufferObj *frameBuffer = + GrFrameBufferObj *frameBuffer = GrDebugGL::getInstance()->getFrameBuffer(); for (int i = 0; i < n; ++i) { - if (NULL != frameBuffer->getColor() && + if (NULL != frameBuffer->getColor() && renderBuffers[i] == frameBuffer->getColor()->getID()) { frameBuffer->setColor(NULL); - } - if (NULL != frameBuffer->getDepth() && + } + if (NULL != frameBuffer->getDepth() && renderBuffers[i] == frameBuffer->getDepth()->getID()) { frameBuffer->setDepth(NULL); } - if (NULL != frameBuffer->getStencil() && + if (NULL != frameBuffer->getStencil() && renderBuffers[i] == frameBuffer->getStencil()->getID()) { frameBuffer->setStencil(NULL); } @@ -680,13 +680,13 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform4fv(GrGLint location, // then actually "delete" the buffers for (int i = 0; i < n; ++i) { - GrRenderBufferObj *buffer = GR_FIND(renderBuffers[i], - GrRenderBufferObj, + GrRenderBufferObj *buffer = GR_FIND(renderBuffers[i], + GrRenderBufferObj, GrDebugGL::kRenderBuffer_ObjTypes); GrAlwaysAssert(buffer); - // OpenGL gives no guarantees if a render buffer is deleted - // while attached to something other than the currently + // OpenGL gives no guarantees if a render buffer is deleted + // while attached to something other than the currently // bound frame buffer GrAlwaysAssert(!buffer->getColorBound()); GrAlwaysAssert(!buffer->getDepthBound()); @@ -697,14 +697,14 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform4fv(GrGLint location, } } - GrGLvoid GR_GL_FUNCTION_TYPE debugGLFramebufferRenderbuffer(GrGLenum target, - GrGLenum attachment, - GrGLenum renderbuffertarget, + GrGLvoid GR_GL_FUNCTION_TYPE debugGLFramebufferRenderbuffer(GrGLenum target, + GrGLenum attachment, + GrGLenum renderbuffertarget, GrGLuint renderBufferID) { GrAlwaysAssert(GR_GL_FRAMEBUFFER == target); - GrAlwaysAssert(GR_GL_COLOR_ATTACHMENT0 == attachment || - GR_GL_DEPTH_ATTACHMENT == attachment || + GrAlwaysAssert(GR_GL_COLOR_ATTACHMENT0 == attachment || + GR_GL_DEPTH_ATTACHMENT == attachment || GR_GL_STENCIL_ATTACHMENT == attachment); GrAlwaysAssert(GR_GL_RENDERBUFFER == renderbuffertarget); @@ -712,10 +712,10 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform4fv(GrGLint location, // A render buffer cannot be attached to the default framebuffer GrAlwaysAssert(NULL != framebuffer); - // a renderBufferID of 0 is acceptable - it unbinds the current + // a renderBufferID of 0 is acceptable - it unbinds the current // render buffer - GrRenderBufferObj *renderbuffer = GR_FIND(renderBufferID, - GrRenderBufferObj, + GrRenderBufferObj *renderbuffer = GR_FIND(renderBufferID, + GrRenderBufferObj, GrDebugGL::kRenderBuffer_ObjTypes); switch (attachment) { @@ -736,15 +736,15 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform4fv(GrGLint location, } //////////////////////////////////////////////////////////////////////////////// - GrGLvoid GR_GL_FUNCTION_TYPE debugGLFramebufferTexture2D(GrGLenum target, - GrGLenum attachment, - GrGLenum textarget, - GrGLuint textureID, + GrGLvoid GR_GL_FUNCTION_TYPE debugGLFramebufferTexture2D(GrGLenum target, + GrGLenum attachment, + GrGLenum textarget, + GrGLuint textureID, GrGLint level) { GrAlwaysAssert(GR_GL_FRAMEBUFFER == target); - GrAlwaysAssert(GR_GL_COLOR_ATTACHMENT0 == attachment || - GR_GL_DEPTH_ATTACHMENT == attachment || + GrAlwaysAssert(GR_GL_COLOR_ATTACHMENT0 == attachment || + GR_GL_DEPTH_ATTACHMENT == attachment || GR_GL_STENCIL_ATTACHMENT == attachment); GrAlwaysAssert(GR_GL_TEXTURE_2D == textarget); @@ -753,10 +753,10 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform4fv(GrGLint location, GrAlwaysAssert(NULL != framebuffer); // A textureID of 0 is allowed - it unbinds the currently bound texture - GrTextureObj *texture = GR_FIND(textureID, GrTextureObj, + GrTextureObj *texture = GR_FIND(textureID, GrTextureObj, GrDebugGL::kTexture_ObjTypes); if (texture) { - // The texture shouldn't be bound to a texture unit - this + // The texture shouldn't be bound to a texture unit - this // could lead to a feedback loop GrAlwaysAssert(!texture->getBound()); } @@ -779,48 +779,48 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLUniform4fv(GrGLint location, }; } - GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetFramebufferAttachmentParameteriv(GrGLenum target, - GrGLenum attachment, - GrGLenum pname, + GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetFramebufferAttachmentParameteriv(GrGLenum target, + GrGLenum attachment, + GrGLenum pname, GrGLint* params) { } - GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetRenderbufferParameteriv(GrGLenum target, - GrGLenum pname, + GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetRenderbufferParameteriv(GrGLenum target, + GrGLenum pname, GrGLint* params) { } - GrGLvoid GR_GL_FUNCTION_TYPE debugGLRenderbufferStorage(GrGLenum target, - GrGLenum internalformat, - GrGLsizei width, + GrGLvoid GR_GL_FUNCTION_TYPE debugGLRenderbufferStorage(GrGLenum target, + GrGLenum internalformat, + GrGLsizei width, GrGLsizei height) { } - GrGLvoid GR_GL_FUNCTION_TYPE debugGLRenderbufferStorageMultisample(GrGLenum target, - GrGLsizei samples, - GrGLenum internalformat, - GrGLsizei width, + GrGLvoid GR_GL_FUNCTION_TYPE debugGLRenderbufferStorageMultisample(GrGLenum target, + GrGLsizei samples, + GrGLenum internalformat, + GrGLsizei width, GrGLsizei height) { } - GrGLvoid GR_GL_FUNCTION_TYPE debugGLBlitFramebuffer(GrGLint srcX0, - GrGLint srcY0, - GrGLint srcX1, - GrGLint srcY1, - GrGLint dstX0, - GrGLint dstY0, - GrGLint dstX1, - GrGLint dstY1, - GrGLbitfield mask, + GrGLvoid GR_GL_FUNCTION_TYPE debugGLBlitFramebuffer(GrGLint srcX0, + GrGLint srcY0, + GrGLint srcX1, + GrGLint srcY1, + GrGLint dstX0, + GrGLint dstY0, + GrGLint dstX1, + GrGLint dstY1, + GrGLbitfield mask, GrGLenum filter) { } GrGLvoid GR_GL_FUNCTION_TYPE debugGLResolveMultisampleFramebuffer() { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindFragDataLocationIndexed(GrGLuint program, - GrGLuint colorNumber, - GrGLuint index, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindFragDataLocationIndexed(GrGLuint program, + GrGLuint colorNumber, + GrGLuint index, const GrGLchar * name) { } @@ -833,15 +833,15 @@ GrGLenum GR_GL_FUNCTION_TYPE debugGLCheckFramebufferStatus(GrGLenum target) { GrGLuint GR_GL_FUNCTION_TYPE debugGLCreateProgram() { - GrProgramObj *program = GR_CREATE(GrProgramObj, + GrProgramObj *program = GR_CREATE(GrProgramObj, GrDebugGL::kProgram_ObjTypes); return program->getID(); } GrGLuint GR_GL_FUNCTION_TYPE debugGLCreateShader(GrGLenum type) { - - GrAlwaysAssert(GR_GL_VERTEX_SHADER == type || + + GrAlwaysAssert(GR_GL_VERTEX_SHADER == type || GR_GL_FRAGMENT_SHADER == type); GrShaderObj *shader = GR_CREATE(GrShaderObj, GrDebugGL::kShader_ObjTypes); @@ -852,8 +852,8 @@ GrGLuint GR_GL_FUNCTION_TYPE debugGLCreateShader(GrGLenum type) { GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteProgram(GrGLuint programID) { - GrProgramObj *program = GR_FIND(programID, - GrProgramObj, + GrProgramObj *program = GR_FIND(programID, + GrProgramObj, GrDebugGL::kProgram_ObjTypes); GrAlwaysAssert(program); @@ -867,8 +867,8 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteProgram(GrGLuint programID) { GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteShader(GrGLuint shaderID) { - GrShaderObj *shader = GR_FIND(shaderID, - GrShaderObj, + GrShaderObj *shader = GR_FIND(shaderID, + GrShaderObj, GrDebugGL::kShader_ObjTypes); GrAlwaysAssert(shader); @@ -888,8 +888,8 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLGenIds(GrGLsizei n, GrGLuint* ids) { } } -GrGLvoid debugGenObjs(GrDebugGL::GrObjTypes type, - GrGLsizei n, +GrGLvoid debugGenObjs(GrDebugGL::GrObjTypes type, + GrGLsizei n, GrGLuint* ids) { for (int i = 0; i < n; ++i) { @@ -904,13 +904,13 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLGenBuffers(GrGLsizei n, GrGLuint* ids) { debugGenObjs(GrDebugGL::kBuffer_ObjTypes, n, ids); } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLGenFramebuffers(GrGLsizei n, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLGenFramebuffers(GrGLsizei n, GrGLuint* ids) { debugGenObjs(GrDebugGL::kFrameBuffer_ObjTypes, n, ids); } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLGenRenderbuffers(GrGLsizei n, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLGenRenderbuffers(GrGLsizei n, GrGLuint* ids) { debugGenObjs(GrDebugGL::kRenderBuffer_ObjTypes, n, ids); @@ -921,20 +921,20 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLGenTextures(GrGLsizei n, GrGLuint* ids) { debugGenObjs(GrDebugGL::kTexture_ObjTypes, n, ids); } -// same delete function for all glDelete*(GLsize i, const GLuint*) except +// same delete function for all glDelete*(GLsize i, const GLuint*) except // buffers -GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteIds(GrGLsizei n, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteIds(GrGLsizei n, const GrGLuint* ids) { } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindBuffer(GrGLenum target, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindBuffer(GrGLenum target, GrGLuint bufferID) { - GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || + GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || GR_GL_ELEMENT_ARRAY_BUFFER == target); - GrBufferObj *buffer = GR_FIND(bufferID, - GrBufferObj, + GrBufferObj *buffer = GR_FIND(bufferID, + GrBufferObj, GrDebugGL::kBuffer_ObjTypes); // 0 is a permissable bufferID - it unbinds the current buffer @@ -952,18 +952,18 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindBuffer(GrGLenum target, } // deleting a bound buffer has the side effect of binding 0 -GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteBuffers(GrGLsizei n, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteBuffers(GrGLsizei n, const GrGLuint* ids) { // first potentially unbind the buffers for (int i = 0; i < n; ++i) { - if (GrDebugGL::getInstance()->getArrayBuffer() && + if (GrDebugGL::getInstance()->getArrayBuffer() && ids[i] == GrDebugGL::getInstance()->getArrayBuffer()->getID()) { // this ID is the current array buffer GrDebugGL::getInstance()->setArrayBuffer(NULL); } - if (GrDebugGL::getInstance()->getElementArrayBuffer() && - ids[i] == + if (GrDebugGL::getInstance()->getElementArrayBuffer() && + ids[i] == GrDebugGL::getInstance()->getElementArrayBuffer()->getID()) { // this ID is the current element array buffer GrDebugGL::getInstance()->setElementArrayBuffer(NULL); @@ -972,8 +972,8 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteBuffers(GrGLsizei n, // then actually "delete" the buffers for (int i = 0; i < n; ++i) { - GrBufferObj *buffer = GR_FIND(ids[i], - GrBufferObj, + GrBufferObj *buffer = GR_FIND(ids[i], + GrBufferObj, GrDebugGL::kBuffer_ObjTypes); GrAlwaysAssert(buffer); @@ -983,13 +983,13 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteBuffers(GrGLsizei n, } // map a buffer to the caller's address space -GrGLvoid* GR_GL_FUNCTION_TYPE debugGLMapBuffer(GrGLenum target, +GrGLvoid* GR_GL_FUNCTION_TYPE debugGLMapBuffer(GrGLenum target, GrGLenum access) { - GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || + GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || GR_GL_ELEMENT_ARRAY_BUFFER == target); // GR_GL_READ_ONLY == access || || GR_GL_READ_WRIT == access); - GrAlwaysAssert(GR_GL_WRITE_ONLY == access); + GrAlwaysAssert(GR_GL_WRITE_ONLY == access); GrBufferObj *buffer = NULL; switch (target) { @@ -1015,10 +1015,10 @@ GrGLvoid* GR_GL_FUNCTION_TYPE debugGLMapBuffer(GrGLenum target, } // remove a buffer from the caller's address space -// TODO: check if the "access" method from "glMapBuffer" was honored +// TODO: check if the "access" method from "glMapBuffer" was honored GrGLboolean GR_GL_FUNCTION_TYPE debugGLUnmapBuffer(GrGLenum target) { - GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || + GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || GR_GL_ELEMENT_ARRAY_BUFFER == target); GrBufferObj *buffer = NULL; @@ -1044,13 +1044,13 @@ GrGLboolean GR_GL_FUNCTION_TYPE debugGLUnmapBuffer(GrGLenum target) { return GR_GL_FALSE; // GR_GL_INVALID_OPERATION; } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetBufferParameteriv(GrGLenum target, - GrGLenum value, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetBufferParameteriv(GrGLenum target, + GrGLenum value, GrGLint* params) { - GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || + GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || GR_GL_ELEMENT_ARRAY_BUFFER == target); - GrAlwaysAssert(GR_GL_BUFFER_SIZE == value || + GrAlwaysAssert(GR_GL_BUFFER_SIZE == value || GR_GL_BUFFER_USAGE == value); GrBufferObj *buffer = NULL; @@ -1060,7 +1060,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetBufferParameteriv(GrGLenum target, break; case GR_GL_ELEMENT_ARRAY_BUFFER: buffer = GrDebugGL::getInstance()->getElementArrayBuffer(); - break; + break; } GrAlwaysAssert(buffer); @@ -1091,7 +1091,7 @@ GrGLenum GR_GL_FUNCTION_TYPE debugGLGetError() { return GR_GL_NO_ERROR; } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetIntegerv(GrGLenum pname, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetIntegerv(GrGLenum pname, GrGLint* params) { // TODO: remove from Ganesh the #defines for gets we don't use. // We would like to minimize gets overall due to performance issues @@ -1148,9 +1148,9 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetIntegerv(GrGLenum pname, } } // used for both the program and shader info logs -GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetInfoLog(GrGLuint program, - GrGLsizei bufsize, - GrGLsizei* length, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetInfoLog(GrGLuint program, + GrGLsizei bufsize, + GrGLsizei* length, char* infolog) { if (length) { *length = 0; @@ -1161,8 +1161,8 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetInfoLog(GrGLuint program, } // used for both the program and shader params -GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetShaderOrProgramiv(GrGLuint program, - GrGLenum pname, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetShaderOrProgramiv(GrGLuint program, + GrGLenum pname, GrGLint* params) { switch (pname) { case GR_GL_LINK_STATUS: // fallthru @@ -1196,10 +1196,10 @@ void query_result(GrGLenum GLtarget, GrGLenum pname, T *params) { } } -// Queries on the null GL just don't do anything at all. We could potentially +// Queries on the null GL just don't do anything at all. We could potentially // make the timers work. -GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetQueryiv(GrGLenum GLtarget, - GrGLenum pname, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetQueryiv(GrGLenum GLtarget, + GrGLenum pname, GrGLint *params) { switch (pname) { case GR_GL_CURRENT_QUERY: @@ -1213,26 +1213,26 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetQueryiv(GrGLenum GLtarget, } } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetQueryObjecti64v(GrGLuint id, - GrGLenum pname, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetQueryObjecti64v(GrGLuint id, + GrGLenum pname, GrGLint64 *params) { query_result(id, pname, params); } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetQueryObjectiv(GrGLuint id, - GrGLenum pname, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetQueryObjectiv(GrGLuint id, + GrGLenum pname, GrGLint *params) { query_result(id, pname, params); } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetQueryObjectui64v(GrGLuint id, - GrGLenum pname, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetQueryObjectui64v(GrGLuint id, + GrGLenum pname, GrGLuint64 *params) { query_result(id, pname, params); } -GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetQueryObjectuiv(GrGLuint id, - GrGLenum pname, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetQueryObjectuiv(GrGLuint id, + GrGLenum pname, GrGLuint *params) { query_result(id, pname, params); } @@ -1255,16 +1255,16 @@ const GrGLubyte* GR_GL_FUNCTION_TYPE debugGLGetString(GrGLenum name) { } } -// we used to use this to query stuff about externally created textures, +// we used to use this to query stuff about externally created textures, // now we just require clients to tell us everything about the texture. -GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetTexLevelParameteriv(GrGLenum target, - GrGLint level, - GrGLenum pname, +GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetTexLevelParameteriv(GrGLenum target, + GrGLint level, + GrGLenum pname, GrGLint* params) { GrCrash("Should never query texture parameters."); } -GrGLint GR_GL_FUNCTION_TYPE debugGLGetUniformLocation(GrGLuint program, +GrGLint GR_GL_FUNCTION_TYPE debugGLGetUniformLocation(GrGLuint program, const char* name) { static int gUniLocation = 0; return ++gUniLocation; @@ -1295,25 +1295,25 @@ public: // debug interface: // Since none of the "gl" methods are member functions they don't get // a "this" pointer through which to access "fWrapped" - // This could be worked around by having all of them access the - // "glInterface" pointer - i.e., treating the debug interface as a + // This could be worked around by having all of them access the + // "glInterface" pointer - i.e., treating the debug interface as a // true singleton // - // The problem with this is that we also want to handle OpenGL - // contexts. The natural way to do this is to have multiple debug - // interfaces. Each of which represents a separate context. The - // static ID count would still uniquify IDs across all of them. - // The problem then is that we couldn't treat the debug GL - // interface as a singleton (since there would be one for each + // The problem with this is that we also want to handle OpenGL + // contexts. The natural way to do this is to have multiple debug + // interfaces. Each of which represents a separate context. The + // static ID count would still uniquify IDs across all of them. + // The problem then is that we couldn't treat the debug GL + // interface as a singleton (since there would be one for each // context). // - // The solution to this is probably to alter SkDebugGlContext's - // "makeCurrent" method to make a call like "makeCurrent(this)" to - // the debug GL interface (assuming that the application will create - // multiple SkGLContext's) to let it switch between the active - // context. Everything in the GrDebugGL object would then need to be - // moved to a GrContextObj and the GrDebugGL object would just switch - // between them. Note that this approach would also require that + // The solution to this is probably to alter SkDebugGlContext's + // "makeCurrent" method to make a call like "makeCurrent(this)" to + // the debug GL interface (assuming that the application will create + // multiple SkGLContext's) to let it switch between the active + // context. Everything in the GrDebugGL object would then need to be + // moved to a GrContextObj and the GrDebugGL object would just switch + // between them. Note that this approach would also require that // SkDebugGLContext wrap an arbitrary other context // and then pass the wrapped interface to the debug GL interface. @@ -1439,18 +1439,18 @@ const GrGLInterface* GrGLCreateDebugInterface() { interface->fFramebufferTexture2D = debugGLFramebufferTexture2D; interface->fGenFramebuffers = debugGLGenFramebuffers; interface->fGenRenderbuffers = debugGLGenRenderbuffers; - interface->fGetFramebufferAttachmentParameteriv = + interface->fGetFramebufferAttachmentParameteriv = debugGLGetFramebufferAttachmentParameteriv; interface->fGetRenderbufferParameteriv = debugGLGetRenderbufferParameteriv; interface->fRenderbufferStorage = debugGLRenderbufferStorage; - interface->fRenderbufferStorageMultisample = + interface->fRenderbufferStorageMultisample = debugGLRenderbufferStorageMultisample; interface->fBlitFramebuffer = debugGLBlitFramebuffer; - interface->fResolveMultisampleFramebuffer = + interface->fResolveMultisampleFramebuffer = debugGLResolveMultisampleFramebuffer; interface->fMapBuffer = debugGLMapBuffer; interface->fUnmapBuffer = debugGLUnmapBuffer; - interface->fBindFragDataLocationIndexed = + interface->fBindFragDataLocationIndexed = debugGLBindFragDataLocationIndexed; return interface; diff --git a/src/gpu/gl/debug/GrShaderObj.h b/src/gpu/gl/debug/GrShaderObj.h index 0e1123713e..0b888fa0b2 100644 --- a/src/gpu/gl/debug/GrShaderObj.h +++ b/src/gpu/gl/debug/GrShaderObj.h @@ -17,7 +17,7 @@ class GrShaderObj : public GrFakeRefObj { GR_DEFINE_CREATOR(GrShaderObj); public: - GrShaderObj() + GrShaderObj() : GrFakeRefObj() , fType(GR_GL_VERTEX_SHADER) {} diff --git a/src/gpu/gl/debug/GrTextureObj.h b/src/gpu/gl/debug/GrTextureObj.h index 0443ab7c7a..7673cd118e 100644 --- a/src/gpu/gl/debug/GrTextureObj.h +++ b/src/gpu/gl/debug/GrTextureObj.h @@ -18,7 +18,7 @@ class GrTextureObj : public GrFBBindableObj { GR_DEFINE_CREATOR(GrTextureObj); public: - GrTextureObj() + GrTextureObj() : GrFBBindableObj() { } @@ -26,20 +26,20 @@ public: GrAlwaysAssert(0 == fTextureUnitReferees.count()); } - void setBound(GrTextureUnitObj *referee) { + void setBound(GrTextureUnitObj *referee) { fTextureUnitReferees.append(1, &referee); } - void resetBound(GrTextureUnitObj *referee) { + void resetBound(GrTextureUnitObj *referee) { int index = fTextureUnitReferees.find(referee); GrAlwaysAssert(0 <= index); fTextureUnitReferees.removeShuffle(index); } - bool getBound(GrTextureUnitObj *referee) const { + bool getBound(GrTextureUnitObj *referee) const { int index = fTextureUnitReferees.find(referee); return 0 <= index; } - bool getBound() const { + bool getBound() const { return 0 != fTextureUnitReferees.count(); } @@ -49,7 +49,7 @@ protected: private: // texture units that bind this texture (via "glBindTexture") - SkTDArray<GrTextureUnitObj *> fTextureUnitReferees; + SkTDArray<GrTextureUnitObj *> fTextureUnitReferees; typedef GrFBBindableObj INHERITED; }; diff --git a/src/gpu/gl/debug/GrTextureUnitObj.cpp b/src/gpu/gl/debug/GrTextureUnitObj.cpp index 05c149a1c0..b7c7b0ca57 100644 --- a/src/gpu/gl/debug/GrTextureUnitObj.cpp +++ b/src/gpu/gl/debug/GrTextureUnitObj.cpp @@ -9,7 +9,7 @@ #include "GrTextureUnitObj.h" #include "GrTextureObj.h" -void GrTextureUnitObj::setTexture(GrTextureObj *texture) { +void GrTextureUnitObj::setTexture(GrTextureObj *texture) { if (fTexture) { GrAlwaysAssert(fTexture->getBound(this)); @@ -19,7 +19,7 @@ void GrTextureUnitObj::setTexture(GrTextureObj *texture) { fTexture->unref(); } - fTexture = texture; + fTexture = texture; if (fTexture) { GrAlwaysAssert(!fTexture->getDeleted()); diff --git a/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp b/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp index 4735617c00..e0ecc382b3 100644 --- a/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp +++ b/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp @@ -23,7 +23,7 @@ static void* GetProcAddress(const char* name) { #define GET_PROC_SUFFIX(name, suffix) (interface->f ## name = ((GrGL ## name ## Proc) GetProcAddress("gl" #name #suffix))) const GrGLInterface* GrGLCreateNativeInterface() { - // The gl functions are not context-specific so we create one global + // The gl functions are not context-specific so we create one global // interface static SkAutoTUnref<GrGLInterface> glInterface; if (!glInterface.get()) { @@ -32,7 +32,7 @@ const GrGLInterface* GrGLCreateNativeInterface() { const char* verStr = (const char*) glGetString(GL_VERSION); GrGLVersion ver = GrGLGetVersionFromString(verStr); const char* extStr = (const char*) glGetString(GL_EXTENSIONS); - + interface->fBindingsExported = kDesktop_GrGLBinding; interface->fActiveTexture = glActiveTexture; interface->fAttachShader = glAttachShader; @@ -178,9 +178,9 @@ const GrGLInterface* GrGLCreateNativeInterface() { #else interface->fGetQueryObjecti64v = GET_PROC_SUFFIX(GetQueryObjecti64v, EXT); interface->fGetQueryObjectui64v = GET_PROC_SUFFIX(GetQueryObjectui64v, EXT); - #endif + #endif } - + if (ver >= GR_GL_VER(3,0) || GrGLHasExtensionFromString("GL_ARB_framebuffer_object", extStr)) { // ARB extension doesn't use the ARB suffix on the function names #if GL_VERSION_3_0 || GL_ARB_framebuffer_object diff --git a/src/gpu/gl/mac/SkNativeGLContext_mac.cpp b/src/gpu/gl/mac/SkNativeGLContext_mac.cpp index 2dcf8ae09c..f0cb2b6dd0 100644 --- a/src/gpu/gl/mac/SkNativeGLContext_mac.cpp +++ b/src/gpu/gl/mac/SkNativeGLContext_mac.cpp @@ -17,7 +17,7 @@ SkNativeGLContext::AutoContextRestore::~AutoContextRestore() { /////////////////////////////////////////////////////////////////////////////// -SkNativeGLContext::SkNativeGLContext() +SkNativeGLContext::SkNativeGLContext() : fContext(NULL) { } @@ -58,14 +58,14 @@ const GrGLInterface* SkNativeGLContext::createGLContext() { aglDestroyPixelFormat(format); aglSetCurrentContext(fContext); - + const GrGLInterface* interface = GrGLCreateNativeInterface(); if (NULL == interface) { SkDebugf("Context could not create GL interface.\n"); this->destroyGLContext(); return NULL; } - + return interface; } diff --git a/src/gpu/gl/mesa/SkMesaGLContext.cpp b/src/gpu/gl/mesa/SkMesaGLContext.cpp index b7d220cfb9..cac021c170 100644 --- a/src/gpu/gl/mesa/SkMesaGLContext.cpp +++ b/src/gpu/gl/mesa/SkMesaGLContext.cpp @@ -16,13 +16,13 @@ SkMesaGLContext::AutoContextRestore::AutoContextRestore() { if (NULL != (OSMesaContext)fOldContext) { OSMesaGetColorBuffer((OSMesaContext)fOldContext, &fOldWidth, &fOldHeight, - &fOldFormat, &fOldImage); + &fOldFormat, &fOldImage); } } SkMesaGLContext::AutoContextRestore::~AutoContextRestore() { if (NULL != (OSMesaContext)fOldContext) { - OSMesaMakeCurrent((OSMesaContext)fOldContext, fOldImage, + OSMesaMakeCurrent((OSMesaContext)fOldContext, fOldImage, fOldFormat, fOldWidth, fOldHeight); } } @@ -43,7 +43,7 @@ void SkMesaGLContext::destroyGLContext() { if (fImage) { sk_free(fImage); } - + if (fContext) { OSMesaDestroyContext((OSMesaContext)fContext); } @@ -72,18 +72,18 @@ const GrGLInterface* SkMesaGLContext::createGLContext() { this->destroyGLContext(); return NULL; } - + // Bind the buffer to the context and make it current - if (!OSMesaMakeCurrent((OSMesaContext)fContext, - fImage, - GR_GL_UNSIGNED_BYTE, - gBOGUS_SIZE, + if (!OSMesaMakeCurrent((OSMesaContext)fContext, + fImage, + GR_GL_UNSIGNED_BYTE, + gBOGUS_SIZE, gBOGUS_SIZE)) { SkDebugf("OSMesaMakeCurrent failed!\n"); this->destroyGLContext(); return NULL; } - + const GrGLInterface* interface = GrGLCreateMesaInterface(); if (!interface) { SkDebugf("Could not create GL interface!\n"); @@ -91,12 +91,12 @@ const GrGLInterface* SkMesaGLContext::createGLContext() { return NULL; } return interface; - + } void SkMesaGLContext::makeCurrent() const { if (fContext) { - if (!OSMesaMakeCurrent((OSMesaContext)fContext, fImage, + if (!OSMesaMakeCurrent((OSMesaContext)fContext, fImage, GR_GL_UNSIGNED_BYTE, gBOGUS_SIZE, gBOGUS_SIZE)) { SkDebugf("Could not make MESA context current."); } diff --git a/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp b/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp index 9edc42505f..04d35d1836 100644 --- a/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp +++ b/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp @@ -46,7 +46,7 @@ const GrGLInterface* GrGLCreateNativeInterface() { GrGLHasExtensionFromString("GL_ARB_imaging", extString) || GrGLHasExtensionFromString("GL_EXT_blend_color", extString)) { GR_GL_GET_PROC(BlendColor); - } + } GR_GL_GET_PROC(BufferData); GR_GL_GET_PROC(BufferSubData); diff --git a/src/gpu/gl/unix/SkNativeGLContext_unix.cpp b/src/gpu/gl/unix/SkNativeGLContext_unix.cpp index f9c582cd09..e6fae8ed7b 100644 --- a/src/gpu/gl/unix/SkNativeGLContext_unix.cpp +++ b/src/gpu/gl/unix/SkNativeGLContext_unix.cpp @@ -31,7 +31,7 @@ static int ctxErrorHandler(Display *dpy, XErrorEvent *ev) { return 0; } -SkNativeGLContext::SkNativeGLContext() +SkNativeGLContext::SkNativeGLContext() : fContext(NULL) , fDisplay(NULL) , fPixmap(0) @@ -112,7 +112,7 @@ const GrGLInterface* SkNativeGLContext::createGLContext() { if (best_fbc < 0 || (samp_buf && samples > best_num_samp)) best_fbc = i, best_num_samp = samples; - } + } XFree(vi); } @@ -201,12 +201,12 @@ const GrGLInterface* SkNativeGLContext::createGLContext() { fContext = glXCreateContext(fDisplay, vi, 0, True); #endif - } + } #ifdef GLX_1_3 else { //SkDebugf("Creating context.\n"); - PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB = + PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC) glXGetProcAddressARB((GrGLubyte*)"glXCreateContextAttribsARB"); int context_attribs[] = { GLX_CONTEXT_MAJOR_VERSION_ARB, 3, |