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

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

Issue 551463004: introduce Props to surface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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
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
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 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
1295 friend class SkSurface_Base; 1298 friend class SkSurface_Base;
1296 friend class SkSurface_Gpu; 1299 friend class SkSurface_Gpu;
1297 1300
1298 bool fDeviceCMDirty; // cleared by updateDeviceCMCache() 1301 bool fDeviceCMDirty; // cleared by updateDeviceCMCache()
1299 void updateDeviceCMCache(); 1302 void updateDeviceCMCache();
1300 1303
1301 friend class SkDrawIter; // needs setupDrawForLayerDevice() 1304 friend class SkDrawIter; // needs setupDrawForLayerDevice()
1302 friend class AutoDrawLooper; 1305 friend class AutoDrawLooper;
1303 friend class SkLua; // needs top layer size and offset 1306 friend class SkLua; // needs top layer size and offset
1304 friend class SkDebugCanvas; // needs experimental fAllowSimplifyClip 1307 friend class SkDebugCanvas; // needs experimental fAllowSimplifyClip
1305 friend class SkDeferredDevice; // needs getTopDevice() 1308 friend class SkDeferredDevice; // needs getTopDevice()
1306 friend class SkSurface_Raster; // needs getDevice() 1309 friend class SkSurface_Raster; // needs getDevice()
1307 friend class SkRecorder; // InitFlags 1310 friend class SkRecorder; // InitFlags
1308 friend class SkNoSaveLayerCanvas; // InitFlags 1311 friend class SkNoSaveLayerCanvas; // InitFlags
1309 1312
1310 enum InitFlags { 1313 enum InitFlags {
1311 kDefault_InitFlags = 0, 1314 kDefault_InitFlags = 0,
1312 kConservativeRasterClip_InitFlag = 1 << 0, 1315 kConservativeRasterClip_InitFlag = 1 << 0,
1313 }; 1316 };
1314 SkCanvas(int width, int height, InitFlags flags); 1317 SkCanvas(int width, int height, InitFlags);
1315 SkCanvas(SkBaseDevice*, InitFlags flags); 1318 SkCanvas(SkBaseDevice*, const SkSurfaceProps*, InitFlags);
1319 SkCanvas(const SkBitmap&, const SkSurfaceProps&);
1316 1320
1317 // needs gettotalclip() 1321 // needs gettotalclip()
1318 friend SkCanvasState* SkCanvasStateUtils::CaptureCanvasState(SkCanvas*); 1322 friend SkCanvasState* SkCanvasStateUtils::CaptureCanvasState(SkCanvas*);
1319 1323
1320 SkBaseDevice* createLayerDevice(const SkImageInfo&); 1324 SkBaseDevice* createLayerDevice(const SkImageInfo&);
1321 1325
1326 // call this each time we attach ourselves to a device
1327 // - constructor
1328 // - internalSaveLayer
1329 void setupDevice(SkBaseDevice*);
1330
1322 SkBaseDevice* init(SkBaseDevice*, InitFlags); 1331 SkBaseDevice* init(SkBaseDevice*, InitFlags);
1323 1332
1324 /** 1333 /**
1325 * DEPRECATED 1334 * DEPRECATED
1326 * 1335 *
1327 * Specify a device for this canvas to draw into. If it is not null, its 1336 * Specify a device for this canvas to draw into. If it is not null, its
1328 * reference count is incremented. If the canvas was already holding a 1337 * reference count is incremented. If the canvas was already holding a
1329 * device, its reference count is decremented. The new device is returned. 1338 * device, its reference count is decremented. The new device is returned.
1330 */ 1339 */
1331 SkBaseDevice* setRootDevice(SkBaseDevice* device); 1340 SkBaseDevice* setRootDevice(SkBaseDevice* device);
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1519 1528
1520 class SkCanvasClipVisitor { 1529 class SkCanvasClipVisitor {
1521 public: 1530 public:
1522 virtual ~SkCanvasClipVisitor(); 1531 virtual ~SkCanvasClipVisitor();
1523 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; 1532 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0;
1524 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; 1533 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0;
1525 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; 1534 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0;
1526 }; 1535 };
1527 1536
1528 #endif 1537 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698