int SurfaceTextureClient::dispatchSetBuffersGeometry(va_list args) {
    int w = va_arg(args, int);
    int h = va_arg(args, int);
    int f = va_arg(args, int);
    int err = setBuffersDimensions(w, h);
    if (err != 0) {
        return err;
    }
    return setBuffersFormat(f);
}
示例#2
0
int SurfaceTextureClient::dispatchSetBuffersDimensions(va_list args) {
    int w = va_arg(args, int);
    int h = va_arg(args, int);
    int err = setBuffersDimensions(w, h);
    if (err != 0) {
        return err;
    }
    LOGV("Resetting the Buffer size to 0 after SET DIMENSIONS");
    return performQcomOperation(NATIVE_WINDOW_SET_BUFFERS_SIZE, 0, 0, 0);
}
int GonkNativeWindowClient::dispatchSetBuffersGeometry(va_list args) {
    int w = va_arg(args, int);
    int h = va_arg(args, int);
    int f = va_arg(args, int);
    int err = setBuffersDimensions(w, h);
    if (err != 0) {
        return err;
    }
    return setBuffersFormat(f);
}
示例#4
0
int SurfaceTextureClient::dispatchSetBuffersGeometry(va_list args) {
    int w = va_arg(args, int);
    int h = va_arg(args, int);
    int f = va_arg(args, int);
    int err = setBuffersDimensions(w, h);
    if (err != 0) {
        return err;
    }
    LOGV("Resetting the Buffer size to 0 after SET GEOMETRY");
    err = performQcomOperation(NATIVE_WINDOW_SET_BUFFERS_SIZE, 0, 0, 0);
    if (err != 0) {
        return err;
    }
    return setBuffersFormat(f);
}
int SurfaceTextureClient::dispatchSetBuffersDimensions(va_list args) {
    int w = va_arg(args, int);
    int h = va_arg(args, int);
    return setBuffersDimensions(w, h);
}
示例#6
0
    void SurfaceUtils::showTestFrame(const frame_t *f, int idx) {
        ANativeWindowBuffer *buf;
        void *ptr;
        const Rect rect(LAYER_WIDTH, LAYER_HEIGHT);

        // set buffer size
        setBuffersDimensions(LAYER_WIDTH, LAYER_HEIGHT);

        // set usage software write-able and hardware texture bind-able
        setUsage(GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_HW_TEXTURE);

        // set scaling to match window display size
        setScalingMode(NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW);

        // set transform
        switch(idx) {
            case 0:
        //        LOGD("layer no rotation");
                break;
            case 1:
        //        LOGD("layer %d: ROT_90", idx);
                setBuffersTransform(HAL_TRANSFORM_ROT_90);
                break;
            case 2:
        //        LOGD("layer %d: ROT_180", idx);
                setBuffersTransform(HAL_TRANSFORM_ROT_180);
                break;
            default:
        //        LOGD("layer %d: ROT_270", idx);
                setBuffersTransform(HAL_TRANSFORM_ROT_270);
        }

        // get the buffer handle
        mWindow->dequeueBuffer(mWindow, &buf);
        // get the buffer addr
        // LOGD("lock GraphicBuffer: %d", idx_frame);
        GraphicBufferMapper::getInstance().lock(buf->handle,
                GRALLOC_USAGE_SW_WRITE_OFTEN,
                rect,
                &ptr);
        /*
        LOGD("(w,h,s,f)=(%d,%d,%d,%d)",
                buf->width, buf->height, buf->stride,
                buf->format);
         */
        // fill buffer
        //LOGD("load bitmap");
        SkBitmap bitmap;
        ssize_t bpr = buf->stride * BPP;
        bitmap.setConfig(convertPixelFormat(buf->format), buf->width, buf->height, bpr);
        SkImageDecoder::DecodeFile(f->name, &bitmap,
                SkBitmap::kARGB_8888_Config,
                SkImageDecoder::kDecodePixels_Mode, NULL);
        int w = bitmap.width();
        int h = bitmap.height();
        for (int j = 0; j < h; j++) {
            for (int i = 0; i < w; i++) {
                memcpy((uint8_t *)ptr + (j * bpr) + (i * BPP),
                        bitmap.getAddr32(i, j),
                        sizeof(uint32_t));
            }
        }

        // set transparent/translucent region
        setAlpha((uint8_t *)ptr, &f->blk[0], buf, false);
        setAlpha((uint8_t *)ptr, &f->blk[1], buf, true);
        //LOGD("end fill buffer");

        // call unlock after finishing changes against the buffer
        //LOGD("unlock GraphicBuffer");
        GraphicBufferMapper::getInstance().unlock(buf->handle);
        // transfer the ownership back to the server
        mWindow->queueBuffer(mWindow, buf);
    }
int GonkNativeWindowClient::dispatchSetBuffersDimensions(va_list args) {
    int w = va_arg(args, int);
    int h = va_arg(args, int);
    return setBuffersDimensions(w, h);
}