| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "content/renderer/pepper/ppb_image_data_impl.h" | 5 #include "content/renderer/pepper/ppb_image_data_impl.h" | 
| 6 | 6 | 
| 7 #include <algorithm> | 7 #include <algorithm> | 
| 8 #include <limits> | 8 #include <limits> | 
| 9 | 9 | 
| 10 #include "base/logging.h" | 10 #include "base/logging.h" | 
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 248 | 248 | 
| 249 ImageDataSimpleBackend::~ImageDataSimpleBackend() { | 249 ImageDataSimpleBackend::~ImageDataSimpleBackend() { | 
| 250 } | 250 } | 
| 251 | 251 | 
| 252 bool ImageDataSimpleBackend::Init(PPB_ImageData_Impl* impl, | 252 bool ImageDataSimpleBackend::Init(PPB_ImageData_Impl* impl, | 
| 253                                   PP_ImageDataFormat format, | 253                                   PP_ImageDataFormat format, | 
| 254                                   int width, int height, | 254                                   int width, int height, | 
| 255                                   bool init_to_zero) { | 255                                   bool init_to_zero) { | 
| 256   skia_bitmap_.setConfig(SkBitmap::kARGB_8888_Config, | 256   skia_bitmap_.setConfig(SkBitmap::kARGB_8888_Config, | 
| 257                          impl->width(), impl->height()); | 257                          impl->width(), impl->height()); | 
| 258   PepperPluginDelegateImpl* plugin_delegate = | 258   PepperHelperImpl* plugin_delegate = ResourceHelper::GetHelper(impl); | 
| 259       ResourceHelper::GetPluginDelegate(impl); |  | 
| 260   if (!plugin_delegate) | 259   if (!plugin_delegate) | 
| 261     return false; | 260     return false; | 
| 262   shared_memory_.reset(RenderThread::Get()->HostAllocateSharedMemoryBuffer( | 261   shared_memory_.reset(RenderThread::Get()->HostAllocateSharedMemoryBuffer( | 
| 263       skia_bitmap_.getSize()).release()); | 262       skia_bitmap_.getSize()).release()); | 
| 264   return !!shared_memory_.get(); | 263   return !!shared_memory_.get(); | 
| 265 } | 264 } | 
| 266 | 265 | 
| 267 bool ImageDataSimpleBackend::IsMapped() const { | 266 bool ImageDataSimpleBackend::IsMapped() const { | 
| 268   return map_count_ > 0; | 267   return map_count_ > 0; | 
| 269 } | 268 } | 
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 313   return skia_canvas_.get(); | 312   return skia_canvas_.get(); | 
| 314 } | 313 } | 
| 315 | 314 | 
| 316 const SkBitmap* ImageDataSimpleBackend::GetMappedBitmap() const { | 315 const SkBitmap* ImageDataSimpleBackend::GetMappedBitmap() const { | 
| 317   if (!IsMapped()) | 316   if (!IsMapped()) | 
| 318     return NULL; | 317     return NULL; | 
| 319   return &skia_bitmap_; | 318   return &skia_bitmap_; | 
| 320 } | 319 } | 
| 321 | 320 | 
| 322 }  // namespace content | 321 }  // namespace content | 
| OLD | NEW | 
|---|