gfx/skia/trunk/src/gpu/gl/GrGLTexture.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /*
     2  * Copyright 2011 Google Inc.
     3  *
     4  * Use of this source code is governed by a BSD-style license that can be
     5  * found in the LICENSE file.
     6  */
     8 #include "GrGLTexture.h"
     9 #include "GrGpuGL.h"
    11 #define GPUGL static_cast<GrGpuGL*>(getGpu())
    13 #define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X)
    15 void GrGLTexture::init(GrGpuGL* gpu,
    16                        const Desc& textureDesc,
    17                        const GrGLRenderTarget::Desc* rtDesc) {
    19     SkASSERT(0 != textureDesc.fTextureID);
    21     fTexParams.invalidate();
    22     fTexParamsTimestamp = GrGpu::kExpiredTimestamp;
    23     fTexIDObj.reset(SkNEW_ARGS(GrGLTexID, (GPUGL->glInterface(),
    24                                            textureDesc.fTextureID,
    25                                            textureDesc.fIsWrapped)));
    27     if (NULL != rtDesc) {
    28         GrGLIRect vp;
    29         vp.fLeft   = 0;
    30         vp.fWidth  = textureDesc.fWidth;
    31         vp.fBottom = 0;
    32         vp.fHeight = textureDesc.fHeight;
    34         fRenderTarget.reset(SkNEW_ARGS(GrGLRenderTarget, (gpu, *rtDesc, vp, fTexIDObj, this)));
    35     }
    36 }
    38 GrGLTexture::GrGLTexture(GrGpuGL* gpu,
    39                          const Desc& textureDesc)
    40     : INHERITED(gpu, textureDesc.fIsWrapped, textureDesc) {
    41     this->init(gpu, textureDesc, NULL);
    42 }
    44 GrGLTexture::GrGLTexture(GrGpuGL* gpu,
    45                          const Desc& textureDesc,
    46                          const GrGLRenderTarget::Desc& rtDesc)
    47     : INHERITED(gpu, textureDesc.fIsWrapped, textureDesc) {
    48     this->init(gpu, textureDesc, &rtDesc);
    49 }
    51 void GrGLTexture::onRelease() {
    52     GPUGL->notifyTextureDelete(this);
    53     fTexIDObj.reset(NULL);
    54     INHERITED::onRelease();
    55 }
    57 void GrGLTexture::onAbandon() {
    58     if (NULL != fTexIDObj.get()) {
    59         fTexIDObj->abandon();
    60         fTexIDObj.reset(NULL);
    61     }
    63     INHERITED::onAbandon();
    64 }
    66 GrBackendObject GrGLTexture::getTextureHandle() const {
    67     return static_cast<GrBackendObject>(this->textureID());
    68 }

mercurial