summaryrefslogtreecommitdiffstats
path: root/libs/ui/GraphicBuffer.cpp
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2013-05-04 18:07:43 -0700
committerEino-Ville Talvala <etalvala@google.com>2013-05-06 17:24:05 -0700
commitc43946b931de5dafd28f49963f9af78e05390b26 (patch)
tree032140ddaaa02cacfac012f042526c7facd57c88 /libs/ui/GraphicBuffer.cpp
parentcc8f8ad33d4f8f55ff30e1600cc59c7cf5113c8a (diff)
downloadframeworks_native-c43946b931de5dafd28f49963f9af78e05390b26.zip
frameworks_native-c43946b931de5dafd28f49963f9af78e05390b26.tar.gz
frameworks_native-c43946b931de5dafd28f49963f9af78e05390b26.tar.bz2
Add support for HAL_PIXEL_FORMAT_YCbCr_420_888
- Add fields to CpuConsumer::LockedBuffer for new information - New lock methods for GraphicBuffer and GraphicBufferMapper for the format Bug: 8734880 Change-Id: If31f82c62d64b6942cf4cc6e5715585c03273f12
Diffstat (limited to 'libs/ui/GraphicBuffer.cpp')
-rw-r--r--libs/ui/GraphicBuffer.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/libs/ui/GraphicBuffer.cpp b/libs/ui/GraphicBuffer.cpp
index b9cab85..580788d 100644
--- a/libs/ui/GraphicBuffer.cpp
+++ b/libs/ui/GraphicBuffer.cpp
@@ -174,6 +174,27 @@ status_t GraphicBuffer::lock(uint32_t usage, const Rect& rect, void** vaddr)
return res;
}
+status_t GraphicBuffer::lockYCbCr(uint32_t usage, android_ycbcr *ycbcr)
+{
+ const Rect lockBounds(width, height);
+ status_t res = lockYCbCr(usage, lockBounds, ycbcr);
+ return res;
+}
+
+status_t GraphicBuffer::lockYCbCr(uint32_t usage, const Rect& rect,
+ android_ycbcr *ycbcr)
+{
+ if (rect.left < 0 || rect.right > this->width ||
+ rect.top < 0 || rect.bottom > this->height) {
+ ALOGE("locking pixels (%d,%d,%d,%d) outside of buffer (w=%d, h=%d)",
+ rect.left, rect.top, rect.right, rect.bottom,
+ this->width, this->height);
+ return BAD_VALUE;
+ }
+ status_t res = getBufferMapper().lockYCbCr(handle, usage, rect, ycbcr);
+ return res;
+}
+
status_t GraphicBuffer::unlock()
{
status_t res = getBufferMapper().unlock(handle);