Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkCanvas_DEFINED | 8 #ifndef SkCanvas_DEFINED |
| 9 #define SkCanvas_DEFINED | 9 #define SkCanvas_DEFINED |
| 10 | 10 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 | 119 |
| 120 /** | 120 /** |
| 121 * Return the GPU context of the device that is associated with the canvas. | 121 * Return the GPU context of the device that is associated with the canvas. |
| 122 * For a canvas with non-GPU device, NULL is returned. | 122 * For a canvas with non-GPU device, NULL is returned. |
| 123 */ | 123 */ |
| 124 GrContext* getGrContext(); | 124 GrContext* getGrContext(); |
| 125 | 125 |
| 126 /////////////////////////////////////////////////////////////////////////// | 126 /////////////////////////////////////////////////////////////////////////// |
| 127 | 127 |
| 128 /** | 128 /** |
| 129 * If the canvas has direct access to its pixels (i.e. they are in local | |
| 130 * RAM) return the const-address of those pixels, and if not null, return | |
|
hal.canary
2014/02/12 15:11:02
And if the canvas has a concept of "pixels" at all
reed1
2014/02/12 17:24:10
Done.
| |
| 131 * the ImageInfo and rowBytes. The returned address is only valid while | |
| 132 * the canvas object is in scope and unchanged. Any API calls made on the | |
| 133 * canvas can invalidate this address. | |
| 134 * | |
| 135 * On failure, returns NULL and the info and rowBytes parameters are | |
| 136 * ignored. | |
| 137 */ | |
| 138 const void* peekPixels(SkImageInfo* info, size_t* rowBytes); | |
| 139 | |
| 140 /** | |
| 129 * This enum can be used with read/writePixels to perform a pixel ops to or | 141 * This enum can be used with read/writePixels to perform a pixel ops to or |
| 130 * from an 8888 config other than Skia's native config (SkPMColor). There | 142 * from an 8888 config other than Skia's native config (SkPMColor). There |
| 131 * are three byte orders supported: native, BGRA, and RGBA. Each has a | 143 * are three byte orders supported: native, BGRA, and RGBA. Each has a |
| 132 * premultiplied and unpremultiplied variant. | 144 * premultiplied and unpremultiplied variant. |
| 133 * | 145 * |
| 134 * Components of a 8888 pixel can be packed/unpacked from a 32bit word using | 146 * Components of a 8888 pixel can be packed/unpacked from a 32bit word using |
| 135 * either byte offsets or shift values. Byte offsets are endian-invariant | 147 * either byte offsets or shift values. Byte offsets are endian-invariant |
| 136 * while shifts are not. BGRA and RGBA configs are defined by byte | 148 * while shifts are not. BGRA and RGBA configs are defined by byte |
| 137 * orderings. The native config is defined by shift values (SK_A32_SHIFT, | 149 * orderings. The native config is defined by shift values (SK_A32_SHIFT, |
| 138 * ..., SK_B32_SHIFT). | 150 * ..., SK_B32_SHIFT). |
| (...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1012 intptr_t fStorage[32]; | 1024 intptr_t fStorage[32]; |
| 1013 class SkDrawIter* fImpl; // this points at fStorage | 1025 class SkDrawIter* fImpl; // this points at fStorage |
| 1014 SkPaint fDefaultPaint; | 1026 SkPaint fDefaultPaint; |
| 1015 bool fDone; | 1027 bool fDone; |
| 1016 }; | 1028 }; |
| 1017 | 1029 |
| 1018 protected: | 1030 protected: |
| 1019 // default impl defers to getDevice()->newSurface(info) | 1031 // default impl defers to getDevice()->newSurface(info) |
| 1020 virtual SkSurface* onNewSurface(const SkImageInfo&); | 1032 virtual SkSurface* onNewSurface(const SkImageInfo&); |
| 1021 | 1033 |
| 1034 // default impl defers to its device | |
| 1035 virtual const void* onPeekPixels(SkImageInfo*, size_t* rowBytes); | |
| 1036 | |
| 1022 // Returns the canvas to be used by DrawIter. Default implementation | 1037 // Returns the canvas to be used by DrawIter. Default implementation |
| 1023 // returns this. Subclasses that encapsulate an indirect canvas may | 1038 // returns this. Subclasses that encapsulate an indirect canvas may |
| 1024 // need to overload this method. The impl must keep track of this, as it | 1039 // need to overload this method. The impl must keep track of this, as it |
| 1025 // is not released or deleted by the caller. | 1040 // is not released or deleted by the caller. |
| 1026 virtual SkCanvas* canvasForDrawIter(); | 1041 virtual SkCanvas* canvasForDrawIter(); |
| 1027 | 1042 |
| 1028 // Clip rectangle bounds. Called internally by saveLayer. | 1043 // Clip rectangle bounds. Called internally by saveLayer. |
| 1029 // returns false if the entire rectangle is entirely clipped out | 1044 // returns false if the entire rectangle is entirely clipped out |
| 1030 // If non-NULL, The imageFilter parameter will be used to expand the clip | 1045 // If non-NULL, The imageFilter parameter will be used to expand the clip |
| 1031 // and offscreen bounds for any margin required by the filter DAG. | 1046 // and offscreen bounds for any margin required by the filter DAG. |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1200 fCanvas->endCommentGroup(); | 1215 fCanvas->endCommentGroup(); |
| 1201 } | 1216 } |
| 1202 } | 1217 } |
| 1203 | 1218 |
| 1204 private: | 1219 private: |
| 1205 SkCanvas* fCanvas; | 1220 SkCanvas* fCanvas; |
| 1206 }; | 1221 }; |
| 1207 #define SkAutoCommentBlock(...) SK_REQUIRE_LOCAL_VAR(SkAutoCommentBlock) | 1222 #define SkAutoCommentBlock(...) SK_REQUIRE_LOCAL_VAR(SkAutoCommentBlock) |
| 1208 | 1223 |
| 1209 #endif | 1224 #endif |
| OLD | NEW |