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

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

Issue 20806003: Plumb in "bleed" flag (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Addressed pipe-specific issues and updated to ToT Created 7 years, 4 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 | « gm/bleed.cpp ('k') | include/core/SkDevice.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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
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 SkCanvas_DEFINED 10 #ifndef SkCanvas_DEFINED
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 were in a Shader with CLAMP mode. Thus the color outside of the original 666 were in a Shader with CLAMP mode. Thus the color outside of the original
667 width/height will be the edge color replicated. 667 width/height will be the edge color replicated.
668 @param bitmap The bitmap to be drawn 668 @param bitmap The bitmap to be drawn
669 @param left The position of the left side of the bitmap being drawn 669 @param left The position of the left side of the bitmap being drawn
670 @param top The position of the top side of the bitmap being drawn 670 @param top The position of the top side of the bitmap being drawn
671 @param paint The paint used to draw the bitmap, or NULL 671 @param paint The paint used to draw the bitmap, or NULL
672 */ 672 */
673 virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, 673 virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
674 const SkPaint* paint = NULL); 674 const SkPaint* paint = NULL);
675 675
676 enum DrawBitmapRectFlags {
677 kNone_DrawBitmapRectflag = 0x0,
reed1 2013/08/14 15:50:56 nit: flag should be Flag
678 /**
679 * When filtering is enabled, allow the color samples outside of
680 * the src rect (but still in the src bitmap) to bleed into the
681 * drawn portion
682 */
683 kBleed_DrawBitmapRectFlag = 0x1,
684 };
685
676 /** Draw the specified bitmap, with the specified matrix applied (before the 686 /** Draw the specified bitmap, with the specified matrix applied (before the
677 canvas' matrix is applied). 687 canvas' matrix is applied).
678 @param bitmap The bitmap to be drawn 688 @param bitmap The bitmap to be drawn
679 @param src Optional: specify the subset of the bitmap to be drawn 689 @param src Optional: specify the subset of the bitmap to be drawn
680 @param dst The destination rectangle where the scaled/translated 690 @param dst The destination rectangle where the scaled/translated
681 image will be drawn 691 image will be drawn
682 @param paint The paint used to draw the bitmap, or NULL 692 @param paint The paint used to draw the bitmap, or NULL
683 */ 693 */
684 virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, 694 virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
685 const SkRect& dst, 695 const SkRect& dst,
686 const SkPaint* paint); 696 const SkPaint* paint = NULL,
697 DrawBitmapRectFlags flags = kNone_DrawBitm apRectflag);
687 698
688 void drawBitmapRect(const SkBitmap& bitmap, const SkRect& dst, 699 void drawBitmapRect(const SkBitmap& bitmap, const SkRect& dst,
689 const SkPaint* paint) { 700 const SkPaint* paint = NULL) {
690 this->drawBitmapRectToRect(bitmap, NULL, dst, paint); 701 this->drawBitmapRectToRect(bitmap, NULL, dst, paint, kNone_DrawBitmapRec tflag);
691 } 702 }
692 703
693 void drawBitmapRect(const SkBitmap& bitmap, const SkIRect* isrc, 704 void drawBitmapRect(const SkBitmap& bitmap, const SkIRect* isrc,
694 const SkRect& dst, const SkPaint* paint = NULL) { 705 const SkRect& dst, const SkPaint* paint = NULL,
706 DrawBitmapRectFlags flags = kNone_DrawBitmapRectflag) {
695 SkRect realSrcStorage; 707 SkRect realSrcStorage;
696 SkRect* realSrcPtr = NULL; 708 SkRect* realSrcPtr = NULL;
697 if (isrc) { 709 if (isrc) {
698 realSrcStorage.set(*isrc); 710 realSrcStorage.set(*isrc);
699 realSrcPtr = &realSrcStorage; 711 realSrcPtr = &realSrcStorage;
700 } 712 }
701 this->drawBitmapRectToRect(bitmap, realSrcPtr, dst, paint); 713 this->drawBitmapRectToRect(bitmap, realSrcPtr, dst, paint, flags);
702 } 714 }
703 715
704 virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m, 716 virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m,
705 const SkPaint* paint = NULL); 717 const SkPaint* paint = NULL);
706 718
707 /** 719 /**
708 * Draw the bitmap stretched differentially to fit into dst. 720 * Draw the bitmap stretched differentially to fit into dst.
709 * center is a rect within the bitmap, and logically divides the bitmap 721 * center is a rect within the bitmap, and logically divides the bitmap
710 * into 9 sections (3x3). For example, if the middle pixel of a [5x5] 722 * into 9 sections (3x3). For example, if the middle pixel of a [5x5]
711 * bitmap is the "center", then the center-rect should be [2, 2, 3, 3]. 723 * bitmap is the "center", then the center-rect should be [2, 2, 3, 3].
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 1076
1065 SkDevice* createLayerDevice(SkBitmap::Config, int width, int height, 1077 SkDevice* createLayerDevice(SkBitmap::Config, int width, int height,
1066 bool isOpaque); 1078 bool isOpaque);
1067 1079
1068 SkDevice* init(SkDevice*); 1080 SkDevice* init(SkDevice*);
1069 1081
1070 // internal methods are not virtual, so they can safely be called by other 1082 // internal methods are not virtual, so they can safely be called by other
1071 // canvas apis, without confusing subclasses (like SkPictureRecording) 1083 // canvas apis, without confusing subclasses (like SkPictureRecording)
1072 void internalDrawBitmap(const SkBitmap&, const SkMatrix& m, const SkPaint* p aint); 1084 void internalDrawBitmap(const SkBitmap&, const SkMatrix& m, const SkPaint* p aint);
1073 void internalDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, 1085 void internalDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src,
1074 const SkRect& dst, const SkPaint* paint); 1086 const SkRect& dst, const SkPaint* paint,
1087 DrawBitmapRectFlags flags);
1075 void internalDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, 1088 void internalDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
1076 const SkRect& dst, const SkPaint* paint); 1089 const SkRect& dst, const SkPaint* paint);
1077 void internalDrawPaint(const SkPaint& paint); 1090 void internalDrawPaint(const SkPaint& paint);
1078 int internalSaveLayer(const SkRect* bounds, const SkPaint* paint, 1091 int internalSaveLayer(const SkRect* bounds, const SkPaint* paint,
1079 SaveFlags, bool justForImageFilter); 1092 SaveFlags, bool justForImageFilter);
1080 void internalDrawDevice(SkDevice*, int x, int y, const SkPaint*); 1093 void internalDrawDevice(SkDevice*, int x, int y, const SkPaint*);
1081 1094
1082 // shared by save() and saveLayer() 1095 // shared by save() and saveLayer()
1083 int internalSave(SaveFlags flags); 1096 int internalSave(SaveFlags flags);
1084 void internalRestore(); 1097 void internalRestore();
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 if (NULL != fCanvas) { 1189 if (NULL != fCanvas) {
1177 fCanvas->endCommentGroup(); 1190 fCanvas->endCommentGroup();
1178 } 1191 }
1179 } 1192 }
1180 1193
1181 private: 1194 private:
1182 SkCanvas* fCanvas; 1195 SkCanvas* fCanvas;
1183 }; 1196 };
1184 1197
1185 #endif 1198 #endif
OLDNEW
« no previous file with comments | « gm/bleed.cpp ('k') | include/core/SkDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698