14a49301eSmrg/************************************************************************** 24a49301eSmrg * 3af69d88dSmrg * Copyright 2007 VMware, Inc. 44a49301eSmrg * All Rights Reserved. 54a49301eSmrg * 64a49301eSmrg * Permission is hereby granted, free of charge, to any person obtaining a 74a49301eSmrg * copy of this software and associated documentation files (the 84a49301eSmrg * "Software"), to deal in the Software without restriction, including 94a49301eSmrg * without limitation the rights to use, copy, modify, merge, publish, 104a49301eSmrg * distribute, sub license, and/or sell copies of the Software, and to 114a49301eSmrg * permit persons to whom the Software is furnished to do so, subject to 124a49301eSmrg * the following conditions: 134a49301eSmrg * 144a49301eSmrg * The above copyright notice and this permission notice (including the 154a49301eSmrg * next paragraph) shall be included in all copies or substantial portions 164a49301eSmrg * of the Software. 174a49301eSmrg * 184a49301eSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 194a49301eSmrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 204a49301eSmrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21af69d88dSmrg * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 224a49301eSmrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 234a49301eSmrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 244a49301eSmrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 254a49301eSmrg * 264a49301eSmrg **************************************************************************/ 274a49301eSmrg 284a49301eSmrg#ifndef P_TILE_H 294a49301eSmrg#define P_TILE_H 304a49301eSmrg 314a49301eSmrg#include "pipe/p_compiler.h" 323464ebd5Sriastradh#include "pipe/p_format.h" 333464ebd5Sriastradh#include "pipe/p_state.h" 344a49301eSmrg 353464ebd5Sriastradhstruct pipe_context; 364a49301eSmrgstruct pipe_transfer; 374a49301eSmrg 384a49301eSmrg/** 394a49301eSmrg * Clip tile against transfer dims. 403464ebd5Sriastradh * 413464ebd5Sriastradh * XXX: this only clips width and height! 423464ebd5Sriastradh * 434a49301eSmrg * \return TRUE if tile is totally clipped, FALSE otherwise 444a49301eSmrg */ 4501e04c3fSmrgstatic inline boolean 463464ebd5Sriastradhu_clip_tile(uint x, uint y, uint *w, uint *h, const struct pipe_box *box) 474a49301eSmrg{ 48af69d88dSmrg if ((int) x >= box->width) 494a49301eSmrg return TRUE; 50af69d88dSmrg if ((int) y >= box->height) 514a49301eSmrg return TRUE; 52af69d88dSmrg if ((int) (x + *w) > box->width) 533464ebd5Sriastradh *w = box->width - x; 54af69d88dSmrg if ((int) (y + *h) > box->height) 553464ebd5Sriastradh *h = box->height - y; 564a49301eSmrg return FALSE; 574a49301eSmrg} 584a49301eSmrg 594a49301eSmrg#ifdef __cplusplus 604a49301eSmrgextern "C" { 614a49301eSmrg#endif 624a49301eSmrg 634a49301eSmrgvoid 64af69d88dSmrgpipe_get_tile_raw(struct pipe_transfer *pt, 65af69d88dSmrg const void *src, 664a49301eSmrg uint x, uint y, uint w, uint h, 674a49301eSmrg void *p, int dst_stride); 684a49301eSmrg 694a49301eSmrgvoid 70af69d88dSmrgpipe_put_tile_raw(struct pipe_transfer *pt, 71af69d88dSmrg void *dst, 724a49301eSmrg uint x, uint y, uint w, uint h, 734a49301eSmrg const void *p, int src_stride); 744a49301eSmrg 754a49301eSmrg 764a49301eSmrgvoid 77af69d88dSmrgpipe_get_tile_rgba(struct pipe_transfer *pt, 78af69d88dSmrg const void *src, 794a49301eSmrg uint x, uint y, uint w, uint h, 807ec681f3Smrg enum pipe_format format, 817ec681f3Smrg void *dst); 823464ebd5Sriastradh 833464ebd5Sriastradhvoid 84af69d88dSmrgpipe_put_tile_rgba(struct pipe_transfer *pt, 85af69d88dSmrg void *dst, 864a49301eSmrg uint x, uint y, uint w, uint h, 877ec681f3Smrg enum pipe_format format, 887ec681f3Smrg const void *src); 894a49301eSmrg 904a49301eSmrg#ifdef __cplusplus 914a49301eSmrg} 924a49301eSmrg#endif 934a49301eSmrg 944a49301eSmrg#endif 95