| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 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 SkSurface_DEFINED | 8 #ifndef SkSurface_DEFINED |
| 9 #define SkSurface_DEFINED | 9 #define SkSurface_DEFINED |
| 10 | 10 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 144 |
| 145 /** | 145 /** |
| 146 * Thought the caller could get a snapshot image explicitly, and draw that, | 146 * Thought the caller could get a snapshot image explicitly, and draw that, |
| 147 * it seems that directly drawing a surface into another canvas might be | 147 * it seems that directly drawing a surface into another canvas might be |
| 148 * a common pattern, and that we could possibly be more efficient, since | 148 * a common pattern, and that we could possibly be more efficient, since |
| 149 * we'd know that the "snapshot" need only live until we've handed it off | 149 * we'd know that the "snapshot" need only live until we've handed it off |
| 150 * to the canvas. | 150 * to the canvas. |
| 151 */ | 151 */ |
| 152 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*); | 152 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*); |
| 153 | 153 |
| 154 /** |
| 155 * If the surface has direct access to its pixels (i.e. they are in local |
| 156 * RAM) return the const-address of those pixels, and if not null, return |
| 157 * the ImageInfo and rowBytes. The returned address is only valid while |
| 158 * the surface object is in scope, and no API call is made on the surface |
| 159 * or its canvas. |
| 160 * |
| 161 * On failure, returns NULL and the info and rowBytes parameters are |
| 162 * ignored. |
| 163 */ |
| 164 const void* peekPixels(SkImageInfo* info, size_t* rowBytes); |
| 165 |
| 154 protected: | 166 protected: |
| 155 SkSurface(int width, int height); | 167 SkSurface(int width, int height); |
| 156 SkSurface(const SkImageInfo&); | 168 SkSurface(const SkImageInfo&); |
| 157 | 169 |
| 158 // called by subclass if their contents have changed | 170 // called by subclass if their contents have changed |
| 159 void dirtyGenerationID() { | 171 void dirtyGenerationID() { |
| 160 fGenerationID = 0; | 172 fGenerationID = 0; |
| 161 } | 173 } |
| 162 | 174 |
| 163 private: | 175 private: |
| 164 const int fWidth; | 176 const int fWidth; |
| 165 const int fHeight; | 177 const int fHeight; |
| 166 uint32_t fGenerationID; | 178 uint32_t fGenerationID; |
| 167 | 179 |
| 168 typedef SkRefCnt INHERITED; | 180 typedef SkRefCnt INHERITED; |
| 169 }; | 181 }; |
| 170 | 182 |
| 171 #endif | 183 #endif |
| OLD | NEW |