Home | History | Annotate | Download | only in tangier
      1 /*
      2 // Copyright(c)2014 IntelCorporation
      3 //
      4 // LicensedundertheApacheLicense,Version2.0(the"License");
      5 // youmaynotusethisfileexceptincompliancewiththeLicense.
      6 // YoumayobtainacopyoftheLicenseat
      7 //
      8 // http://www.apache.org/licenses/LICENSE-2.0
      9 //
     10 // Unlessrequiredbyapplicablelaworagreedtoinwriting,software
     11 // distributedundertheLicenseisdistributedonan"ASIS"BASIS,
     12 // WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.
     13 // SeetheLicenseforthespecificlanguagegoverningpermissionsand
     14 // limitationsundertheLicense.
     15 */
     16 #include <HwcTrace.h>
     17 #include <tangier/TngGrallocBuffer.h>
     18 
     19 namespace android {
     20 namespace intel {
     21 
     22 TngGrallocBuffer::TngGrallocBuffer(buffer_handle_t handle)
     23     :GrallocBufferBase(handle)
     24 {
     25     initBuffer(handle);
     26 }
     27 
     28 TngGrallocBuffer::~TngGrallocBuffer()
     29 {
     30 }
     31 
     32 void TngGrallocBuffer::resetBuffer(buffer_handle_t handle)
     33 {
     34     GrallocBufferBase::resetBuffer(handle);
     35     initBuffer(handle);
     36 }
     37 
     38 void TngGrallocBuffer::initBuffer(buffer_handle_t handle)
     39 {
     40     TngIMGGrallocBuffer *grallocHandle = (TngIMGGrallocBuffer *)handle;
     41 
     42     CTRACE();
     43 
     44     if (!grallocHandle) {
     45         ETRACE("gralloc handle is null");
     46         return;
     47     }
     48 
     49     mFormat = grallocHandle->iFormat;
     50     mWidth = grallocHandle->iWidth;
     51     mHeight = grallocHandle->iHeight;
     52     mUsage = grallocHandle->usage;
     53     mKey = grallocHandle->ui64Stamp;
     54     mBpp = grallocHandle->uiBpp;
     55 
     56     // stride can only be initialized after format is set
     57     initStride();
     58 }
     59 
     60 
     61 }
     62 }
     63