OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
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 #ifndef SkMatrixClipStateMgr_DEFINED | 7 #ifndef SkMatrixClipStateMgr_DEFINED |
8 #define SkMatrixClipStateMgr_DEFINED | 8 #define SkMatrixClipStateMgr_DEFINED |
9 | 9 |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 SkTDArray<SkMatrix> fMatrixDict; | 361 SkTDArray<SkMatrix> fMatrixDict; |
362 | 362 |
363 SkTDArray<SkRegion*> fRegionDict; | 363 SkTDArray<SkRegion*> fRegionDict; |
364 | 364 |
365 // The MCStateID of the state currently in effect in the byte stream. 0 if n
one. | 365 // The MCStateID of the state currently in effect in the byte stream. 0 if n
one. |
366 int32_t fCurOpenStateID; | 366 int32_t fCurOpenStateID; |
367 // The skip offsets for the current open state. These are the locations in t
he | 367 // The skip offsets for the current open state. These are the locations in t
he |
368 // skp that must be filled in when the current open state is closed. These a
re | 368 // skp that must be filled in when the current open state is closed. These a
re |
369 // here rather then distributed across the MatrixClipState's because saveLay
ers | 369 // here rather then distributed across the MatrixClipState's because saveLay
ers |
370 // can cause MC states to be nested. | 370 // can cause MC states to be nested. |
371 SkTDArray<int32_t> *fSkipOffsets; | 371 SkTDArray<int32_t> *fSkipOffsets; // TODO: should we store u32 or size_t i
nstead? |
372 | 372 |
373 SkDEBUGCODE(void validate();) | 373 SkDEBUGCODE(void validate();) |
374 | 374 |
375 int MCStackPush(SkCanvas::SaveFlags flags); | 375 int MCStackPush(SkCanvas::SaveFlags flags); |
376 | 376 |
377 void addClipOffset(int offset) { | 377 void addClipOffset(size_t offset) { |
378 SkASSERT(NULL != fSkipOffsets); | 378 SkASSERT(NULL != fSkipOffsets); |
379 SkASSERT(kIdentityWideOpenStateID != fCurOpenStateID); | 379 SkASSERT(kIdentityWideOpenStateID != fCurOpenStateID); |
380 SkASSERT(fCurMCState->fHasOpen); | 380 SkASSERT(fCurMCState->fHasOpen); |
381 SkASSERT(!fCurMCState->fIsSaveLayer); | 381 SkASSERT(!fCurMCState->fIsSaveLayer); |
382 | 382 |
383 *fSkipOffsets->append() = offset; | 383 *fSkipOffsets->append() = SkToS32(offset); |
384 } | 384 } |
385 | 385 |
386 void writeDeltaMat(int currentMatID, int desiredMatID); | 386 void writeDeltaMat(int currentMatID, int desiredMatID); |
387 static int32_t NewMCStateID(); | 387 static int32_t NewMCStateID(); |
388 | 388 |
389 int addRegionToDict(const SkRegion& region); | 389 int addRegionToDict(const SkRegion& region); |
390 const SkRegion* lookupRegion(int index) { | 390 const SkRegion* lookupRegion(int index) { |
391 SkASSERT(index >= 0 && index < fRegionDict.count()); | 391 SkASSERT(index >= 0 && index < fRegionDict.count()); |
392 return fRegionDict[index]; | 392 return fRegionDict[index]; |
393 } | 393 } |
(...skipping 11 matching lines...) Expand all Loading... |
405 #ifdef SK_DEBUG | 405 #ifdef SK_DEBUG |
406 int fActualDepth; | 406 int fActualDepth; |
407 #endif | 407 #endif |
408 | 408 |
409 // save layers are nested within a specific MC state. This stack tracks | 409 // save layers are nested within a specific MC state. This stack tracks |
410 // the nesting MC state's ID as save layers are pushed and popped. | 410 // the nesting MC state's ID as save layers are pushed and popped. |
411 SkTDArray<int> fStateIDStack; | 411 SkTDArray<int> fStateIDStack; |
412 }; | 412 }; |
413 | 413 |
414 #endif | 414 #endif |
OLD | NEW |