| 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 | 7 |
| 8 #ifndef SkRecords_DEFINED | 8 #ifndef SkRecords_DEFINED |
| 9 #define SkRecords_DEFINED | 9 #define SkRecords_DEFINED |
| 10 | 10 |
| 11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
| 12 #include "SkDrawable.h" | 12 #include "SkDrawable.h" |
| 13 #include "SkPathPriv.h" |
| 13 #include "SkPicture.h" | 14 #include "SkPicture.h" |
| 14 #include "SkTextBlob.h" | 15 #include "SkTextBlob.h" |
| 15 | 16 |
| 16 namespace SkRecords { | 17 namespace SkRecords { |
| 17 | 18 |
| 18 // A list of all the types of canvas calls we can record. | 19 // A list of all the types of canvas calls we can record. |
| 19 // Each of these is reified into a struct below. | 20 // Each of these is reified into a struct below. |
| 20 // | 21 // |
| 21 // (We're using the macro-of-macro trick here to do several different things wit
h the same list.) | 22 // (We're using the macro-of-macro trick here to do several different things wit
h the same list.) |
| 22 // | 23 // |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 SkBitmap fBitmap; | 209 SkBitmap fBitmap; |
| 209 }; | 210 }; |
| 210 | 211 |
| 211 // SkPath::getBounds() isn't thread safe unless we precache the bounds in a sing
lethreaded context. | 212 // SkPath::getBounds() isn't thread safe unless we precache the bounds in a sing
lethreaded context. |
| 212 // SkPath::cheapComputeDirection() is similar. | 213 // SkPath::cheapComputeDirection() is similar. |
| 213 // Recording is a convenient time to cache these, or we can delay it to between
record and playback. | 214 // Recording is a convenient time to cache these, or we can delay it to between
record and playback. |
| 214 struct PreCachedPath : public SkPath { | 215 struct PreCachedPath : public SkPath { |
| 215 PreCachedPath() {} | 216 PreCachedPath() {} |
| 216 explicit PreCachedPath(const SkPath& path) : SkPath(path) { | 217 explicit PreCachedPath(const SkPath& path) : SkPath(path) { |
| 217 this->updateBoundsCache(); | 218 this->updateBoundsCache(); |
| 218 SkPath::Direction junk; | 219 SkPathPriv::FirstDirection junk; |
| 219 (void)this->cheapComputeDirection(&junk); | 220 (void)SkPathPriv::CheapComputeFirstDirection(*this, &junk); |
| 220 } | 221 } |
| 221 }; | 222 }; |
| 222 | 223 |
| 223 // Like SkPath::getBounds(), SkMatrix::getType() isn't thread safe unless we pre
cache it. | 224 // Like SkPath::getBounds(), SkMatrix::getType() isn't thread safe unless we pre
cache it. |
| 224 // This may not cover all SkMatrices used by the picture (e.g. some could be hid
ing in a shader). | 225 // This may not cover all SkMatrices used by the picture (e.g. some could be hid
ing in a shader). |
| 225 struct TypedMatrix : public SkMatrix { | 226 struct TypedMatrix : public SkMatrix { |
| 226 TypedMatrix() {} | 227 TypedMatrix() {} |
| 227 explicit TypedMatrix(const SkMatrix& matrix) : SkMatrix(matrix) { | 228 explicit TypedMatrix(const SkMatrix& matrix) : SkMatrix(matrix) { |
| 228 (void)this->getType(); | 229 (void)this->getType(); |
| 229 } | 230 } |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 #undef RECORD0 | 359 #undef RECORD0 |
| 359 #undef RECORD1 | 360 #undef RECORD1 |
| 360 #undef RECORD2 | 361 #undef RECORD2 |
| 361 #undef RECORD3 | 362 #undef RECORD3 |
| 362 #undef RECORD4 | 363 #undef RECORD4 |
| 363 #undef RECORD5 | 364 #undef RECORD5 |
| 364 | 365 |
| 365 } // namespace SkRecords | 366 } // namespace SkRecords |
| 366 | 367 |
| 367 #endif//SkRecords_DEFINED | 368 #endif//SkRecords_DEFINED |
| OLD | NEW |