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"
20 class PPB_ImageData_API
{
22 virtual ~PPB_ImageData_API() {}
24 virtual PP_Bool
Describe(PP_ImageDataDesc
* desc
) = 0;
25 virtual void* Map() = 0;
26 virtual void Unmap() = 0;
29 virtual int32_t GetSharedMemory(base::SharedMemory
** shm
,
30 uint32_t* byte_count
) = 0;
32 // Get the platform-specific canvas that backs this ImageData, if there is
34 // The canvas will be NULL:
35 // * If the image is not mapped.
36 // * Within untrusted code (which does not have skia).
37 // * If the ImageData is not backed by a platform-specific image buffer.
38 // This will be the case for ImageDatas created for use in NaCl.
39 // For this last reason, you should prefer GetCanvas any time you don't need
40 // a platform-specific canvas (e.g., for use with platform-specific APIs).
41 // Anything that relies on having a PlatformCanvas will not work for ImageDat
42 // objects created from NaCl.
43 virtual SkCanvas
* GetPlatformCanvas() = 0;
45 // Get the canvas that backs this ImageData, if there is one.
46 // The canvas will be NULL:
47 // * If the image is not mapped.
48 // * Within untrusted code (which does not have skia).
49 virtual SkCanvas
* GetCanvas() = 0;
51 // Signal that this image is a good candidate for reuse. Call this from APIs
52 // that receive ImageData resources of a fixed size and where the plugin will
53 // release its reference to the ImageData. If the current implementation
54 // supports image data reuse (only supported out-of-process) then the
55 // ImageData will be marked and potentially cached for re-use.
56 virtual void SetIsCandidateForReuse() = 0;
62 #endif // PPAPI_THUNK_PPB_IMAGE_DATA_API_H_