Turn clipping back on in OSAA pass 1. Skip default cons on GrDrawState when saving off a GrDrawTarget's state.
Review URL: http://codereview.appspot.com/5553051/ git-svn-id: http://skia.googlecode.com/svn/trunk@3067 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
b90113dd3d
commit
46f7afb986
@ -769,13 +769,12 @@ void GrContext::setupOffscreenAAPass1(GrDrawTarget* target,
|
||||
GrRenderTarget* offRT = record->fOffscreen.texture()->asRenderTarget();
|
||||
GrAssert(NULL != offRT);
|
||||
|
||||
|
||||
GrDrawState* drawState = target->drawState();
|
||||
GrMatrix vm = drawState->getViewMatrix();
|
||||
drawState->reset();
|
||||
*drawState->viewMatrix() = vm;
|
||||
drawState->setRenderTarget(offRT);
|
||||
|
||||
|
||||
#if PREFER_MSAA_OFFSCREEN_AA
|
||||
drawState->enableState(GrDrawState::kHWAntialias_StateBit);
|
||||
#endif
|
||||
@ -796,6 +795,8 @@ void GrContext::setupOffscreenAAPass1(GrDrawTarget* target,
|
||||
GrIRect clear = SkIRect::MakeWH(record->fScale * w,
|
||||
record->fScale * h);
|
||||
target->setClip(GrClip(clear));
|
||||
drawState->enableState(GrDrawState::kClip_StateBit);
|
||||
|
||||
#if 0
|
||||
// visualize tile boundaries by setting edges of offscreen to white
|
||||
// and interior to tranparent. black.
|
||||
|
@ -49,7 +49,11 @@ struct GrDrawState {
|
||||
GrDrawState() {
|
||||
this->reset();
|
||||
}
|
||||
|
||||
|
||||
GrDrawState(const GrDrawState& state) {
|
||||
*this = state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets to the default state. Sampler states will not be modified.
|
||||
*/
|
||||
|
@ -512,11 +512,11 @@ const GrClip& GrDrawTarget::getClip() const {
|
||||
}
|
||||
|
||||
void GrDrawTarget::saveCurrentDrawState(SavedDrawState* state) const {
|
||||
state->fState = fCurrDrawState;
|
||||
state->fState.set(fCurrDrawState);
|
||||
}
|
||||
|
||||
void GrDrawTarget::restoreDrawState(const SavedDrawState& state) {
|
||||
fCurrDrawState = state.fState;
|
||||
fCurrDrawState = *state.fState.get();
|
||||
}
|
||||
|
||||
void GrDrawTarget::copyDrawState(const GrDrawTarget& srcTarget) {
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "GrTexture.h"
|
||||
|
||||
#include "SkXfermode.h"
|
||||
#include "SkTLazy.h"
|
||||
|
||||
class GrTexture;
|
||||
class GrClipIterator;
|
||||
@ -139,7 +140,7 @@ public:
|
||||
*/
|
||||
struct SavedDrawState {
|
||||
private:
|
||||
GrDrawState fState;
|
||||
SkTLazy<GrDrawState> fState;
|
||||
friend class GrDrawTarget;
|
||||
};
|
||||
|
||||
@ -926,10 +927,12 @@ protected:
|
||||
|
||||
// Helpers for GrDrawTarget subclasses that won't have private access to
|
||||
// SavedDrawState but need to peek at the state values.
|
||||
static GrDrawState& accessSavedDrawState(SavedDrawState& sds)
|
||||
{ return sds.fState; }
|
||||
static const GrDrawState& accessSavedDrawState(const SavedDrawState& sds)
|
||||
{ return sds.fState; }
|
||||
static GrDrawState& accessSavedDrawState(SavedDrawState& sds) {
|
||||
return *sds.fState.get();
|
||||
}
|
||||
static const GrDrawState& accessSavedDrawState(const SavedDrawState& sds){
|
||||
return *sds.fState.get();
|
||||
}
|
||||
|
||||
// implemented by subclass to allocate space for reserved geom
|
||||
virtual bool onReserveVertexSpace(GrVertexLayout vertexLayout,
|
||||
|
Loading…
Reference in New Issue
Block a user