Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / ui / gfx / ozone / dri / dri_skbitmap.cc
index ec2ba58..e5490fd 100644 (file)
@@ -35,11 +35,12 @@ class DriSkPixelRef : public SkPixelRef {
                 void* pixels,
                 SkColorTable* color_table_,
                 size_t size,
+                size_t row_bites,
                 int fd,
                 uint32_t handle);
   virtual ~DriSkPixelRef();
 
-  virtual void* onLockPixels(SkColorTable** ct) OVERRIDE;
+  virtual bool onNewLockPixels(LockRec* rec) OVERRIDE;
   virtual void onUnlockPixels() OVERRIDE;
 
   SK_DECLARE_UNFLATTENABLE_OBJECT()
@@ -53,6 +54,9 @@ class DriSkPixelRef : public SkPixelRef {
   // Size of the allocated memory.
   size_t size_;
 
+  // Number of bytes between subsequent rows in the bitmap (stride).
+  size_t row_bytes_;
+
   // File descriptor to the graphics card used to allocate/deallocate the
   // memory.
   int fd_;
@@ -71,12 +75,14 @@ DriSkPixelRef::DriSkPixelRef(
     void* pixels,
     SkColorTable* color_table,
     size_t size,
+    size_t row_bytes,
     int fd,
     uint32_t handle)
   : SkPixelRef(info),
     pixels_(pixels),
     color_table_(color_table),
     size_(size),
+    row_bytes_(row_bytes),
     fd_(fd),
     handle_(handle) {
 }
@@ -86,9 +92,11 @@ DriSkPixelRef::~DriSkPixelRef() {
   DestroyDumbBuffer(fd_, handle_);
 }
 
-void* DriSkPixelRef::onLockPixels(SkColorTable** ct) {
-  *ct = color_table_;
-  return pixels_;
+bool DriSkPixelRef::onNewLockPixels(LockRec* rec) {
+  rec->fPixels = pixels_;
+  rec->fRowBytes = row_bytes_;
+  rec->fColorTable = color_table_;
+  return true;
 }
 
 void DriSkPixelRef::onUnlockPixels() {
@@ -173,6 +181,7 @@ bool DriAllocator::AllocatePixels(DriSkBitmap* bitmap,
       pixels,
       color_table,
       bitmap->getSize(),
+      bitmap->rowBytes(),
       bitmap->get_fd(),
       bitmap->get_handle()))->unref();
   bitmap->lockPixels();