13724e574a744491b7cfb8187ac865a70ef3d4528bsalomon 2dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com/* 3dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com * Copyright 2012 Google Inc. 4dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com * 5dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com * Use of this source code is governed by a BSD-style license that can be 6dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com * found in the LICENSE file. 7dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com */ 8dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com 9dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com#include "GrTextureUnitObj.h" 10dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com#include "GrTextureObj.h" 11dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com 12fbfcd5602128ec010c82cb733c9cdc0a3254f9f3rmistry@google.comvoid GrTextureUnitObj::setTexture(GrTextureObj *texture) { 13dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com 14dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com if (fTexture) { 15dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com GrAlwaysAssert(fTexture->getBound(this)); 16dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com fTexture->resetBound(this); 17dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com 18dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com GrAlwaysAssert(!fTexture->getDeleted()); 19dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com fTexture->unref(); 20dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com } 21dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com 22fbfcd5602128ec010c82cb733c9cdc0a3254f9f3rmistry@google.com fTexture = texture; 23dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com 24dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com if (fTexture) { 25dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com GrAlwaysAssert(!fTexture->getDeleted()); 26dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com fTexture->ref(); 27dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com 28dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com GrAlwaysAssert(!fTexture->getBound(this)); 29dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com fTexture->setBound(this); 30dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com } 31dd743fefad9764ad86d7f69deec32e9a3b5de47frobertphillips@google.com} 32