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 #include "SkBitmapProcShader.h" | 8 #include "SkBitmapProcShader.h" |
9 #include "SkColorShader.h" | 9 #include "SkColorShader.h" |
10 #include "SkEmptyShader.h" | 10 #include "SkEmptyShader.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 #endif | 37 #endif |
38 } | 38 } |
39 | 39 |
40 SkShader::SkShader(const SkMatrix* localMatrix) { | 40 SkShader::SkShader(const SkMatrix* localMatrix) { |
41 inc_shader_counter(); | 41 inc_shader_counter(); |
42 if (localMatrix) { | 42 if (localMatrix) { |
43 fLocalMatrix = *localMatrix; | 43 fLocalMatrix = *localMatrix; |
44 } else { | 44 } else { |
45 fLocalMatrix.reset(); | 45 fLocalMatrix.reset(); |
46 } | 46 } |
| 47 // Pre-cache so future calls to fLocalMatrix.getType() are threadsafe. |
| 48 (void)fLocalMatrix.getType(); |
47 } | 49 } |
48 | 50 |
49 SkShader::~SkShader() { | 51 SkShader::~SkShader() { |
50 dec_shader_counter(); | 52 dec_shader_counter(); |
51 } | 53 } |
52 | 54 |
53 void SkShader::flatten(SkWriteBuffer& buffer) const { | 55 void SkShader::flatten(SkWriteBuffer& buffer) const { |
54 this->INHERITED::flatten(buffer); | 56 this->INHERITED::flatten(buffer); |
55 bool hasLocalM = !fLocalMatrix.isIdentity(); | 57 bool hasLocalM = !fLocalMatrix.isIdentity(); |
56 buffer.writeBool(hasLocalM); | 58 buffer.writeBool(hasLocalM); |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 #include "SkEmptyShader.h" | 387 #include "SkEmptyShader.h" |
386 | 388 |
387 void SkEmptyShader::toString(SkString* str) const { | 389 void SkEmptyShader::toString(SkString* str) const { |
388 str->append("SkEmptyShader: ("); | 390 str->append("SkEmptyShader: ("); |
389 | 391 |
390 this->INHERITED::toString(str); | 392 this->INHERITED::toString(str); |
391 | 393 |
392 str->append(")"); | 394 str->append(")"); |
393 } | 395 } |
394 #endif | 396 #endif |
OLD | NEW |