| 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 | |
| 166 protected: | 154 protected: |
| 167 SkSurface(int width, int height); | 155 SkSurface(int width, int height); |
| 168 SkSurface(const SkImageInfo&); | 156 SkSurface(const SkImageInfo&); |
| 169 | 157 |
| 170 // called by subclass if their contents have changed | 158 // called by subclass if their contents have changed |
| 171 void dirtyGenerationID() { | 159 void dirtyGenerationID() { |
| 172 fGenerationID = 0; | 160 fGenerationID = 0; |
| 173 } | 161 } |
| 174 | 162 |
| 175 private: | 163 private: |
| 176 const int fWidth; | 164 const int fWidth; |
| 177 const int fHeight; | 165 const int fHeight; |
| 178 uint32_t fGenerationID; | 166 uint32_t fGenerationID; |
| 179 | 167 |
| 180 typedef SkRefCnt INHERITED; | 168 typedef SkRefCnt INHERITED; |
| 181 }; | 169 }; |
| 182 | 170 |
| 183 #endif | 171 #endif |
| OLD | NEW |