180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* 380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Copyright 2012 Google Inc. 480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * 580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Use of this source code is governed by a BSD-style license that can be 680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * found in the LICENSE file. 780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */ 880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "GrTextureUnitObj.h" 1080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "GrTextureObj.h" 1180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 1280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruvoid GrTextureUnitObj::setTexture(GrTextureObj *texture) { 1380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 1480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (fTexture) { 1580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru GrAlwaysAssert(fTexture->getBound(this)); 1680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru fTexture->resetBound(this); 1780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 1880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru GrAlwaysAssert(!fTexture->getDeleted()); 1980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru fTexture->unref(); 2080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 2180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 2280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru fTexture = texture; 2380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 2480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (fTexture) { 2580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru GrAlwaysAssert(!fTexture->getDeleted()); 2680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru fTexture->ref(); 2780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 2880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru GrAlwaysAssert(!fTexture->getBound(this)); 2980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru fTexture->setBound(this); 3080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 3180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 32