OLD | NEW |
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 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m, | 698 virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m, |
699 const SkPaint* paint = NULL); | 699 const SkPaint* paint = NULL); |
700 | 700 |
701 /** | 701 /** |
702 * Draw the bitmap stretched differentially to fit into dst. | 702 * Draw the bitmap stretched differentially to fit into dst. |
703 * center is a rect within the bitmap, and logically divides the bitmap | 703 * center is a rect within the bitmap, and logically divides the bitmap |
704 * into 9 sections (3x3). For example, if the middle pixel of a [5x5] | 704 * into 9 sections (3x3). For example, if the middle pixel of a [5x5] |
705 * bitmap is the "center", then the center-rect should be [2, 2, 3, 3]. | 705 * bitmap is the "center", then the center-rect should be [2, 2, 3, 3]. |
706 * | 706 * |
707 * If the dst is >= the bitmap size, then... | 707 * If the dst is >= the bitmap size, then... |
708 * - The 4 corners are not stretch at all. | 708 * - The 4 corners are not stretched at all. |
709 * - The sides are stretch in only one axis. | 709 * - The sides are stretched in only one axis. |
710 * - The center is stretch in both axes. | 710 * - The center is stretched in both axes. |
711 * Else, for each axis where dst < bitmap, | 711 * Else, for each axis where dst < bitmap, |
712 * - The corners shrink proportionally | 712 * - The corners shrink proportionally |
713 * - The sides (along the shrink axis) and center are not drawn | 713 * - The sides (along the shrink axis) and center are not drawn |
714 */ | 714 */ |
715 virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, | 715 virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, |
716 const SkRect& dst, const SkPaint* paint = NULL); | 716 const SkRect& dst, const SkPaint* paint = NULL); |
717 | 717 |
718 /** Draw the specified bitmap, with its top/left corner at (x,y), | 718 /** Draw the specified bitmap, with its top/left corner at (x,y), |
719 NOT transformed by the current matrix. Note: if the paint | 719 NOT transformed by the current matrix. Note: if the paint |
720 contains a maskfilter that generates a mask which extends beyond the | 720 contains a maskfilter that generates a mask which extends beyond the |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 bool fDone; | 995 bool fDone; |
996 }; | 996 }; |
997 | 997 |
998 protected: | 998 protected: |
999 // Returns the canvas to be used by DrawIter. Default implementation | 999 // Returns the canvas to be used by DrawIter. Default implementation |
1000 // returns this. Subclasses that encapsulate an indirect canvas may | 1000 // returns this. Subclasses that encapsulate an indirect canvas may |
1001 // need to overload this method. The impl must keep track of this, as it | 1001 // need to overload this method. The impl must keep track of this, as it |
1002 // is not released or deleted by the caller. | 1002 // is not released or deleted by the caller. |
1003 virtual SkCanvas* canvasForDrawIter(); | 1003 virtual SkCanvas* canvasForDrawIter(); |
1004 | 1004 |
1005 // all of the drawBitmap variants call this guy | |
1006 void commonDrawBitmap(const SkBitmap&, const SkIRect*, const SkMatrix&, | |
1007 const SkPaint& paint); | |
1008 | |
1009 // Clip rectangle bounds. Called internally by saveLayer. | 1005 // Clip rectangle bounds. Called internally by saveLayer. |
1010 // returns false if the entire rectangle is entirely clipped out | 1006 // returns false if the entire rectangle is entirely clipped out |
1011 bool clipRectBounds(const SkRect* bounds, SaveFlags flags, | 1007 bool clipRectBounds(const SkRect* bounds, SaveFlags flags, |
1012 SkIRect* intersection); | 1008 SkIRect* intersection); |
1013 | 1009 |
1014 // Called by child classes that override clipPath and clipRRect to only | 1010 // Called by child classes that override clipPath and clipRRect to only |
1015 // track fast conservative clip bounds, rather than exact clips. | 1011 // track fast conservative clip bounds, rather than exact clips. |
1016 bool updateClipConservativelyUsingBounds(const SkRect&, SkRegion::Op, | 1012 bool updateClipConservativelyUsingBounds(const SkRect&, SkRegion::Op, |
1017 bool inverseFilled); | 1013 bool inverseFilled); |
1018 | 1014 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 friend class SkDrawIter; // needs setupDrawForLayerDevice() | 1056 friend class SkDrawIter; // needs setupDrawForLayerDevice() |
1061 friend class AutoDrawLooper; | 1057 friend class AutoDrawLooper; |
1062 | 1058 |
1063 SkDevice* createLayerDevice(SkBitmap::Config, int width, int height, | 1059 SkDevice* createLayerDevice(SkBitmap::Config, int width, int height, |
1064 bool isOpaque); | 1060 bool isOpaque); |
1065 | 1061 |
1066 SkDevice* init(SkDevice*); | 1062 SkDevice* init(SkDevice*); |
1067 | 1063 |
1068 // internal methods are not virtual, so they can safely be called by other | 1064 // internal methods are not virtual, so they can safely be called by other |
1069 // canvas apis, without confusing subclasses (like SkPictureRecording) | 1065 // canvas apis, without confusing subclasses (like SkPictureRecording) |
1070 void internalDrawBitmap(const SkBitmap&, const SkIRect*, const SkMatrix& m, | 1066 void internalDrawBitmap(const SkBitmap&, const SkMatrix& m, const SkPaint* p
aint); |
1071 const SkPaint* paint); | |
1072 void internalDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, | 1067 void internalDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, |
1073 const SkRect& dst, const SkPaint* paint); | 1068 const SkRect& dst, const SkPaint* paint); |
1074 void internalDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, | 1069 void internalDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, |
1075 const SkRect& dst, const SkPaint* paint); | 1070 const SkRect& dst, const SkPaint* paint); |
1076 void internalDrawPaint(const SkPaint& paint); | 1071 void internalDrawPaint(const SkPaint& paint); |
1077 int internalSaveLayer(const SkRect* bounds, const SkPaint* paint, | 1072 int internalSaveLayer(const SkRect* bounds, const SkPaint* paint, |
1078 SaveFlags, bool justForImageFilter); | 1073 SaveFlags, bool justForImageFilter); |
1079 void internalDrawDevice(SkDevice*, int x, int y, const SkPaint*); | 1074 void internalDrawDevice(SkDevice*, int x, int y, const SkPaint*); |
1080 | 1075 |
1081 // shared by save() and saveLayer() | 1076 // shared by save() and saveLayer() |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1175 if (NULL != fCanvas) { | 1170 if (NULL != fCanvas) { |
1176 fCanvas->endCommentGroup(); | 1171 fCanvas->endCommentGroup(); |
1177 } | 1172 } |
1178 } | 1173 } |
1179 | 1174 |
1180 private: | 1175 private: |
1181 SkCanvas* fCanvas; | 1176 SkCanvas* fCanvas; |
1182 }; | 1177 }; |
1183 | 1178 |
1184 #endif | 1179 #endif |
OLD | NEW |