Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: src/gpu/GrDrawTarget.h

Issue 19449002: Replace all instances of GrRect with SkRect. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrDrawState.h ('k') | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef GrDrawTarget_DEFINED 10 #ifndef GrDrawTarget_DEFINED
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 * 336 *
337 * @param rect the rect to draw 337 * @param rect the rect to draw
338 * @param matrix optional matrix applied to rect (before viewMatrix) 338 * @param matrix optional matrix applied to rect (before viewMatrix)
339 * @param localRect optional rect that specifies local coords to map onto 339 * @param localRect optional rect that specifies local coords to map onto
340 * rect. If NULL then rect serves as the local coords. 340 * rect. If NULL then rect serves as the local coords.
341 * @param localMatrix optional matrix applied to localRect. If 341 * @param localMatrix optional matrix applied to localRect. If
342 * srcRect is non-NULL and srcMatrix is non-NULL 342 * srcRect is non-NULL and srcMatrix is non-NULL
343 * then srcRect will be transformed by srcMatrix. 343 * then srcRect will be transformed by srcMatrix.
344 * srcMatrix can be NULL when no srcMatrix is desired. 344 * srcMatrix can be NULL when no srcMatrix is desired.
345 */ 345 */
346 void drawRect(const GrRect& rect, 346 void drawRect(const SkRect& rect,
347 const SkMatrix* matrix, 347 const SkMatrix* matrix,
348 const GrRect* localRect, 348 const SkRect* localRect,
349 const SkMatrix* localMatrix) { 349 const SkMatrix* localMatrix) {
350 AutoGeometryPush agp(this); 350 AutoGeometryPush agp(this);
351 this->onDrawRect(rect, matrix, localRect, localMatrix); 351 this->onDrawRect(rect, matrix, localRect, localMatrix);
352 } 352 }
353 353
354 /** 354 /**
355 * Helper for drawRect when the caller doesn't need separate local rects or matrices. 355 * Helper for drawRect when the caller doesn't need separate local rects or matrices.
356 */ 356 */
357 void drawSimpleRect(const GrRect& rect, const SkMatrix* matrix = NULL) { 357 void drawSimpleRect(const SkRect& rect, const SkMatrix* matrix = NULL) {
358 this->drawRect(rect, matrix, NULL, NULL); 358 this->drawRect(rect, matrix, NULL, NULL);
359 } 359 }
360 void drawSimpleRect(const GrIRect& irect, const SkMatrix* matrix = NULL) { 360 void drawSimpleRect(const SkIRect& irect, const SkMatrix* matrix = NULL) {
361 SkRect rect = SkRect::MakeFromIRect(irect); 361 SkRect rect = SkRect::MakeFromIRect(irect);
362 this->drawRect(rect, matrix, NULL, NULL); 362 this->drawRect(rect, matrix, NULL, NULL);
363 } 363 }
364 364
365 /** 365 /**
366 * This call is used to draw multiple instances of some geometry with a 366 * This call is used to draw multiple instances of some geometry with a
367 * given number of vertices (V) and indices (I) per-instance. The indices in 367 * given number of vertices (V) and indices (I) per-instance. The indices in
368 * the index source must have the form i[k+I] == i[k] + V. Also, all indices 368 * the index source must have the form i[k+I] == i[k] + V. Also, all indices
369 * i[kI] ... i[(k+1)I-1] must be elements of the range kV ... (k+1)V-1. As a 369 * i[kI] ... i[(k+1)I-1] must be elements of the range kV ... (k+1)V-1. As a
370 * concrete example, the following index buffer for drawing a series of 370 * concrete example, the following index buffer for drawing a series of
(...skipping 25 matching lines...) Expand all
396 int instanceCount, 396 int instanceCount,
397 int verticesPerInstance, 397 int verticesPerInstance,
398 int indicesPerInstance, 398 int indicesPerInstance,
399 const SkRect* devBounds = NULL); 399 const SkRect* devBounds = NULL);
400 400
401 /** 401 /**
402 * Clear the current render target if one isn't passed in. Ignores the 402 * Clear the current render target if one isn't passed in. Ignores the
403 * clip and all other draw state (blend mode, stages, etc). Clears the 403 * clip and all other draw state (blend mode, stages, etc). Clears the
404 * whole thing if rect is NULL, otherwise just the rect. 404 * whole thing if rect is NULL, otherwise just the rect.
405 */ 405 */
406 virtual void clear(const GrIRect* rect, 406 virtual void clear(const SkIRect* rect,
407 GrColor color, 407 GrColor color,
408 GrRenderTarget* renderTarget = NULL) = 0; 408 GrRenderTarget* renderTarget = NULL) = 0;
409 409
410 /** 410 /**
411 * Copies a pixel rectangle from one surface to another. This call may final ize 411 * Copies a pixel rectangle from one surface to another. This call may final ize
412 * reserved vertex/index data (as though a draw call was made). The src pixe ls 412 * reserved vertex/index data (as though a draw call was made). The src pixe ls
413 * copied are specified by srcRect. They are copied to a rect of the same 413 * copied are specified by srcRect. They are copied to a rect of the same
414 * size in dst with top left at dstPoint. If the src rect is clipped by the 414 * size in dst with top left at dstPoint. If the src rect is clipped by the
415 * src bounds then pixel values in the dst rect corresponding to area clipp ed 415 * src bounds then pixel values in the dst rect corresponding to area clipp ed
416 * by the src rect are not overwritten. This method can fail and return fals e 416 * by the src rect are not overwritten. This method can fail and return fals e
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 virtual void geometrySourceWillPush() = 0; 807 virtual void geometrySourceWillPush() = 0;
808 virtual void geometrySourceWillPop(const GeometrySrcState& restoredState) = 0; 808 virtual void geometrySourceWillPop(const GeometrySrcState& restoredState) = 0;
809 // subclass called to perform drawing 809 // subclass called to perform drawing
810 virtual void onDraw(const DrawInfo&) = 0; 810 virtual void onDraw(const DrawInfo&) = 0;
811 // Implementation of drawRect. The geometry src and vertex attribs will alre ady 811 // Implementation of drawRect. The geometry src and vertex attribs will alre ady
812 // be saved before this is called and restored afterwards. A subclass may ov erride 812 // be saved before this is called and restored afterwards. A subclass may ov erride
813 // this to perform more optimal rect rendering. Its draws should be funneled through 813 // this to perform more optimal rect rendering. Its draws should be funneled through
814 // one of the public GrDrawTarget draw methods (e.g. drawNonIndexed, 814 // one of the public GrDrawTarget draw methods (e.g. drawNonIndexed,
815 // drawIndexedInstances, ...). The base class draws a two triangle fan using 815 // drawIndexedInstances, ...). The base class draws a two triangle fan using
816 // drawNonIndexed from reserved vertex space. 816 // drawNonIndexed from reserved vertex space.
817 virtual void onDrawRect(const GrRect& rect, 817 virtual void onDrawRect(const SkRect& rect,
818 const SkMatrix* matrix, 818 const SkMatrix* matrix,
819 const GrRect* localRect, 819 const SkRect* localRect,
820 const SkMatrix* localMatrix); 820 const SkMatrix* localMatrix);
821 virtual void onStencilPath(const GrPath*, const SkStrokeRec& stroke, SkPath: :FillType fill) = 0; 821 virtual void onStencilPath(const GrPath*, const SkStrokeRec& stroke, SkPath: :FillType fill) = 0;
822 822
823 // helpers for reserving vertex and index space. 823 // helpers for reserving vertex and index space.
824 bool reserveVertexSpace(size_t vertexSize, 824 bool reserveVertexSpace(size_t vertexSize,
825 int vertexCount, 825 int vertexCount,
826 void** vertices); 826 void** vertices);
827 bool reserveIndexSpace(int indexCount, void** indices); 827 bool reserveIndexSpace(int indexCount, void** indices);
828 828
829 // called by drawIndexed and drawNonIndexed. Use a negative indexCount to 829 // called by drawIndexed and drawNonIndexed. Use a negative indexCount to
(...skipping 16 matching lines...) Expand all
846 const GrClipData* fClip; 846 const GrClipData* fClip;
847 GrDrawState* fDrawState; 847 GrDrawState* fDrawState;
848 GrDrawState fDefaultDraw State; 848 GrDrawState fDefaultDraw State;
849 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar get. 849 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar get.
850 GrContext* fContext; 850 GrContext* fContext;
851 851
852 typedef GrRefCnt INHERITED; 852 typedef GrRefCnt INHERITED;
853 }; 853 };
854 854
855 #endif 855 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrDrawState.h ('k') | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698