| 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 #ifndef CONTENT_RENDERER_PEPPER_PPB_IMAGE_DATA_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PPB_IMAGE_DATA_IMPL_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_PPB_IMAGE_DATA_IMPL_H_ | 6 #define CONTENT_RENDERER_PEPPER_PPB_IMAGE_DATA_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include <stdint.h> |
| 9 |
| 10 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/shared_memory.h" | 12 #include "base/memory/shared_memory.h" |
| 11 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 12 #include "ppapi/c/ppb_image_data.h" | 14 #include "ppapi/c/ppb_image_data.h" |
| 13 #include "ppapi/shared_impl/ppb_image_data_shared.h" | 15 #include "ppapi/shared_impl/ppb_image_data_shared.h" |
| 14 #include "ppapi/shared_impl/resource.h" | 16 #include "ppapi/shared_impl/resource.h" |
| 15 #include "ppapi/thunk/ppb_image_data_api.h" | 17 #include "ppapi/thunk/ppb_image_data_api.h" |
| 16 #include "third_party/skia/include/core/SkCanvas.h" | 18 #include "third_party/skia/include/core/SkCanvas.h" |
| 17 | 19 |
| 18 class SkBitmap; | 20 class SkBitmap; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 uint32_t* byte_count) override; | 168 uint32_t* byte_count) override; |
| 167 SkCanvas* GetPlatformCanvas() override; | 169 SkCanvas* GetPlatformCanvas() override; |
| 168 SkCanvas* GetCanvas() override; | 170 SkCanvas* GetCanvas() override; |
| 169 const SkBitmap* GetMappedBitmap() const override; | 171 const SkBitmap* GetMappedBitmap() const override; |
| 170 | 172 |
| 171 private: | 173 private: |
| 172 scoped_ptr<base::SharedMemory> shared_memory_; | 174 scoped_ptr<base::SharedMemory> shared_memory_; |
| 173 // skia_bitmap_ is backed by shared_memory_. | 175 // skia_bitmap_ is backed by shared_memory_. |
| 174 SkBitmap skia_bitmap_; | 176 SkBitmap skia_bitmap_; |
| 175 scoped_ptr<SkCanvas> skia_canvas_; | 177 scoped_ptr<SkCanvas> skia_canvas_; |
| 176 uint32 map_count_; | 178 uint32_t map_count_; |
| 177 | 179 |
| 178 DISALLOW_COPY_AND_ASSIGN(ImageDataSimpleBackend); | 180 DISALLOW_COPY_AND_ASSIGN(ImageDataSimpleBackend); |
| 179 }; | 181 }; |
| 180 | 182 |
| 181 // Manages mapping an image resource if necessary. Use this to ensure the | 183 // Manages mapping an image resource if necessary. Use this to ensure the |
| 182 // image is mapped. The destructor will put the image back into the previous | 184 // image is mapped. The destructor will put the image back into the previous |
| 183 // state. You must check is_valid() to make sure the image was successfully | 185 // state. You must check is_valid() to make sure the image was successfully |
| 184 // mapped before using it. | 186 // mapped before using it. |
| 185 // | 187 // |
| 186 // Example: | 188 // Example: |
| (...skipping 26 matching lines...) Expand all Loading... |
| 213 PPB_ImageData_Impl* image_data_; | 215 PPB_ImageData_Impl* image_data_; |
| 214 bool is_valid_; | 216 bool is_valid_; |
| 215 bool needs_unmap_; | 217 bool needs_unmap_; |
| 216 | 218 |
| 217 DISALLOW_COPY_AND_ASSIGN(ImageDataAutoMapper); | 219 DISALLOW_COPY_AND_ASSIGN(ImageDataAutoMapper); |
| 218 }; | 220 }; |
| 219 | 221 |
| 220 } // namespace content | 222 } // namespace content |
| 221 | 223 |
| 222 #endif // CONTENT_RENDERER_PEPPER_PPB_IMAGE_DATA_IMPL_H_ | 224 #endif // CONTENT_RENDERER_PEPPER_PPB_IMAGE_DATA_IMPL_H_ |
| OLD | NEW |