michael@0: /* michael@0: ** michael@0: ** Copyright 2012 The Android Open Source Project michael@0: ** michael@0: ** Licensed under the Apache License Version 2.0(the "License"); michael@0: ** you may not use this file except in compliance with the License. michael@0: ** You may obtain a copy of the License at michael@0: ** michael@0: ** http://www.apache.org/licenses/LICENSE-2.0 michael@0: ** michael@0: ** Unless required by applicable law or agreed to in writing software michael@0: ** distributed under the License is distributed on an "AS IS" BASIS michael@0: ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied. michael@0: ** See the License for the specific language governing permissions and michael@0: ** limitations under the License. michael@0: */ michael@0: michael@0: #include michael@0: michael@0: #include michael@0: michael@0: #include "GraphicBufferAlloc.h" michael@0: michael@0: // ---------------------------------------------------------------------------- michael@0: namespace android { michael@0: // ---------------------------------------------------------------------------- michael@0: michael@0: GraphicBufferAlloc::GraphicBufferAlloc() { michael@0: } michael@0: michael@0: GraphicBufferAlloc::~GraphicBufferAlloc() { michael@0: } michael@0: michael@0: sp GraphicBufferAlloc::createGraphicBuffer(uint32_t w, uint32_t h, michael@0: PixelFormat format, uint32_t usage, status_t* error) { michael@0: sp graphicBuffer(new GraphicBuffer(w, h, format, usage)); michael@0: status_t err = graphicBuffer->initCheck(); michael@0: *error = err; michael@0: if (err != 0 || graphicBuffer->handle == 0) { michael@0: if (err == NO_MEMORY) { michael@0: GraphicBuffer::dumpAllocationsToSystemLog(); michael@0: } michael@0: ALOGE("GraphicBufferAlloc::createGraphicBuffer(w=%d, h=%d) " michael@0: "failed (%s), handle=%p", michael@0: w, h, strerror(-err), graphicBuffer->handle); michael@0: return 0; michael@0: } michael@0: return graphicBuffer; michael@0: } michael@0: michael@0: // ---------------------------------------------------------------------------- michael@0: }; // namespace android michael@0: // ----------------------------------------------------------------------------