OLD | NEW |
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 |
11 #include "SkTypes.h" | 11 #include "SkTypes.h" |
12 #include "SkBitmap.h" | 12 #include "SkBitmap.h" |
13 #include "SkDeque.h" | 13 #include "SkDeque.h" |
14 #include "SkClipStack.h" | 14 #include "SkClipStack.h" |
15 #include "SkPaint.h" | 15 #include "SkPaint.h" |
16 #include "SkRefCnt.h" | 16 #include "SkRefCnt.h" |
17 #include "SkPath.h" | 17 #include "SkPath.h" |
18 #include "SkRegion.h" | 18 #include "SkRegion.h" |
| 19 #include "SkSurfaceProps.h" |
19 #include "SkXfermode.h" | 20 #include "SkXfermode.h" |
20 | 21 |
21 #ifdef SK_SUPPORT_LEGACY_DRAWTEXT_VIRTUAL | 22 #ifdef SK_SUPPORT_LEGACY_DRAWTEXT_VIRTUAL |
22 #define SK_LEGACY_DRAWTEXT_VIRTUAL virtual | 23 #define SK_LEGACY_DRAWTEXT_VIRTUAL virtual |
23 #else | 24 #else |
24 #define SK_LEGACY_DRAWTEXT_VIRTUAL | 25 #define SK_LEGACY_DRAWTEXT_VIRTUAL |
25 #endif | 26 #endif |
26 | 27 |
27 class SkCanvasClipVisitor; | 28 class SkCanvasClipVisitor; |
28 class SkBaseDevice; | 29 class SkBaseDevice; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 /** Construct a canvas with the specified device to draw into. | 129 /** Construct a canvas with the specified device to draw into. |
129 | 130 |
130 @param device Specifies a device for the canvas to draw into. | 131 @param device Specifies a device for the canvas to draw into. |
131 */ | 132 */ |
132 explicit SkCanvas(SkBaseDevice* device); | 133 explicit SkCanvas(SkBaseDevice* device); |
133 | 134 |
134 /** Construct a canvas with the specified bitmap to draw into. | 135 /** Construct a canvas with the specified bitmap to draw into. |
135 @param bitmap Specifies a bitmap for the canvas to draw into. Its | 136 @param bitmap Specifies a bitmap for the canvas to draw into. Its |
136 structure are copied to the canvas. | 137 structure are copied to the canvas. |
137 */ | 138 */ |
138 explicit SkCanvas(const SkBitmap& bitmap); | 139 SkCanvas(const SkBitmap& bitmap, const SkSurfaceProps* = NULL); |
139 virtual ~SkCanvas(); | 140 virtual ~SkCanvas(); |
140 | 141 |
141 SkMetaData& getMetaData(); | 142 SkMetaData& getMetaData(); |
142 | 143 |
143 /** | 144 /** |
144 * Return ImageInfo for this canvas. If the canvas is not backed by pixels | 145 * Return ImageInfo for this canvas. If the canvas is not backed by pixels |
145 * (cpu or gpu), then the info's ColorType will be kUnknown_SkColorType. | 146 * (cpu or gpu), then the info's ColorType will be kUnknown_SkColorType. |
146 */ | 147 */ |
147 SkImageInfo imageInfo() const; | 148 SkImageInfo imageInfo() const; |
148 | 149 |
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1275 private: | 1276 private: |
1276 class MCRec; | 1277 class MCRec; |
1277 | 1278 |
1278 SkClipStack fClipStack; | 1279 SkClipStack fClipStack; |
1279 SkDeque fMCStack; | 1280 SkDeque fMCStack; |
1280 // points to top of stack | 1281 // points to top of stack |
1281 MCRec* fMCRec; | 1282 MCRec* fMCRec; |
1282 // the first N recs that can fit here mean we won't call malloc | 1283 // the first N recs that can fit here mean we won't call malloc |
1283 uint32_t fMCRecStorage[32]; | 1284 uint32_t fMCRecStorage[32]; |
1284 | 1285 |
| 1286 const SkSurfaceProps fProps; |
| 1287 |
1285 int fSaveLayerCount; // number of successful saveLayer calls | 1288 int fSaveLayerCount; // number of successful saveLayer calls |
1286 int fCullCount; // number of active culls | 1289 int fCullCount; // number of active culls |
1287 | 1290 |
1288 SkMetaData* fMetaData; | 1291 SkMetaData* fMetaData; |
1289 | 1292 |
1290 SkSurface_Base* fSurfaceBase; | 1293 SkSurface_Base* fSurfaceBase; |
1291 SkSurface_Base* getSurfaceBase() const { return fSurfaceBase; } | 1294 SkSurface_Base* getSurfaceBase() const { return fSurfaceBase; } |
1292 void setSurfaceBase(SkSurface_Base* sb) { | 1295 void setSurfaceBase(SkSurface_Base* sb) { |
1293 fSurfaceBase = sb; | 1296 fSurfaceBase = sb; |
1294 } | 1297 } |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1519 | 1522 |
1520 class SkCanvasClipVisitor { | 1523 class SkCanvasClipVisitor { |
1521 public: | 1524 public: |
1522 virtual ~SkCanvasClipVisitor(); | 1525 virtual ~SkCanvasClipVisitor(); |
1523 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1526 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
1524 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1527 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
1525 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1528 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
1526 }; | 1529 }; |
1527 | 1530 |
1528 #endif | 1531 #endif |
OLD | NEW |