2016-03-31 01:56:19 +00:00
|
|
|
|
2012-04-05 14:40:53 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2012 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "GrTextureUnitObj.h"
|
|
|
|
#include "GrTextureObj.h"
|
|
|
|
|
2012-08-23 18:09:54 +00:00
|
|
|
void GrTextureUnitObj::setTexture(GrTextureObj *texture) {
|
2012-04-05 14:40:53 +00:00
|
|
|
|
|
|
|
if (fTexture) {
|
|
|
|
GrAlwaysAssert(fTexture->getBound(this));
|
|
|
|
fTexture->resetBound(this);
|
|
|
|
|
|
|
|
GrAlwaysAssert(!fTexture->getDeleted());
|
|
|
|
fTexture->unref();
|
|
|
|
}
|
|
|
|
|
2012-08-23 18:09:54 +00:00
|
|
|
fTexture = texture;
|
2012-04-05 14:40:53 +00:00
|
|
|
|
|
|
|
if (fTexture) {
|
|
|
|
GrAlwaysAssert(!fTexture->getDeleted());
|
|
|
|
fTexture->ref();
|
|
|
|
|
|
|
|
GrAlwaysAssert(!fTexture->getBound(this));
|
|
|
|
fTexture->setBound(this);
|
|
|
|
}
|
|
|
|
}
|