| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 GrGpu_DEFINED | 8 #ifndef GrGpu_DEFINED |
| 9 #define GrGpu_DEFINED | 9 #define GrGpu_DEFINED |
| 10 | 10 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 * a GrSurface. If this returns false then GrGpu could not deduce an interme
diate draw | 203 * a GrSurface. If this returns false then GrGpu could not deduce an interme
diate draw |
| 204 * that would allow a successful transfer of the src pixels to the dst. The
passed width, | 204 * that would allow a successful transfer of the src pixels to the dst. The
passed width, |
| 205 * height, and rowBytes, must be non-zero and already reflect clipping to th
e dst bounds. | 205 * height, and rowBytes, must be non-zero and already reflect clipping to th
e dst bounds. |
| 206 */ | 206 */ |
| 207 bool getWritePixelsInfo(GrSurface* dstSurface, int width, int height, size_t
rowBytes, | 207 bool getWritePixelsInfo(GrSurface* dstSurface, int width, int height, size_t
rowBytes, |
| 208 GrPixelConfig srcConfig, DrawPreference*, WritePixel
TempDrawInfo*); | 208 GrPixelConfig srcConfig, DrawPreference*, WritePixel
TempDrawInfo*); |
| 209 | 209 |
| 210 /** | 210 /** |
| 211 * Reads a rectangle of pixels from a render target. | 211 * Reads a rectangle of pixels from a render target. |
| 212 * | 212 * |
| 213 * @param renderTarget the render target to read from. NULL means the | 213 * @param surface The surface to read from |
| 214 * current render target. | |
| 215 * @param left left edge of the rectangle to read (inclusive) | 214 * @param left left edge of the rectangle to read (inclusive) |
| 216 * @param top top edge of the rectangle to read (inclusive) | 215 * @param top top edge of the rectangle to read (inclusive) |
| 217 * @param width width of rectangle to read in pixels. | 216 * @param width width of rectangle to read in pixels. |
| 218 * @param height height of rectangle to read in pixels. | 217 * @param height height of rectangle to read in pixels. |
| 219 * @param config the pixel config of the destination buffer | 218 * @param config the pixel config of the destination buffer |
| 220 * @param buffer memory to read the rectangle into. | 219 * @param buffer memory to read the rectangle into. |
| 221 * @param rowBytes the number of bytes between consecutive rows. Zero | 220 * @param rowBytes the number of bytes between consecutive rows. Zero |
| 222 * means rows are tightly packed. | 221 * means rows are tightly packed. |
| 223 * @param invertY buffer should be populated bottom-to-top as opposed | 222 * @param invertY buffer should be populated bottom-to-top as opposed |
| 224 * to top-to-bottom (skia's usual order) | 223 * to top-to-bottom (skia's usual order) |
| 225 * | 224 * |
| 226 * @return true if the read succeeded, false if not. The read can fail | 225 * @return true if the read succeeded, false if not. The read can fail |
| 227 * because of a unsupported pixel config or because no render | 226 * because of a unsupported pixel config or because no render |
| 228 * target is currently set. | 227 * target is currently set. |
| 229 */ | 228 */ |
| 230 bool readPixels(GrRenderTarget* renderTarget, | 229 bool readPixels(GrSurface* surface, |
| 231 int left, int top, int width, int height, | 230 int left, int top, int width, int height, |
| 232 GrPixelConfig config, void* buffer, size_t rowBytes); | 231 GrPixelConfig config, void* buffer, size_t rowBytes); |
| 233 | 232 |
| 234 /** | 233 /** |
| 235 * Updates the pixels in a rectangle of a texture. | 234 * Updates the pixels in a rectangle of a surface. |
| 236 * | 235 * |
| 236 * @param surface The surface to write to. |
| 237 * @param left left edge of the rectangle to write (inclusive) | 237 * @param left left edge of the rectangle to write (inclusive) |
| 238 * @param top top edge of the rectangle to write (inclusive) | 238 * @param top top edge of the rectangle to write (inclusive) |
| 239 * @param width width of rectangle to write in pixels. | 239 * @param width width of rectangle to write in pixels. |
| 240 * @param height height of rectangle to write in pixels. | 240 * @param height height of rectangle to write in pixels. |
| 241 * @param config the pixel config of the source buffer | 241 * @param config the pixel config of the source buffer |
| 242 * @param buffer memory to read pixels from | 242 * @param buffer memory to read pixels from |
| 243 * @param rowBytes number of bytes between consecutive rows. Zero | 243 * @param rowBytes number of bytes between consecutive rows. Zero |
| 244 * means rows are tightly packed. | 244 * means rows are tightly packed. |
| 245 */ | 245 */ |
| 246 bool writeTexturePixels(GrTexture* texture, | 246 bool writePixels(GrSurface* surface, |
| 247 int left, int top, int width, int height, | 247 int left, int top, int width, int height, |
| 248 GrPixelConfig config, const void* buffer, | 248 GrPixelConfig config, const void* buffer, |
| 249 size_t rowBytes); | 249 size_t rowBytes); |
| 250 | 250 |
| 251 /** | 251 /** |
| 252 * Clear the passed in render target. Ignores the draw state and clip. Clear
s the whole thing if | 252 * Clear the passed in render target. Ignores the draw state and clip. Clear
s the whole thing if |
| 253 * rect is NULL, otherwise just the rect. If canIgnoreRect is set then the e
ntire render target | 253 * rect is NULL, otherwise just the rect. If canIgnoreRect is set then the e
ntire render target |
| 254 * can be optionally cleared. | 254 * can be optionally cleared. |
| 255 */ | 255 */ |
| 256 void clear(const SkIRect* rect, GrColor color, bool canIgnoreRect,GrRenderTa
rget* renderTarget); | 256 void clear(const SkIRect* rect, GrColor color, bool canIgnoreRect,GrRenderTa
rget* renderTarget); |
| 257 | 257 |
| 258 | 258 |
| 259 void clearStencilClip(const SkIRect& rect, bool insideClip, GrRenderTarget*
renderTarget); | 259 void clearStencilClip(const SkIRect& rect, bool insideClip, GrRenderTarget*
renderTarget); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 // overridden by backend-specific derived class to perform the draw call. | 461 // overridden by backend-specific derived class to perform the draw call. |
| 462 virtual void onDraw(const DrawArgs&, const GrNonInstancedVertices&) = 0; | 462 virtual void onDraw(const DrawArgs&, const GrNonInstancedVertices&) = 0; |
| 463 | 463 |
| 464 virtual bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int r
eadHeight, | 464 virtual bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int r
eadHeight, |
| 465 size_t rowBytes, GrPixelConfig readConfig,
DrawPreference*, | 465 size_t rowBytes, GrPixelConfig readConfig,
DrawPreference*, |
| 466 ReadPixelTempDrawInfo*) = 0; | 466 ReadPixelTempDrawInfo*) = 0; |
| 467 virtual bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int heig
ht, size_t rowBytes, | 467 virtual bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int heig
ht, size_t rowBytes, |
| 468 GrPixelConfig srcConfig, DrawPreference*, | 468 GrPixelConfig srcConfig, DrawPreference*, |
| 469 WritePixelTempDrawInfo*) = 0; | 469 WritePixelTempDrawInfo*) = 0; |
| 470 | 470 |
| 471 virtual bool onReadPixels(GrRenderTarget* target, | 471 // overridden by backend-specific derived class to perform the surface read |
| 472 virtual bool onReadPixels(GrSurface*, |
| 472 int left, int top, int width, int height, | 473 int left, int top, int width, int height, |
| 473 GrPixelConfig, | 474 GrPixelConfig, |
| 474 void* buffer, | 475 void* buffer, |
| 475 size_t rowBytes) = 0; | 476 size_t rowBytes) = 0; |
| 476 | 477 |
| 477 // overridden by backend-specific derived class to perform the texture updat
e | 478 // overridden by backend-specific derived class to perform the surface write |
| 478 virtual bool onWriteTexturePixels(GrTexture* texture, | 479 virtual bool onWritePixels(GrSurface*, |
| 479 int left, int top, int width, int height, | 480 int left, int top, int width, int height, |
| 480 GrPixelConfig config, const void* buffer, | 481 GrPixelConfig config, const void* buffer, |
| 481 size_t rowBytes) = 0; | 482 size_t rowBytes) = 0; |
| 482 | 483 |
| 483 // overridden by backend-specific derived class to perform the resolve | 484 // overridden by backend-specific derived class to perform the resolve |
| 484 virtual void onResolveRenderTarget(GrRenderTarget* target) = 0; | 485 virtual void onResolveRenderTarget(GrRenderTarget* target) = 0; |
| 485 | 486 |
| 486 // width and height may be larger than rt (if underlying API allows it). | 487 // width and height may be larger than rt (if underlying API allows it). |
| 487 // Should attach the SB to the RT. Returns false if compatible sb could | 488 // Should attach the SB to the RT. Returns false if compatible sb could |
| 488 // not be created. | 489 // not be created. |
| 489 virtual bool createStencilAttachmentForRenderTarget(GrRenderTarget*, int wid
th, int height) = 0; | 490 virtual bool createStencilAttachmentForRenderTarget(GrRenderTarget*, int wid
th, int height) = 0; |
| 490 | 491 |
| 491 // attaches an existing SB to an existing RT. | 492 // attaches an existing SB to an existing RT. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 516 GrTraceMarkerSet fActiveT
raceMarkers; | 517 GrTraceMarkerSet fActiveT
raceMarkers; |
| 517 GrTraceMarkerSet fStoredT
raceMarkers; | 518 GrTraceMarkerSet fStoredT
raceMarkers; |
| 518 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. | 519 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
| 519 GrContext* fContext
; | 520 GrContext* fContext
; |
| 520 | 521 |
| 521 friend class GrPathRendering; | 522 friend class GrPathRendering; |
| 522 typedef SkRefCnt INHERITED; | 523 typedef SkRefCnt INHERITED; |
| 523 }; | 524 }; |
| 524 | 525 |
| 525 #endif | 526 #endif |
| OLD | NEW |