1 /* 2 // Copyright (c) 2014 Intel Corporation 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 */ 16 #include <hal_public.h> 17 #include <HwcTrace.h> 18 #include <common/PixelFormat.h> 19 20 namespace android { 21 namespace intel { 22 convertFormat(uint32_t grallocFormat,uint32_t & spriteFormat,int & bpp)23bool PixelFormat::convertFormat(uint32_t grallocFormat, uint32_t& spriteFormat, int& bpp) 24 { 25 switch (grallocFormat) { 26 case HAL_PIXEL_FORMAT_RGBA_8888: 27 spriteFormat = PLANE_PIXEL_FORMAT_RGBA8888; 28 bpp = 4; 29 break; 30 case HAL_PIXEL_FORMAT_RGBX_8888: 31 spriteFormat = PLANE_PIXEL_FORMAT_RGBX8888; 32 bpp = 4; 33 break; 34 case HAL_PIXEL_FORMAT_BGRX_8888: 35 spriteFormat = PLANE_PIXEL_FORMAT_BGRX8888; 36 bpp = 4; 37 break; 38 case HAL_PIXEL_FORMAT_BGRA_8888: 39 spriteFormat = PLANE_PIXEL_FORMAT_BGRA8888; 40 bpp = 4; 41 break; 42 case HAL_PIXEL_FORMAT_RGB_565: 43 spriteFormat = PLANE_PIXEL_FORMAT_BGRX565; 44 bpp = 2; 45 break; 46 default: 47 return false; 48 } 49 50 return true; 51 } 52 53 54 } // namespace intel 55 } // namespace android 56