Add helper method to determine the current application horizontal size classes.
[chromium-blink-merge.git] / ppapi / thunk / ppb_image_data_api.h
blob5428ded250c4b5cff0e7e65720a1d5592011176e
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 base {
14 class SharedMemory;
15 } // namespace base
17 namespace ppapi {
18 namespace thunk {
20 class PPB_ImageData_API {
21 public:
22 virtual ~PPB_ImageData_API() {}
24 virtual PP_Bool Describe(PP_ImageDataDesc* desc) = 0;
25 virtual void* Map() = 0;
26 virtual void Unmap() = 0;
28 // Trusted inteface.
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
33 // one.
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;
59 } // namespace thunk
60 } // namespace ppapi
62 #endif // PPAPI_THUNK_PPB_IMAGE_DATA_API_H_