| OLD | NEW |
| 1 | |
| 2 /* | 1 /* |
| 3 * Copyright 2010 Google Inc. | 2 * Copyright 2010 Google Inc. |
| 4 * | 3 * |
| 5 * 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 |
| 6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 7 */ | 6 */ |
| 8 | 7 |
| 9 | |
| 10 #ifndef GrContext_DEFINED | 8 #ifndef GrContext_DEFINED |
| 11 #define GrContext_DEFINED | 9 #define GrContext_DEFINED |
| 12 | 10 |
| 13 #include "GrColor.h" | 11 #include "GrColor.h" |
| 14 #include "GrAARectRenderer.h" | 12 #include "GrAARectRenderer.h" |
| 15 #include "GrClipData.h" | 13 #include "GrClipData.h" |
| 16 #include "SkMatrix.h" | 14 #include "SkMatrix.h" |
| 17 #include "GrPaint.h" | 15 #include "GrPaint.h" |
| 18 #include "GrPathRendererChain.h" | 16 #include "GrPathRendererChain.h" |
| 17 #include "GrPoint.h" |
| 19 #include "GrRenderTarget.h" | 18 #include "GrRenderTarget.h" |
| 20 #include "GrRefCnt.h" | 19 #include "GrRefCnt.h" |
| 21 #include "GrTexture.h" | 20 #include "GrTexture.h" |
| 22 | 21 |
| 23 class GrAutoScratchTexture; | 22 class GrAutoScratchTexture; |
| 24 class GrDrawState; | 23 class GrDrawState; |
| 25 class GrDrawTarget; | 24 class GrDrawTarget; |
| 26 class GrEffect; | 25 class GrEffect; |
| 27 class GrFontCache; | 26 class GrFontCache; |
| 28 class GrGpu; | 27 class GrGpu; |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 /////////////////////////////////////////////////////////////////////////// | 362 /////////////////////////////////////////////////////////////////////////// |
| 364 // Draws | 363 // Draws |
| 365 | 364 |
| 366 /** | 365 /** |
| 367 * Clear the entire or rect of the render target, ignoring any clips. | 366 * Clear the entire or rect of the render target, ignoring any clips. |
| 368 * @param rect the rect to clear or the whole thing if rect is NULL. | 367 * @param rect the rect to clear or the whole thing if rect is NULL. |
| 369 * @param color the color to clear to. | 368 * @param color the color to clear to. |
| 370 * @param target if non-NULL, the render target to clear otherwise clear | 369 * @param target if non-NULL, the render target to clear otherwise clear |
| 371 * the current render target | 370 * the current render target |
| 372 */ | 371 */ |
| 373 void clear(const GrIRect* rect, GrColor color, | 372 void clear(const SkIRect* rect, GrColor color, |
| 374 GrRenderTarget* target = NULL); | 373 GrRenderTarget* target = NULL); |
| 375 | 374 |
| 376 /** | 375 /** |
| 377 * Draw everywhere (respecting the clip) with the paint. | 376 * Draw everywhere (respecting the clip) with the paint. |
| 378 */ | 377 */ |
| 379 void drawPaint(const GrPaint& paint); | 378 void drawPaint(const GrPaint& paint); |
| 380 | 379 |
| 381 /** | 380 /** |
| 382 * Draw the rect using a paint. | 381 * Draw the rect using a paint. |
| 383 * @param paint describes how to color pixels. | 382 * @param paint describes how to color pixels. |
| 384 * @param strokeWidth If strokeWidth < 0, then the rect is filled, else | 383 * @param strokeWidth If strokeWidth < 0, then the rect is filled, else |
| 385 * the rect is mitered stroked based on strokeWidth. If | 384 * the rect is mitered stroked based on strokeWidth. If |
| 386 * strokeWidth == 0, then the stroke is always a single | 385 * strokeWidth == 0, then the stroke is always a single |
| 387 * pixel thick. | 386 * pixel thick. |
| 388 * @param matrix Optional matrix applied to the rect. Applied before | 387 * @param matrix Optional matrix applied to the rect. Applied before |
| 389 * context's matrix or the paint's matrix. | 388 * context's matrix or the paint's matrix. |
| 390 * The rects coords are used to access the paint (through texture matrix) | 389 * The rects coords are used to access the paint (through texture matrix) |
| 391 */ | 390 */ |
| 392 void drawRect(const GrPaint& paint, | 391 void drawRect(const GrPaint& paint, |
| 393 const GrRect&, | 392 const SkRect&, |
| 394 SkScalar strokeWidth = -1, | 393 SkScalar strokeWidth = -1, |
| 395 const SkMatrix* matrix = NULL); | 394 const SkMatrix* matrix = NULL); |
| 396 | 395 |
| 397 /** | 396 /** |
| 398 * Maps a rect of local coordinates onto the a rect of destination | 397 * Maps a rect of local coordinates onto the a rect of destination |
| 399 * coordinates. Each rect can optionally be transformed. The localRect | 398 * coordinates. Each rect can optionally be transformed. The localRect |
| 400 * is stretched over the dstRect. The dstRect is transformed by the | 399 * is stretched over the dstRect. The dstRect is transformed by the |
| 401 * context's matrix. Additional optional matrices for both rects can be | 400 * context's matrix. Additional optional matrices for both rects can be |
| 402 * provided by parameters. | 401 * provided by parameters. |
| 403 * | 402 * |
| 404 * @param paint describes how to color pixels. | 403 * @param paint describes how to color pixels. |
| 405 * @param dstRect the destination rect to draw. | 404 * @param dstRect the destination rect to draw. |
| 406 * @param localRect rect of local coordinates to be mapped onto dstRect | 405 * @param localRect rect of local coordinates to be mapped onto dstRect |
| 407 * @param dstMatrix Optional matrix to transform dstRect. Applied before
context's matrix. | 406 * @param dstMatrix Optional matrix to transform dstRect. Applied before
context's matrix. |
| 408 * @param localMatrix Optional matrix to transform localRect. | 407 * @param localMatrix Optional matrix to transform localRect. |
| 409 */ | 408 */ |
| 410 void drawRectToRect(const GrPaint& paint, | 409 void drawRectToRect(const GrPaint& paint, |
| 411 const GrRect& dstRect, | 410 const SkRect& dstRect, |
| 412 const GrRect& localRect, | 411 const SkRect& localRect, |
| 413 const SkMatrix* dstMatrix = NULL, | 412 const SkMatrix* dstMatrix = NULL, |
| 414 const SkMatrix* localMatrix = NULL); | 413 const SkMatrix* localMatrix = NULL); |
| 415 | 414 |
| 416 /** | 415 /** |
| 417 * Draw a roundrect using a paint. | 416 * Draw a roundrect using a paint. |
| 418 * | 417 * |
| 419 * @param paint describes how to color pixels. | 418 * @param paint describes how to color pixels. |
| 420 * @param rrect the roundrect to draw | 419 * @param rrect the roundrect to draw |
| 421 * @param stroke the stroke information (width, join, cap) | 420 * @param stroke the stroke information (width, join, cap) |
| 422 */ | 421 */ |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 int indexCount); | 458 int indexCount); |
| 460 | 459 |
| 461 /** | 460 /** |
| 462 * Draws an oval. | 461 * Draws an oval. |
| 463 * | 462 * |
| 464 * @param paint describes how to color pixels. | 463 * @param paint describes how to color pixels. |
| 465 * @param oval the bounding rect of the oval. | 464 * @param oval the bounding rect of the oval. |
| 466 * @param stroke the stroke information (width, style) | 465 * @param stroke the stroke information (width, style) |
| 467 */ | 466 */ |
| 468 void drawOval(const GrPaint& paint, | 467 void drawOval(const GrPaint& paint, |
| 469 const GrRect& oval, | 468 const SkRect& oval, |
| 470 const SkStrokeRec& stroke); | 469 const SkStrokeRec& stroke); |
| 471 | 470 |
| 472 /////////////////////////////////////////////////////////////////////////// | 471 /////////////////////////////////////////////////////////////////////////// |
| 473 // Misc. | 472 // Misc. |
| 474 | 473 |
| 475 /** | 474 /** |
| 476 * Flags that affect flush() behavior. | 475 * Flags that affect flush() behavior. |
| 477 */ | 476 */ |
| 478 enum FlushBits { | 477 enum FlushBits { |
| 479 /** | 478 /** |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 | 763 |
| 765 AutoClip(GrContext* context, InitialClip initialState) | 764 AutoClip(GrContext* context, InitialClip initialState) |
| 766 : fContext(context) { | 765 : fContext(context) { |
| 767 GrAssert(kWideOpen_InitialClip == initialState); | 766 GrAssert(kWideOpen_InitialClip == initialState); |
| 768 fNewClipData.fClipStack = &fNewClipStack; | 767 fNewClipData.fClipStack = &fNewClipStack; |
| 769 | 768 |
| 770 fOldClip = context->getClip(); | 769 fOldClip = context->getClip(); |
| 771 context->setClip(&fNewClipData); | 770 context->setClip(&fNewClipData); |
| 772 } | 771 } |
| 773 | 772 |
| 774 AutoClip(GrContext* context, const GrRect& newClipRect) | 773 AutoClip(GrContext* context, const SkRect& newClipRect) |
| 775 : fContext(context) | 774 : fContext(context) |
| 776 , fNewClipStack(newClipRect) { | 775 , fNewClipStack(newClipRect) { |
| 777 fNewClipData.fClipStack = &fNewClipStack; | 776 fNewClipData.fClipStack = &fNewClipStack; |
| 778 | 777 |
| 779 fOldClip = fContext->getClip(); | 778 fOldClip = fContext->getClip(); |
| 780 fContext->setClip(&fNewClipData); | 779 fContext->setClip(&fNewClipData); |
| 781 } | 780 } |
| 782 | 781 |
| 783 ~AutoClip() { | 782 ~AutoClip() { |
| 784 if (NULL != fContext) { | 783 if (NULL != fContext) { |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 } | 1001 } |
| 1003 | 1002 |
| 1004 GrTexture* texture() { return fTexture; } | 1003 GrTexture* texture() { return fTexture; } |
| 1005 | 1004 |
| 1006 private: | 1005 private: |
| 1007 GrContext* fContext; | 1006 GrContext* fContext; |
| 1008 GrTexture* fTexture; | 1007 GrTexture* fTexture; |
| 1009 }; | 1008 }; |
| 1010 | 1009 |
| 1011 #endif | 1010 #endif |
| OLD | NEW |