cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / ppapi / thunk / ppb_image_data_api.h
blobf916ede3c5e21a0af2bbacf41dde72b6e1055b45
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"
11 class SkCanvas;
13 namespace ppapi {
14 namespace thunk {
16 class PPB_ImageData_API {
17 public:
18 virtual ~PPB_ImageData_API() {}
20 virtual PP_Bool Describe(PP_ImageDataDesc* desc) = 0;
21 virtual void* Map() = 0;
22 virtual void Unmap() = 0;
24 // Trusted inteface.
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
28 // one.
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 // Signal that this image is a good candidate for reuse. Call this from APIs
47 // that receive ImageData resources of a fixed size and where the plugin will
48 // release its reference to the ImageData. If the current implementation
49 // supports image data reuse (only supported out-of-process) then the
50 // ImageData will be marked and potentially cached for re-use.
51 virtual void SetIsCandidateForReuse() = 0;
54 } // namespace thunk
55 } // namespace ppapi
57 #endif // PPAPI_THUNK_PPB_IMAGE_DATA_API_H_