OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 GrContext_DEFINED | 8 #ifndef GrContext_DEFINED |
9 #define GrContext_DEFINED | 9 #define GrContext_DEFINED |
10 | 10 |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 * @return true if the write succeeded, false if not. The write can fail bec
ause of an | 276 * @return true if the write succeeded, false if not. The write can fail bec
ause of an |
277 * unsupported combination of surface and src configs. | 277 * unsupported combination of surface and src configs. |
278 */ | 278 */ |
279 bool writeSurfacePixels(GrSurface* surface, | 279 bool writeSurfacePixels(GrSurface* surface, |
280 int left, int top, int width, int height, | 280 int left, int top, int width, int height, |
281 GrPixelConfig config, const void* buffer, | 281 GrPixelConfig config, const void* buffer, |
282 size_t rowBytes, | 282 size_t rowBytes, |
283 uint32_t pixelOpsFlags = 0); | 283 uint32_t pixelOpsFlags = 0); |
284 | 284 |
285 /** | 285 /** |
| 286 * These flags can be used with the color-space converting write pixels funct
ion below. |
| 287 */ |
| 288 enum ColorSpaceOpsFlags { |
| 289 /** Gamma curve of the destination needs to be done manually. */ |
| 290 kManualDstGamma_ColorSpaceOpsFlag = 0x1, |
| 291 }; |
| 292 |
| 293 /** |
| 294 * Writes a rectangle of pixels to a surface, performing color space conversi
on. |
| 295 * @param surface the surface to write to. |
| 296 * @param left left edge of the rectangle to write (inclusive) |
| 297 * @param top top edge of the rectangle to write (inclusive) |
| 298 * @param width width of rectangle to write in pixels. |
| 299 * @param height height of rectangle to write in pixels. |
| 300 * @param config the pixel config of the source buffer |
| 301 * @param srcColorSpace color space of the source buffer |
| 302 * @param dstColorSpace color space to conver to |
| 303 * @param buffer memory to read pixels from |
| 304 * @param rowBytes number of bytes between consecutive rows. Zero |
| 305 * means rows are tightly packed. |
| 306 * @param colorSpaceOpsFlags see ColorSpaceOpsFlags enum above. |
| 307 * @return true if the write succeeded, false if not. The write can fail beca
use of an |
| 308 * unsupported combination of surface and src configs. |
| 309 */ |
| 310 bool writeSurfacePixelsWithColorSpace(GrSurface* surface, |
| 311 int left, int top, int width, int heig
ht, |
| 312 GrPixelConfig srcConfig, |
| 313 const SkColorSpace* srcColorSpace, |
| 314 const SkColorSpace* dstColorSpace, |
| 315 const void* buffer, size_t rowBytes, |
| 316 uint32_t colorSpaceOpsFlags = 0); |
| 317 |
| 318 /** |
286 * Copies a rectangle of texels from src to dst. | 319 * Copies a rectangle of texels from src to dst. |
287 * bounds. | 320 * bounds. |
288 * @param dst the surface to copy to. | 321 * @param dst the surface to copy to. |
289 * @param src the surface to copy from. | 322 * @param src the surface to copy from. |
290 * @param srcRect the rectangle of the src that should be copied. | 323 * @param srcRect the rectangle of the src that should be copied. |
291 * @param dstPoint the translation applied when writing the srcRect's p
ixels to the dst. | 324 * @param dstPoint the translation applied when writing the srcRect's p
ixels to the dst. |
292 */ | 325 */ |
293 bool copySurface(GrSurface* dst, | 326 bool copySurface(GrSurface* dst, |
294 GrSurface* src, | 327 GrSurface* src, |
295 const SkIRect& srcRect, | 328 const SkIRect& srcRect, |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 SkAutoTUnref<const GrCaps> fCaps; | 511 SkAutoTUnref<const GrCaps> fCaps; |
479 uint32_t fContextUniqueID; | 512 uint32_t fContextUniqueID; |
480 | 513 |
481 friend class GrContext; | 514 friend class GrContext; |
482 friend class SkImage; | 515 friend class SkImage; |
483 | 516 |
484 typedef SkRefCnt INHERITED; | 517 typedef SkRefCnt INHERITED; |
485 }; | 518 }; |
486 | 519 |
487 #endif | 520 #endif |
OLD | NEW |