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

Side by Side Diff: include/core/SkCanvas.h

Issue 195793012: De-virtualize SkCanvas matrix ops. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 9 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 | « experimental/PdfViewer/SkNulCanvas.h ('k') | include/utils/SkDeferredCanvas.h » ('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 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 SkCanvas_DEFINED 8 #ifndef SkCanvas_DEFINED
9 #define SkCanvas_DEFINED 9 #define SkCanvas_DEFINED
10 10
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 /** Returns true if drawing is currently going to a layer (from saveLayer) 435 /** Returns true if drawing is currently going to a layer (from saveLayer)
436 * rather than to the root device. 436 * rather than to the root device.
437 */ 437 */
438 virtual bool isDrawingToLayer() const; 438 virtual bool isDrawingToLayer() const;
439 439
440 /** Preconcat the current matrix with the specified translation 440 /** Preconcat the current matrix with the specified translation
441 @param dx The distance to translate in X 441 @param dx The distance to translate in X
442 @param dy The distance to translate in Y 442 @param dy The distance to translate in Y
443 returns true if the operation succeeded (e.g. did not overflow) 443 returns true if the operation succeeded (e.g. did not overflow)
444 */ 444 */
445 virtual bool translate(SkScalar dx, SkScalar dy); 445 bool translate(SkScalar dx, SkScalar dy);
446 446
447 /** Preconcat the current matrix with the specified scale. 447 /** Preconcat the current matrix with the specified scale.
448 @param sx The amount to scale in X 448 @param sx The amount to scale in X
449 @param sy The amount to scale in Y 449 @param sy The amount to scale in Y
450 returns true if the operation succeeded (e.g. did not overflow) 450 returns true if the operation succeeded (e.g. did not overflow)
451 */ 451 */
452 virtual bool scale(SkScalar sx, SkScalar sy); 452 bool scale(SkScalar sx, SkScalar sy);
453 453
454 /** Preconcat the current matrix with the specified rotation. 454 /** Preconcat the current matrix with the specified rotation.
455 @param degrees The amount to rotate, in degrees 455 @param degrees The amount to rotate, in degrees
456 returns true if the operation succeeded (e.g. did not overflow) 456 returns true if the operation succeeded (e.g. did not overflow)
457 */ 457 */
458 virtual bool rotate(SkScalar degrees); 458 bool rotate(SkScalar degrees);
459 459
460 /** Preconcat the current matrix with the specified skew. 460 /** Preconcat the current matrix with the specified skew.
461 @param sx The amount to skew in X 461 @param sx The amount to skew in X
462 @param sy The amount to skew in Y 462 @param sy The amount to skew in Y
463 returns true if the operation succeeded (e.g. did not overflow) 463 returns true if the operation succeeded (e.g. did not overflow)
464 */ 464 */
465 virtual bool skew(SkScalar sx, SkScalar sy); 465 bool skew(SkScalar sx, SkScalar sy);
466 466
467 /** Preconcat the current matrix with the specified matrix. 467 /** Preconcat the current matrix with the specified matrix.
468 @param matrix The matrix to preconcatenate with the current matrix 468 @param matrix The matrix to preconcatenate with the current matrix
469 @return true if the operation succeeded (e.g. did not overflow) 469 @return true if the operation succeeded (e.g. did not overflow)
470 */ 470 */
471 virtual bool concat(const SkMatrix& matrix); 471 bool concat(const SkMatrix& matrix);
472 472
473 /** Replace the current matrix with a copy of the specified matrix. 473 /** Replace the current matrix with a copy of the specified matrix.
474 @param matrix The matrix that will be copied into the current matrix. 474 @param matrix The matrix that will be copied into the current matrix.
475 */ 475 */
476 virtual void setMatrix(const SkMatrix& matrix); 476 void setMatrix(const SkMatrix& matrix);
477 477
478 /** Helper for setMatrix(identity). Sets the current matrix to identity. 478 /** Helper for setMatrix(identity). Sets the current matrix to identity.
479 */ 479 */
480 void resetMatrix(); 480 void resetMatrix();
481 481
482 /** 482 /**
483 * Modify the current clip with the specified rectangle. 483 * Modify the current clip with the specified rectangle.
484 * @param rect The rect to combine with the current clip 484 * @param rect The rect to combine with the current clip
485 * @param op The region op to apply to the current clip 485 * @param op The region op to apply to the current clip
486 * @param doAntiAlias true if the clip should be antialiased 486 * @param doAntiAlias true if the clip should be antialiased
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 // Overriders should call the corresponding INHERITED method up the inherita nce chain. 1205 // Overriders should call the corresponding INHERITED method up the inherita nce chain.
1206 // willSaveLayer()'s return value may suppress full layer allocation. 1206 // willSaveLayer()'s return value may suppress full layer allocation.
1207 enum SaveLayerStrategy { 1207 enum SaveLayerStrategy {
1208 kFullLayer_SaveLayerStrategy, 1208 kFullLayer_SaveLayerStrategy,
1209 kNoLayer_SaveLayerStrategy 1209 kNoLayer_SaveLayerStrategy
1210 }; 1210 };
1211 virtual void willSave(SaveFlags); 1211 virtual void willSave(SaveFlags);
1212 virtual SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveF lags); 1212 virtual SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveF lags);
1213 virtual void willRestore(); 1213 virtual void willRestore();
1214 1214
1215 virtual void didTranslate(SkScalar, SkScalar);
1216 virtual void didScale(SkScalar, SkScalar);
1217 virtual void didRotate(SkScalar);
1218 virtual void didSkew(SkScalar, SkScalar);
1219 virtual void didConcat(const SkMatrix&);
1220 virtual void didSetMatrix(const SkMatrix&);
1221
1215 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&); 1222 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&);
1216 1223
1217 enum ClipEdgeStyle { 1224 enum ClipEdgeStyle {
1218 kHard_ClipEdgeStyle, 1225 kHard_ClipEdgeStyle,
1219 kSoft_ClipEdgeStyle 1226 kSoft_ClipEdgeStyle
1220 }; 1227 };
1221 1228
1222 virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e dgeStyle); 1229 virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e dgeStyle);
1223 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl e edgeStyle); 1230 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl e edgeStyle);
1224 virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e dgeStyle); 1231 virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e dgeStyle);
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 bool asROBitmap(SkBitmap*) const; 1465 bool asROBitmap(SkBitmap*) const;
1459 1466
1460 private: 1467 private:
1461 SkBitmap fBitmap; // used if peekPixels() fails 1468 SkBitmap fBitmap; // used if peekPixels() fails
1462 const void* fAddr; // NULL on failure 1469 const void* fAddr; // NULL on failure
1463 SkImageInfo fInfo; 1470 SkImageInfo fInfo;
1464 size_t fRowBytes; 1471 size_t fRowBytes;
1465 }; 1472 };
1466 1473
1467 #endif 1474 #endif
OLDNEW
« no previous file with comments | « experimental/PdfViewer/SkNulCanvas.h ('k') | include/utils/SkDeferredCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698