Minor GrContext/GrInOrderDrawBuffer cleanup
https://codereview.chromium.org/18341007/ git-svn-id: http://skia.googlecode.com/svn/trunk@9898 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
34b73a2da1
commit
1267fbd952
@ -476,14 +476,6 @@ public:
|
||||
* Flags that affect flush() behavior.
|
||||
*/
|
||||
enum FlushBits {
|
||||
/**
|
||||
* A client may want Gr to bind a GrRenderTarget in the 3D API so that
|
||||
* it can be rendered to directly. However, Gr lazily sets state. Simply
|
||||
* calling setRenderTarget() followed by flush() without flags may not
|
||||
* bind the render target. This flag forces the context to bind the last
|
||||
* set render target in the 3D API.
|
||||
*/
|
||||
kForceCurrentRenderTarget_FlushBit = 0x1,
|
||||
/**
|
||||
* A client may reach a point where it has partially rendered a frame
|
||||
* through a GrContext that it knows the user will never see. This flag
|
||||
@ -903,8 +895,6 @@ private:
|
||||
|
||||
void setupDrawBuffer();
|
||||
|
||||
void flushDrawBuffer();
|
||||
|
||||
class AutoRestoreEffects;
|
||||
/// Sets the paint and returns the target to draw into. The paint can be NULL in which case the
|
||||
/// draw state is left unmodified.
|
||||
|
@ -1134,17 +1134,6 @@ void GrContext::flush(int flagsBitfield) {
|
||||
if (kDiscard_FlushBit & flagsBitfield) {
|
||||
fDrawBuffer->reset();
|
||||
} else {
|
||||
this->flushDrawBuffer();
|
||||
}
|
||||
// TODO: Remove this flag
|
||||
if (kForceCurrentRenderTarget_FlushBit & flagsBitfield) {
|
||||
fGpu->drawState()->setRenderTarget(this->getRenderTarget());
|
||||
fGpu->forceRenderTargetFlush();
|
||||
}
|
||||
}
|
||||
|
||||
void GrContext::flushDrawBuffer() {
|
||||
if (NULL != fDrawBuffer && !fDrawBuffer->isFlushing()) {
|
||||
fDrawBuffer->flush();
|
||||
}
|
||||
}
|
||||
@ -1560,7 +1549,7 @@ GrDrawTarget* GrContext::prepareToDraw(const GrPaint* paint,
|
||||
GrAssert(0 == fDrawState->numColorStages() && 0 == fDrawState->numCoverageStages());
|
||||
|
||||
if (kNo_BufferedDraw == buffered && kYes_BufferedDraw == fLastDrawWasBuffered) {
|
||||
this->flushDrawBuffer();
|
||||
fDrawBuffer->flush();
|
||||
fLastDrawWasBuffered = kNo_BufferedDraw;
|
||||
}
|
||||
ASSERT_OWNED_RESOURCE(fRenderTarget.get());
|
||||
|
@ -445,15 +445,18 @@ void GrInOrderDrawBuffer::reset() {
|
||||
fClipSet = true;
|
||||
}
|
||||
|
||||
bool GrInOrderDrawBuffer::flush() {
|
||||
void GrInOrderDrawBuffer::flush() {
|
||||
if (fFlushing) {
|
||||
return;
|
||||
}
|
||||
|
||||
GrAssert(kReserved_GeometrySrcType != this->getGeomSrc().fVertexSrc);
|
||||
GrAssert(kReserved_GeometrySrcType != this->getGeomSrc().fIndexSrc);
|
||||
|
||||
int numCmds = fCmds.count();
|
||||
if (0 == numCmds) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
GrAssert(!fFlushing);
|
||||
|
||||
GrAutoTRestore<bool> flushRestore(&fFlushing);
|
||||
fFlushing = true;
|
||||
@ -533,7 +536,6 @@ bool GrInOrderDrawBuffer::flush() {
|
||||
fDstGpu->setDrawState(prevDrawState);
|
||||
prevDrawState->unref();
|
||||
this->reset();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GrInOrderDrawBuffer::onCopySurface(GrSurface* dst,
|
||||
|
@ -63,12 +63,8 @@ public:
|
||||
* is destructive). This buffer must not have an active reserved vertex or index source. Any
|
||||
* reserved geometry on the target will be finalized because it's geometry source will be pushed
|
||||
* before flushing and popped afterwards.
|
||||
*
|
||||
* @return false if the playback trivially drew nothing because nothing was recorded.
|
||||
*/
|
||||
bool flush();
|
||||
|
||||
bool isFlushing() const { return fFlushing; }
|
||||
void flush();
|
||||
|
||||
// overrides from GrDrawTarget
|
||||
virtual bool geometryHints(int* vertexCount,
|
||||
|
Loading…
Reference in New Issue
Block a user