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
3 // found in the LICENSE file.
5 #ifndef PPAPI_THUNK_PPB_IMAGE_DATA_API_H_
6 #define PPAPI_THUNK_PPB_IMAGE_DATA_API_H_
8 #include "ppapi/c/pp_bool.h"
9 #include "ppapi/c/ppb_image_data.h"
16 class PPB_ImageData_API
{
18 virtual ~PPB_ImageData_API() {}
20 virtual PP_Bool
Describe(PP_ImageDataDesc
* desc
) = 0;
21 virtual void* Map() = 0;
22 virtual void Unmap() = 0;
25 virtual int32_t GetSharedMemory(int* handle
, uint32_t* byte_count
) = 0;
27 // Get the platform-specific canvas that backs this ImageData, if there is
29 // The canvas will be NULL:
30 // * If the image is not mapped.
31 // * Within untrusted code (which does not have skia).
32 // * If the ImageData is not backed by a platform-specific image buffer.
33 // This will be the case for ImageDatas created for use in NaCl.
34 // For this last reason, you should prefer GetCanvas any time you don't need
35 // a platform-specific canvas (e.g., for use with platform-specific APIs).
36 // Anything that relies on having a PlatformCanvas will not work for ImageDat
37 // objects created from NaCl.
38 virtual SkCanvas
* GetPlatformCanvas() = 0;
40 // Get the canvas that backs this ImageData, if there is one.
41 // The canvas will be NULL:
42 // * If the image is not mapped.
43 // * Within untrusted code (which does not have skia).
44 virtual SkCanvas
* GetCanvas() = 0;
46 // Sets whether this image was used in a ReplaceContents call. If the
47 // current implementation supports image data recycling (only supported
48 // out-of-process then it will be marked for potential re-use.
49 virtual void SetUsedInReplaceContents() = 0;
55 #endif // PPAPI_THUNK_PPB_IMAGE_DATA_API_H_